codecharta-visualization 1.86.0 → 1.89.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/Dockerfile +1 -1
- package/app/app.module.ts +30 -6
- package/app/codeCharta/codeCharta.component.html +0 -2
- package/app/codeCharta/codeCharta.component.ts +2 -0
- package/app/codeCharta/codeCharta.model.ts +8 -5
- package/app/codeCharta/codeCharta.service.spec.ts +41 -50
- package/app/codeCharta/codeCharta.service.ts +33 -32
- package/app/codeCharta/e2e/url.e2e.ts +1 -1
- package/app/codeCharta/services/ajs-upgraded-providers.ts +13 -0
- package/app/codeCharta/state/angular-redux/effects/createEffect.spec.ts +37 -0
- package/app/codeCharta/state/angular-redux/effects/createEffect.ts +25 -0
- package/app/codeCharta/state/angular-redux/effects/effects.module.ts +36 -0
- package/app/codeCharta/state/angular-redux/ofType.ts +11 -0
- package/app/codeCharta/state/angular-redux/state.ts +12 -0
- package/app/codeCharta/state/angular-redux/store.ts +1 -1
- package/app/codeCharta/state/effects/addBlacklistItemsIfNotResultsInEmptyMap/addBlacklistItemsIfNotResultsInEmptyMap.effect.spec.ts +60 -0
- package/app/codeCharta/state/effects/addBlacklistItemsIfNotResultsInEmptyMap/addBlacklistItemsIfNotResultsInEmptyMap.effect.ts +56 -0
- package/app/codeCharta/state/effects/addBlacklistItemsIfNotResultsInEmptyMap/resultsInEmptyMap.ts +22 -0
- package/app/codeCharta/state/effects/nodeContextMenu/excludeButton/excludeButton.component.html +3 -0
- package/app/codeCharta/state/effects/nodeContextMenu/excludeButton/excludeButton.component.ts +26 -0
- package/app/codeCharta/state/effects/nodeContextMenu/flattenButtons/flattenButtons.component.html +13 -0
- package/app/codeCharta/state/effects/nodeContextMenu/flattenButtons/flattenButtons.component.spec.ts +55 -0
- package/app/codeCharta/state/effects/nodeContextMenu/flattenButtons/flattenButtons.component.ts +34 -0
- package/app/codeCharta/state/effects/nodeContextMenu/flattenButtons/flattenButtons.module.ts +11 -0
- package/app/codeCharta/state/effects/nodeContextMenu/focusButtons/focusButtons.component.html +24 -0
- package/app/codeCharta/state/effects/nodeContextMenu/focusButtons/focusButtons.component.spec.ts +55 -0
- package/app/codeCharta/state/effects/nodeContextMenu/focusButtons/focusButtons.component.ts +38 -0
- package/app/codeCharta/state/effects/nodeContextMenu/focusButtons/focusButtons.module.ts +13 -0
- package/app/codeCharta/state/effects/nodeContextMenu/focusButtons/isNodeFocused.pipe.spec.ts +31 -0
- package/app/codeCharta/state/effects/nodeContextMenu/focusButtons/isNodeFocused.pipe.ts +25 -0
- package/app/codeCharta/state/effects/nodeContextMenu/highlightButtons/highlightButtons.component.html +6 -0
- package/app/codeCharta/state/effects/nodeContextMenu/highlightButtons/highlightButtons.component.spec.ts +64 -0
- package/app/codeCharta/state/effects/nodeContextMenu/highlightButtons/highlightButtons.component.ts +39 -0
- package/app/codeCharta/state/effects/nodeContextMenu/highlightButtons/highlightButtons.module.ts +11 -0
- package/app/codeCharta/state/effects/nodeContextMenu/markFolderRow/markFolderRow.component.html +22 -0
- package/app/codeCharta/state/effects/nodeContextMenu/markFolderRow/markFolderRow.component.scss +31 -0
- package/app/codeCharta/state/effects/nodeContextMenu/markFolderRow/markFolderRow.component.spec.ts +35 -0
- package/app/codeCharta/state/effects/nodeContextMenu/markFolderRow/markFolderRow.component.ts +30 -0
- package/app/codeCharta/state/effects/nodeContextMenu/markFolderRow/markFolderRow.module.ts +11 -0
- package/app/codeCharta/state/effects/nodeContextMenu/markFolderRow/selectors/markFolderItems.selector.spec.ts +17 -0
- package/app/codeCharta/state/effects/nodeContextMenu/markFolderRow/selectors/markFolderItems.selector.ts +29 -0
- package/app/codeCharta/{ui → state/effects}/nodeContextMenu/nodeContextMenu.e2e.ts +4 -16
- package/app/codeCharta/{ui → state/effects}/nodeContextMenu/nodeContextMenu.po.ts +1 -1
- package/app/codeCharta/state/effects/nodeContextMenu/nodeContextMenu.service.spec.ts +78 -0
- package/app/codeCharta/state/effects/nodeContextMenu/nodeContextMenu.service.ts +72 -0
- package/app/codeCharta/state/effects/nodeContextMenu/nodeContextMenuCard/lastPartOfNodePath.pipe.spec.ts +11 -0
- package/app/codeCharta/state/effects/nodeContextMenu/nodeContextMenuCard/lastPartOfNodePath.pipe.ts +8 -0
- package/app/codeCharta/state/effects/nodeContextMenu/nodeContextMenuCard/nodeContextMenuCard.component.html +17 -0
- package/app/codeCharta/state/effects/nodeContextMenu/nodeContextMenuCard/nodeContextMenuCard.component.scss +34 -0
- package/app/codeCharta/state/effects/nodeContextMenu/nodeContextMenuCard/nodeContextMenuCard.component.spec.ts +49 -0
- package/app/codeCharta/state/effects/nodeContextMenu/nodeContextMenuCard/nodeContextMenuCard.component.ts +19 -0
- package/app/codeCharta/state/effects/nodeContextMenu/nodeContextMenuCard/nodeContextMenuCard.module.ts +18 -0
- package/app/codeCharta/state/effects/nodeContextMenu/openNodeContextMenu.effect.spec.ts +32 -0
- package/app/codeCharta/state/effects/nodeContextMenu/openNodeContextMenu.effect.ts +33 -0
- package/app/codeCharta/state/effects/nodeContextMenu/rightClickedCodeMapNode.selector.ts +8 -0
- package/app/codeCharta/state/effects/unfocusNodesOnLoadingMap.effect.spec.ts +47 -0
- package/app/codeCharta/state/effects/unfocusNodesOnLoadingMap.effect.ts +18 -0
- package/app/codeCharta/state/selectors/allNecessaryRenderDataAvailable/areAllNecessaryRenderDataAvailable.selector.ts +30 -0
- package/app/codeCharta/state/selectors/allNecessaryRenderDataAvailable/utils/areDynamicSettingsAvailable.spec.ts +36 -0
- package/app/codeCharta/state/selectors/allNecessaryRenderDataAvailable/utils/areDynamicSettingsAvailable.ts +10 -0
- package/app/codeCharta/state/selectors/allNecessaryRenderDataAvailable/utils/areMetricsAvailable.spec.ts +13 -0
- package/app/codeCharta/state/selectors/allNecessaryRenderDataAvailable/utils/areMetricsAvailable.ts +8 -0
- package/app/codeCharta/state/store/appSettings/appSettings.actions.ts +2 -0
- package/app/codeCharta/state/store/appSettings/appSettings.reducer.ts +2 -0
- package/app/codeCharta/state/store/appSettings/invertArea/invertArea.actions.ts +32 -0
- package/app/codeCharta/state/store/appSettings/invertArea/invertArea.reducer.spec.ts +26 -0
- package/app/codeCharta/state/store/appSettings/invertArea/invertArea.reducer.ts +12 -0
- package/app/codeCharta/state/store/appSettings/invertArea/invertArea.selector.ts +3 -0
- package/app/codeCharta/state/store/appSettings/isLoadingMap/isLoadingMap.reducer.spec.ts +14 -3
- package/app/codeCharta/state/store/appSettings/isLoadingMap/isLoadingMap.reducer.ts +41 -6
- package/app/codeCharta/state/store/appStatus/appStatus.reducer.ts +3 -1
- package/app/codeCharta/state/store/appStatus/appStatus.selector.ts +3 -0
- package/app/codeCharta/state/store/appStatus/rightClickedNodeData/rightClickedNodeData.actions.ts +23 -0
- package/app/codeCharta/state/store/appStatus/rightClickedNodeData/rightClickedNodeData.reducer.ts +15 -0
- package/app/codeCharta/state/store/appStatus/rightClickedNodeData/rightClickedNodeData.selector.ts +4 -0
- package/app/codeCharta/state/store/dynamicSettings/dynamicSettings.splitter.ts +2 -2
- package/app/codeCharta/state/store/dynamicSettings/focusedNodePath/currentFocused.selector.ts +8 -0
- package/app/codeCharta/state/store/dynamicSettings/focusedNodePath/focusedNodePath.actions.ts +27 -7
- package/app/codeCharta/state/store/dynamicSettings/focusedNodePath/focusedNodePath.reducer.spec.ts +27 -11
- package/app/codeCharta/state/store/dynamicSettings/focusedNodePath/focusedNodePath.reducer.ts +11 -5
- package/app/codeCharta/state/store/dynamicSettings/focusedNodePath/focusedNodePath.selector.ts +4 -0
- package/app/codeCharta/state/store/dynamicSettings/focusedNodePath/focusedNodePath.service.spec.ts +2 -2
- package/app/codeCharta/state/store/dynamicSettings/focusedNodePath/focusedNodePath.service.ts +1 -1
- package/app/codeCharta/state/store/fileSettings/blacklist/blacklist.actions.ts +33 -2
- package/app/codeCharta/state/store/fileSettings/blacklist/blacklist.reducer.spec.ts +17 -1
- package/app/codeCharta/state/store/fileSettings/blacklist/blacklist.reducer.ts +3 -1
- package/app/codeCharta/state/store/fileSettings/blacklist/blacklist.service.spec.ts +1 -19
- package/app/codeCharta/state/store/fileSettings/blacklist/blacklist.service.ts +5 -28
- package/app/codeCharta/state/store/fileSettings/markedPackages/markedPackages.actions.ts +9 -10
- package/app/codeCharta/state/store/fileSettings/markedPackages/markedPackages.reducer.spec.ts +37 -7
- package/app/codeCharta/state/store/fileSettings/markedPackages/markedPackages.reducer.ts +7 -3
- package/app/codeCharta/state/store/fileSettings/markedPackages/util/findIndexOfMarkedPackageOrParent.spec.ts +39 -0
- package/app/codeCharta/state/store/fileSettings/markedPackages/util/findIndexOfMarkedPackageOrParent.ts +19 -0
- package/app/codeCharta/state/store/lookUp/idToNode/idToNode.selector.ts +4 -0
- package/app/codeCharta/state/store/lookUp/lookUp.selector.ts +3 -0
- package/app/codeCharta/state/store/metricData/nodeMetricData/nodeMetricData.service.ts +0 -4
- package/app/codeCharta/state/store/state.actions.ts +3 -1
- package/app/codeCharta/state/store/state.splitter.spec.ts +4 -4
- package/app/codeCharta/state/store/store.ts +5 -1
- package/app/codeCharta/state/store.service.spec.ts +21 -8
- package/app/codeCharta/state/store.service.ts +3 -31
- package/app/codeCharta/ui/areaSettingsPanel/areaSettingsPanel.component.html +3 -1
- package/app/codeCharta/ui/areaSettingsPanel/areaSettingsPanel.component.scss +6 -2
- package/app/codeCharta/ui/areaSettingsPanel/areaSettingsPanel.component.ts +1 -1
- package/app/codeCharta/ui/areaSettingsPanel/areaSettingsPanel.module.ts +3 -0
- package/app/codeCharta/ui/areaSettingsPanel/areaSettingsPanel.po.ts +4 -4
- package/app/codeCharta/ui/areaSettingsPanel/invertAreaOption/invertAreaOption.component.html +1 -0
- package/app/codeCharta/ui/areaSettingsPanel/invertAreaOption/invertAreaOption.component.scss +26 -0
- package/app/codeCharta/ui/areaSettingsPanel/invertAreaOption/invertAreaOption.component.spec.ts +29 -0
- package/app/codeCharta/ui/areaSettingsPanel/invertAreaOption/invertAreaOption.component.ts +24 -0
- package/app/codeCharta/ui/artificialIntelligence/__snapshots__/artificialIntelligence.component.spec.ts.snap +13 -16
- package/app/codeCharta/ui/artificialIntelligence/artificialIntelligence.component.html +4 -4
- package/app/codeCharta/ui/artificialIntelligence/artificialIntelligence.component.scss +0 -4
- package/app/codeCharta/ui/artificialIntelligence/artificialIntelligence.component.spec.ts +82 -52
- package/app/codeCharta/ui/artificialIntelligence/artificialIntelligence.component.ts +41 -101
- package/app/codeCharta/ui/attributeSideBar/attributeTypeSelector/aggregationType.pipe.spec.ts +19 -0
- package/app/codeCharta/ui/attributeSideBar/attributeTypeSelector/{aggregationSymbol.pipe.ts → aggregationType.pipe.ts} +4 -4
- package/app/codeCharta/ui/attributeSideBar/attributeTypeSelector/attributeTypeSelector.component.html +4 -12
- package/app/codeCharta/ui/attributeSideBar/attributeTypeSelector/attributeTypeSelector.component.scss +11 -20
- package/app/codeCharta/ui/attributeSideBar/attributeTypeSelector/attributeTypeSelector.component.spec.ts +8 -15
- package/app/codeCharta/ui/attributeSideBar/attributeTypeSelector/attributeTypeSelector.module.ts +2 -2
- package/app/codeCharta/ui/codeMap/__snapshots__/codeMap.arrow.service.spec.ts.snap +2 -2
- package/app/codeCharta/ui/codeMap/codeMap.actions.service.ts +1 -40
- package/app/codeCharta/ui/codeMap/codeMap.mouseEvent.service.ts +8 -16
- package/app/codeCharta/ui/codeMap/codeMap.preRender.service.spec.ts +1 -9
- package/app/codeCharta/ui/codeMap/codeMap.preRender.service.ts +9 -32
- package/app/codeCharta/ui/codeMap/rendering/codeMapMesh.ts +1 -0
- package/app/codeCharta/ui/colorPicker/colorPicker.component.html +16 -7
- package/app/codeCharta/ui/colorPicker/colorPicker.component.spec.ts +55 -16
- package/app/codeCharta/ui/colorPicker/colorPicker.component.ts +32 -1
- package/app/codeCharta/ui/colorPicker/colorPicker.module.ts +3 -1
- package/app/codeCharta/ui/customConfigs/customConfigs.component.html +29 -11
- package/app/codeCharta/ui/customConfigs/customConfigs.component.scss +1 -0
- package/app/codeCharta/ui/customConfigs/customConfigs.component.spec.ts +123 -2
- package/app/codeCharta/ui/customConfigs/customConfigs.component.ts +56 -2
- package/app/codeCharta/ui/dialog/dialog.addCustomConfigSettings.component.html +2 -2
- package/app/codeCharta/ui/dialog/dialog.changelog.component.html +1 -1
- package/app/codeCharta/ui/dialog/dialog.changelog.component.scss +15 -0
- package/app/codeCharta/ui/dialog/dialog.changelog.component.spec.ts +15 -15
- package/app/codeCharta/ui/dialog/dialog.changelog.component.ts +2 -1
- package/app/codeCharta/ui/dialog/dialog.globalSettings.e2e.ts +1 -1
- package/app/codeCharta/ui/dialog/dialog.globalSettings.po.ts +1 -1
- package/app/codeCharta/ui/dialog/dialog.service.spec.ts +68 -0
- package/app/codeCharta/ui/dialog/dialog.service.ts +38 -17
- package/app/codeCharta/ui/dialogs/dialogs.ts +3 -0
- package/app/codeCharta/ui/dialogs/errorDialog/errorDialog.component.html +7 -0
- package/app/codeCharta/ui/dialogs/errorDialog/errorDialog.component.ts +9 -0
- package/app/codeCharta/ui/edgeChooser/edgeChooser.e2e.ts +3 -2
- package/app/codeCharta/ui/fileChooser/fileChooser.e2e.ts +5 -6
- package/app/codeCharta/ui/filePanel/filePanel.component.html +24 -106
- package/app/codeCharta/ui/filePanel/filePanel.component.scss +12 -57
- package/app/codeCharta/ui/filePanel/filePanel.component.spec.ts +40 -72
- package/app/codeCharta/ui/filePanel/filePanel.component.ts +29 -81
- package/app/codeCharta/ui/filePanel/filePanel.module.ts +13 -1
- package/app/codeCharta/ui/filePanel/filePanel.po.ts +6 -24
- package/app/codeCharta/ui/filePanel/filePanelDeltaSelector/filePanelDeltaSelector.component.html +23 -0
- package/app/codeCharta/ui/filePanel/filePanelDeltaSelector/filePanelDeltaSelector.component.ts +18 -0
- package/app/codeCharta/ui/filePanel/filePanelFileSelector/filePanelFileSelector.component.html +18 -0
- package/app/codeCharta/ui/filePanel/filePanelFileSelector/filePanelFileSelector.component.ts +16 -0
- package/app/codeCharta/ui/filePanel/filePanelStateButtons/filePanelStateButtons.component.html +18 -0
- package/app/codeCharta/ui/filePanel/filePanelStateButtons/filePanelStateButtons.component.ts +11 -0
- package/app/codeCharta/ui/labelledColorPicker/labelledColorPicker.component.html +21 -13
- package/app/codeCharta/ui/labelledColorPicker/labelledColorPicker.component.spec.ts +11 -24
- package/app/codeCharta/ui/labelledColorPicker/labelledColorPicker.component.ts +1 -40
- package/app/codeCharta/ui/labelledColorPicker/labelledColorPicker.module.ts +1 -2
- package/app/codeCharta/ui/legendPanel/legendMarkedPackages/legendMarkedPackages.component.ts +2 -2
- package/app/codeCharta/ui/mapTreeView/mapTreeView.level.e2e.ts +8 -6
- package/app/codeCharta/ui/mapTreeView/mapTreeView.level.po.ts +1 -1
- package/app/codeCharta/ui/mapTreeView/mapTreeViewLevel/mapTreeViewLevel.component.html +1 -1
- package/app/codeCharta/ui/mapTreeView/mapTreeViewLevel/mapTreeViewLevel.component.spec.ts +6 -16
- package/app/codeCharta/ui/mapTreeView/mapTreeViewLevel/mapTreeViewLevel.component.ts +15 -11
- package/app/codeCharta/ui/ribbonBar/ribbonBar.component.html +3 -3
- package/app/codeCharta/ui/ribbonBar/ribbonBar.e2e.ts +3 -3
- package/app/codeCharta/ui/searchBar/searchBar.component.html +5 -0
- package/app/codeCharta/ui/searchBar/searchBar.component.scss +11 -0
- package/app/codeCharta/ui/searchBar/searchBar.component.spec.ts +10 -0
- package/app/codeCharta/ui/searchBar/searchBar.component.ts +1 -1
- package/app/codeCharta/ui/sortingOption/sortingOption.component.spec.ts +1 -1
- package/app/codeCharta/ui/toolBar/toolBar.component.html +1 -1
- package/app/codeCharta/ui/toolBar/toolBar.component.scss +1 -1
- package/app/codeCharta/ui/ui.ts +2 -6
- package/app/codeCharta/util/algorithm/streetLayout/strip/strip.ts +2 -2
- package/app/codeCharta/util/algorithm/streetLayout/treeMap.ts +1 -1
- package/app/codeCharta/util/algorithm/treeMapLayout/treeMapGenerator.spec.ts +2 -2
- package/app/codeCharta/util/algorithm/treeMapLayout/treeMapGenerator.ts +14 -7
- package/app/codeCharta/util/algorithm/treeMapLayout/treeMapHelper.spec.ts +2 -2
- package/app/codeCharta/util/algorithm/treeMapLayout/treeMapHelper.ts +1 -1
- package/app/codeCharta/util/customConfigBuilder.ts +2 -1
- package/app/codeCharta/util/customConfigHelper.spec.ts +155 -60
- package/app/codeCharta/util/customConfigHelper.ts +33 -3
- package/app/codeCharta/util/dataMocks.ts +8 -4
- package/app/codeCharta/util/fileExtensionCalculator.ts +1 -1
- package/app/codeCharta/util/fileValidator.spec.ts +69 -182
- package/app/codeCharta/util/fileValidator.ts +61 -37
- package/app/codeCharta/util/reduxHelper.ts +11 -0
- package/app/material/material.module.ts +17 -1
- package/conf/webpack.loaders.js +4 -1
- package/dist/webpack/bundle.js +5925 -1896
- package/dist/webpack/bundle.js.map +1 -1
- package/package.json +7 -6
- package/app/codeCharta/state/store/dynamicSettings/focusedNodePath/focusedNodePath.splitter.ts +0 -8
- package/app/codeCharta/ui/attributeSideBar/attributeTypeSelector/aggregationSymbol.pipe.spec.ts +0 -19
- package/app/codeCharta/ui/codeMap/codeMap.actions.service.spec.ts +0 -147
- package/app/codeCharta/ui/nodeContextMenu/markFolderColorPicker/markFolderColorPicker.component.html +0 -5
- package/app/codeCharta/ui/nodeContextMenu/markFolderColorPicker/markFolderColorPicker.component.scss +0 -13
- package/app/codeCharta/ui/nodeContextMenu/markFolderColorPicker/markFolderColorPicker.component.ts +0 -30
- package/app/codeCharta/ui/nodeContextMenu/markFolderColorPicker/markFolderColorPicker.module.ts +0 -13
- package/app/codeCharta/ui/nodeContextMenu/nodeContextMenu.component.html +0 -68
- package/app/codeCharta/ui/nodeContextMenu/nodeContextMenu.component.scss +0 -52
- package/app/codeCharta/ui/nodeContextMenu/nodeContextMenu.component.spec.ts +0 -571
- package/app/codeCharta/ui/nodeContextMenu/nodeContextMenu.component.ts +0 -318
- package/app/codeCharta/ui/nodeContextMenu/nodeContextMenu.module.ts +0 -13
- package/app/codeCharta/ui/unfocusButton/unfocusButton.component.html +0 -15
- package/app/codeCharta/ui/unfocusButton/unfocusButton.component.scss +0 -5
- package/app/codeCharta/ui/unfocusButton/unfocusButton.component.spec.ts +0 -106
- package/app/codeCharta/ui/unfocusButton/unfocusButton.component.ts +0 -62
- package/app/codeCharta/ui/unfocusButton/unfocusButton.module.ts +0 -7
|
@@ -0,0 +1,36 @@
|
|
|
1
|
+
import { ColorMode, DynamicSettings, SortingOption } from "../../../../codeCharta.model"
|
|
2
|
+
import { areDynamicSettingsAvailable } from "./areDynamicSettingsAvailable"
|
|
3
|
+
|
|
4
|
+
describe("areDynamicSettingsAvailable", () => {
|
|
5
|
+
it("should return false when recent files aren't set", () => {
|
|
6
|
+
const dynamicSettings = {
|
|
7
|
+
recentFiles: null
|
|
8
|
+
}
|
|
9
|
+
expect(areDynamicSettingsAvailable(dynamicSettings)).toBe(false)
|
|
10
|
+
})
|
|
11
|
+
|
|
12
|
+
it("should return false when colorRange.from isn't set", () => {
|
|
13
|
+
const dynamicSettings = {
|
|
14
|
+
colorRange: { from: null, to: 25, min: 0, max: 100 }
|
|
15
|
+
}
|
|
16
|
+
expect(areDynamicSettingsAvailable(dynamicSettings)).toBe(false)
|
|
17
|
+
})
|
|
18
|
+
|
|
19
|
+
it("should return true when everything is set", () => {
|
|
20
|
+
const dynamicSettings: DynamicSettings = {
|
|
21
|
+
colorMode: ColorMode.trueGradient,
|
|
22
|
+
sortingOption: SortingOption.NAME,
|
|
23
|
+
areaMetric: "rloc",
|
|
24
|
+
heightMetric: "loc",
|
|
25
|
+
colorMetric: "mcc",
|
|
26
|
+
distributionMetric: "pairingRate",
|
|
27
|
+
edgeMetric: "avgCommits",
|
|
28
|
+
focusedNodePath: [],
|
|
29
|
+
searchPattern: "",
|
|
30
|
+
margin: 2,
|
|
31
|
+
colorRange: { from: 0, to: 25, min: 0, max: 100 },
|
|
32
|
+
recentFiles: ["test.cc.json"]
|
|
33
|
+
}
|
|
34
|
+
expect(areDynamicSettingsAvailable(dynamicSettings)).toBe(true)
|
|
35
|
+
})
|
|
36
|
+
})
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
import { ColorRange, DynamicSettings } from "../../../../codeCharta.model"
|
|
2
|
+
|
|
3
|
+
const isDynamicSettingAvailable = (setting: null | string | number | string[] | ColorRange) => {
|
|
4
|
+
if (setting === null) return false
|
|
5
|
+
if (typeof setting !== "object") return true
|
|
6
|
+
return Object.values(setting).every(v => v !== null)
|
|
7
|
+
}
|
|
8
|
+
|
|
9
|
+
export const areDynamicSettingsAvailable = (dynamicSettings: Partial<DynamicSettings>) =>
|
|
10
|
+
Object.values(dynamicSettings).every(value => isDynamicSettingAvailable(value))
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
import { areMetricsAvailable } from "./areMetricsAvailable"
|
|
2
|
+
|
|
3
|
+
describe("areMetricsAvailable", () => {
|
|
4
|
+
const nodeMetricData = [{ name: "mcc" }, { name: "rloc" }]
|
|
5
|
+
|
|
6
|
+
it("should return false if some metric is not available", () => {
|
|
7
|
+
expect(areMetricsAvailable(nodeMetricData, ["mcc", "loc"])).toBe(false)
|
|
8
|
+
})
|
|
9
|
+
|
|
10
|
+
it("should return true if all metric are available", () => {
|
|
11
|
+
expect(areMetricsAvailable(nodeMetricData, ["mcc", "rloc"])).toBe(true)
|
|
12
|
+
})
|
|
13
|
+
})
|
package/app/codeCharta/state/selectors/allNecessaryRenderDataAvailable/utils/areMetricsAvailable.ts
ADDED
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
import { NodeMetricData } from "../../../../codeCharta.model"
|
|
2
|
+
|
|
3
|
+
type NodeMetricDataName = Pick<NodeMetricData, "name">
|
|
4
|
+
|
|
5
|
+
const isMetricAvailable = (nodeMetricData: NodeMetricDataName[], metricName: string) => nodeMetricData.some(x => x.name === metricName)
|
|
6
|
+
|
|
7
|
+
export const areMetricsAvailable = (nodeMetricData: NodeMetricDataName[], metricNames: string[]) =>
|
|
8
|
+
metricNames.every(metric => isMetricAvailable(nodeMetricData, metric))
|
|
@@ -28,6 +28,7 @@ import { defaultLayoutAlgorithm } from "./layoutAlgorithm/layoutAlgorithm.action
|
|
|
28
28
|
import { defaultMaxTreeMapFiles } from "./maxTreeMapFiles/maxTreeMapFiles.actions"
|
|
29
29
|
import { defaultSharpnessMode } from "./sharpnessMode/sharpnessMode.actions"
|
|
30
30
|
import { defaultScreenshotToClipboardEnabled } from "./enableClipboard/screenshotToClipboardEnabled.actions"
|
|
31
|
+
import { defaultInvertArea } from "./invertArea/invertArea.actions"
|
|
31
32
|
|
|
32
33
|
export enum AppSettingsActions {
|
|
33
34
|
SET_APP_SETTINGS = "SET_APP_SETTINGS"
|
|
@@ -61,6 +62,7 @@ export const defaultAppSettings: AppSettings = {
|
|
|
61
62
|
cameraTarget: defaultCameraTarget,
|
|
62
63
|
hideFlatBuildings: defaultHideFlatBuildings,
|
|
63
64
|
invertHeight: defaultInvertHeight,
|
|
65
|
+
invertArea: defaultInvertArea,
|
|
64
66
|
dynamicMargin: defaultDynamicMargin,
|
|
65
67
|
isWhiteBackground: defaultIsWhiteBackground,
|
|
66
68
|
mapColors: defaultMapColors,
|
|
@@ -27,6 +27,7 @@ import { layoutAlgorithm } from "./layoutAlgorithm/layoutAlgorithm.reducer"
|
|
|
27
27
|
import { maxTreeMapFiles } from "./maxTreeMapFiles/maxTreeMapFiles.reducer"
|
|
28
28
|
import { sharpnessMode } from "./sharpnessMode/sharpnessMode.reducer"
|
|
29
29
|
import { screenshotToClipboardEnabled } from "./enableClipboard/screenshotToClipboardEnabled.reducer"
|
|
30
|
+
import { invertArea } from "./invertArea/invertArea.reducer"
|
|
30
31
|
|
|
31
32
|
const appSettings = combineReducers({
|
|
32
33
|
colorLabels,
|
|
@@ -45,6 +46,7 @@ const appSettings = combineReducers({
|
|
|
45
46
|
isWhiteBackground,
|
|
46
47
|
dynamicMargin,
|
|
47
48
|
invertHeight,
|
|
49
|
+
invertArea,
|
|
48
50
|
hideFlatBuildings,
|
|
49
51
|
camera,
|
|
50
52
|
scaling,
|
|
@@ -0,0 +1,32 @@
|
|
|
1
|
+
import { Action } from "redux"
|
|
2
|
+
|
|
3
|
+
export enum InvertAreaActions {
|
|
4
|
+
SET_INVERT_AREA = "SET_INVERT_AREA",
|
|
5
|
+
TOGGLE_INVERTING_AREA = "TOGGLE_INVERTING_AREA"
|
|
6
|
+
}
|
|
7
|
+
|
|
8
|
+
export interface SetInvertAreaAction extends Action {
|
|
9
|
+
type: InvertAreaActions.SET_INVERT_AREA
|
|
10
|
+
payload: boolean
|
|
11
|
+
}
|
|
12
|
+
|
|
13
|
+
export type InvertAreaAction = SetInvertAreaAction
|
|
14
|
+
|
|
15
|
+
export const defaultInvertArea = false
|
|
16
|
+
|
|
17
|
+
export function setInvertArea(invertArea: boolean = defaultInvertArea): SetInvertAreaAction {
|
|
18
|
+
return {
|
|
19
|
+
type: InvertAreaActions.SET_INVERT_AREA,
|
|
20
|
+
payload: invertArea
|
|
21
|
+
}
|
|
22
|
+
}
|
|
23
|
+
|
|
24
|
+
export interface ToggleInvertingAreaAction extends Action {
|
|
25
|
+
type: InvertAreaActions.TOGGLE_INVERTING_AREA
|
|
26
|
+
}
|
|
27
|
+
|
|
28
|
+
export function toggleInvertingArea(): ToggleInvertingAreaAction {
|
|
29
|
+
return {
|
|
30
|
+
type: InvertAreaActions.TOGGLE_INVERTING_AREA
|
|
31
|
+
}
|
|
32
|
+
}
|
|
@@ -0,0 +1,26 @@
|
|
|
1
|
+
import { invertArea } from "./invertArea.reducer"
|
|
2
|
+
import { InvertAreaAction, setInvertArea } from "./invertArea.actions"
|
|
3
|
+
|
|
4
|
+
describe("invertArea", () => {
|
|
5
|
+
describe("Default State", () => {
|
|
6
|
+
it("should initialize the default state", () => {
|
|
7
|
+
const result = invertArea(undefined, {} as InvertAreaAction)
|
|
8
|
+
|
|
9
|
+
expect(result).toBeFalsy()
|
|
10
|
+
})
|
|
11
|
+
})
|
|
12
|
+
|
|
13
|
+
describe("Action: SET_INVERT_AREA", () => {
|
|
14
|
+
it("should set new invertArea", () => {
|
|
15
|
+
const result = invertArea(false, setInvertArea(true))
|
|
16
|
+
|
|
17
|
+
expect(result).toBeTruthy()
|
|
18
|
+
})
|
|
19
|
+
|
|
20
|
+
it("should set default invertArea", () => {
|
|
21
|
+
const result = invertArea(true, setInvertArea())
|
|
22
|
+
|
|
23
|
+
expect(result).toBeFalsy()
|
|
24
|
+
})
|
|
25
|
+
})
|
|
26
|
+
})
|
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
import { InvertAreaAction, InvertAreaActions, setInvertArea, ToggleInvertingAreaAction } from "./invertArea.actions"
|
|
2
|
+
|
|
3
|
+
export function invertArea(state = setInvertArea().payload, action: InvertAreaAction | ToggleInvertingAreaAction) {
|
|
4
|
+
switch (action.type) {
|
|
5
|
+
case InvertAreaActions.SET_INVERT_AREA:
|
|
6
|
+
return action.payload
|
|
7
|
+
case InvertAreaActions.TOGGLE_INVERTING_AREA:
|
|
8
|
+
return !state
|
|
9
|
+
default:
|
|
10
|
+
return state
|
|
11
|
+
}
|
|
12
|
+
}
|
|
@@ -1,12 +1,13 @@
|
|
|
1
1
|
import { isLoadingMap } from "./isLoadingMap.reducer"
|
|
2
2
|
import { IsLoadingMapAction, setIsLoadingMap } from "./isLoadingMap.actions"
|
|
3
|
+
import { setHoveredBuildingPath } from "../../appStatus/hoveredBuildingPath/hoveredBuildingPath.actions"
|
|
3
4
|
|
|
4
5
|
describe("isLoadingMap", () => {
|
|
5
6
|
describe("Default State", () => {
|
|
6
7
|
it("should initialize the default state", () => {
|
|
7
8
|
const result = isLoadingMap(undefined, {} as IsLoadingMapAction)
|
|
8
9
|
|
|
9
|
-
expect(result).
|
|
10
|
+
expect(result).toBe(true)
|
|
10
11
|
})
|
|
11
12
|
})
|
|
12
13
|
|
|
@@ -14,13 +15,23 @@ describe("isLoadingMap", () => {
|
|
|
14
15
|
it("should set new isLoadingMap", () => {
|
|
15
16
|
const result = isLoadingMap(true, setIsLoadingMap(false))
|
|
16
17
|
|
|
17
|
-
expect(result).
|
|
18
|
+
expect(result).toBe(false)
|
|
18
19
|
})
|
|
19
20
|
|
|
20
21
|
it("should set default isLoadingMap", () => {
|
|
21
22
|
const result = isLoadingMap(false, setIsLoadingMap())
|
|
22
23
|
|
|
23
|
-
expect(result).
|
|
24
|
+
expect(result).toBe(true)
|
|
25
|
+
})
|
|
26
|
+
})
|
|
27
|
+
|
|
28
|
+
describe("Other Actions to (not) set isLoadingMap to true", () => {
|
|
29
|
+
it("'should' set isLoadingMap to true on a random action", () => {
|
|
30
|
+
expect(isLoadingMap(false, { type: "any" } as unknown as IsLoadingMapAction)).toBe(true)
|
|
31
|
+
})
|
|
32
|
+
|
|
33
|
+
it("'should' not set isLoadingMap to true on an explicit excluded action", () => {
|
|
34
|
+
expect(isLoadingMap(false, setHoveredBuildingPath("/root/child") as unknown as IsLoadingMapAction)).toBe(false)
|
|
24
35
|
})
|
|
25
36
|
})
|
|
26
37
|
})
|
|
@@ -1,10 +1,45 @@
|
|
|
1
|
+
import { isActionOfType } from "../../../../util/reduxHelper"
|
|
2
|
+
import { HoveredBuildingPathActions } from "../../appStatus/hoveredBuildingPath/hoveredBuildingPath.actions"
|
|
3
|
+
import { FocusedNodePathActions } from "../../dynamicSettings/focusedNodePath/focusedNodePath.actions"
|
|
4
|
+
import { SortingOptionActions } from "../../dynamicSettings/sortingOption/sortingOption.actions"
|
|
5
|
+
import { CameraTargetActions } from "../cameraTarget/cameraTarget.actions"
|
|
6
|
+
import { CameraActions } from "../../appSettings/camera/camera.actions"
|
|
7
|
+
import { ScreenshotToClipboardEnabledActions } from "../enableClipboard/screenshotToClipboardEnabled.actions"
|
|
8
|
+
import { ExperimentalFeaturesEnabledActions } from "../enableExperimentalFeatures/experimentalFeaturesEnabled.actions"
|
|
9
|
+
import { IsAttributeSideBarVisibleActions } from "../isAttributeSideBarVisible/isAttributeSideBarVisible.actions"
|
|
10
|
+
import { IsLoadingFileActions } from "../isLoadingFile/isLoadingFile.actions"
|
|
11
|
+
import { PresentationModeActions } from "../isPresentationMode/isPresentationMode.actions"
|
|
12
|
+
import { PanelSelectionActions } from "../panelSelection/panelSelection.actions"
|
|
13
|
+
import { SearchPanelModeActions } from "../searchPanelMode/searchPanelMode.actions"
|
|
14
|
+
import { SortingOrderAscendingActions } from "../sortingOrderAscending/sortingOrderAscending.actions"
|
|
1
15
|
import { IsLoadingMapAction, IsLoadingMapActions, setIsLoadingMap } from "./isLoadingMap.actions"
|
|
16
|
+
import { IdToNodeActions } from "../../lookUp/idToNode/idToNode.actions"
|
|
17
|
+
import { IdToBuildingActions } from "../../lookUp/idToBuilding/idToBuilding.actions"
|
|
18
|
+
|
|
19
|
+
// Todo state actions explicit instead of excluding all others; refs #1547
|
|
20
|
+
const actionsToExclude = [
|
|
21
|
+
IsLoadingMapActions,
|
|
22
|
+
IsLoadingFileActions,
|
|
23
|
+
SortingOrderAscendingActions,
|
|
24
|
+
SearchPanelModeActions,
|
|
25
|
+
SortingOptionActions,
|
|
26
|
+
IsAttributeSideBarVisibleActions,
|
|
27
|
+
PanelSelectionActions,
|
|
28
|
+
PresentationModeActions,
|
|
29
|
+
ExperimentalFeaturesEnabledActions,
|
|
30
|
+
ScreenshotToClipboardEnabledActions,
|
|
31
|
+
HoveredBuildingPathActions,
|
|
32
|
+
FocusedNodePathActions,
|
|
33
|
+
CameraTargetActions,
|
|
34
|
+
CameraActions,
|
|
35
|
+
IdToNodeActions,
|
|
36
|
+
IdToBuildingActions
|
|
37
|
+
]
|
|
2
38
|
|
|
3
39
|
export function isLoadingMap(state = setIsLoadingMap().payload, action: IsLoadingMapAction) {
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
}
|
|
40
|
+
if (action.type === IsLoadingMapActions.SET_IS_LOADING_MAP) return action.payload
|
|
41
|
+
|
|
42
|
+
if (actionsToExclude.every(excludeActions => !isActionOfType(action.type, excludeActions))) return true
|
|
43
|
+
|
|
44
|
+
return state
|
|
10
45
|
}
|
|
@@ -1,11 +1,13 @@
|
|
|
1
1
|
import { combineReducers } from "redux"
|
|
2
2
|
|
|
3
3
|
import { hoveredBuildingPath } from "./hoveredBuildingPath/hoveredBuildingPath.reducer"
|
|
4
|
+
import { rightClickedNodeData } from "./rightClickedNodeData/rightClickedNodeData.reducer"
|
|
4
5
|
import { selectedBuildingId } from "./selectedBuildingId/selectedBuildingId.reducer"
|
|
5
6
|
|
|
6
7
|
const appStatus = combineReducers({
|
|
7
8
|
hoveredBuildingPath,
|
|
8
|
-
selectedBuildingId
|
|
9
|
+
selectedBuildingId,
|
|
10
|
+
rightClickedNodeData
|
|
9
11
|
})
|
|
10
12
|
|
|
11
13
|
export default appStatus
|
package/app/codeCharta/state/store/appStatus/rightClickedNodeData/rightClickedNodeData.actions.ts
ADDED
|
@@ -0,0 +1,23 @@
|
|
|
1
|
+
import { Action } from "redux"
|
|
2
|
+
|
|
3
|
+
export enum RightClickedNodeDataActions {
|
|
4
|
+
SET_RIGHT_CLICKED_NODE_DATA = "SET_RIGHT_CLICKED_NODE_DATA"
|
|
5
|
+
}
|
|
6
|
+
|
|
7
|
+
export type RightClickedNodeData = {
|
|
8
|
+
nodeId: number
|
|
9
|
+
xPositionOfRightClickEvent: number
|
|
10
|
+
yPositionOfRightClickEvent: number
|
|
11
|
+
} | null
|
|
12
|
+
|
|
13
|
+
export interface SetRightClickedNodeDataAction extends Action {
|
|
14
|
+
type: RightClickedNodeDataActions.SET_RIGHT_CLICKED_NODE_DATA
|
|
15
|
+
payload: RightClickedNodeData
|
|
16
|
+
}
|
|
17
|
+
|
|
18
|
+
export const defaultRightClickedNodeData: RightClickedNodeData = null
|
|
19
|
+
|
|
20
|
+
export const setRightClickedNodeData = (payload: RightClickedNodeData): SetRightClickedNodeDataAction => ({
|
|
21
|
+
type: RightClickedNodeDataActions.SET_RIGHT_CLICKED_NODE_DATA,
|
|
22
|
+
payload
|
|
23
|
+
})
|
package/app/codeCharta/state/store/appStatus/rightClickedNodeData/rightClickedNodeData.reducer.ts
ADDED
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
import {
|
|
2
|
+
defaultRightClickedNodeData,
|
|
3
|
+
RightClickedNodeData,
|
|
4
|
+
RightClickedNodeDataActions,
|
|
5
|
+
SetRightClickedNodeDataAction
|
|
6
|
+
} from "./rightClickedNodeData.actions"
|
|
7
|
+
|
|
8
|
+
export const rightClickedNodeData = (state: RightClickedNodeData = defaultRightClickedNodeData, action: SetRightClickedNodeDataAction) => {
|
|
9
|
+
switch (action.type) {
|
|
10
|
+
case RightClickedNodeDataActions.SET_RIGHT_CLICKED_NODE_DATA:
|
|
11
|
+
return action.payload
|
|
12
|
+
default:
|
|
13
|
+
return state
|
|
14
|
+
}
|
|
15
|
+
}
|
|
@@ -7,11 +7,11 @@ import { splitEdgeMetricAction } from "./edgeMetric/edgeMetric.splitter"
|
|
|
7
7
|
import { splitColorRangeAction } from "./colorRange/colorRange.splitter"
|
|
8
8
|
import { splitMarginAction } from "./margin/margin.splitter"
|
|
9
9
|
import { splitSearchPatternAction } from "./searchPattern/searchPattern.splitter"
|
|
10
|
-
import { splitFocusedNodePathAction } from "./focusedNodePath/focusedNodePath.splitter"
|
|
11
10
|
import { splitHeightMetricAction } from "./heightMetric/heightMetric.splitter"
|
|
12
11
|
import { splitDistributionMetricAction } from "./distributionMetric/distributionMetric.splitter"
|
|
13
12
|
import { splitColorMetricAction } from "./colorMetric/colorMetric.splitter"
|
|
14
13
|
import { splitAreaMetricAction } from "./areaMetric/areaMetric.splitter"
|
|
14
|
+
import { setAllFocusedNodes } from "./focusedNodePath/focusedNodePath.actions"
|
|
15
15
|
|
|
16
16
|
export function splitDynamicSettingsActions(payload: RecursivePartial<DynamicSettings>) {
|
|
17
17
|
const actions: CCAction[] = []
|
|
@@ -45,7 +45,7 @@ export function splitDynamicSettingsActions(payload: RecursivePartial<DynamicSet
|
|
|
45
45
|
}
|
|
46
46
|
|
|
47
47
|
if (payload.focusedNodePath !== undefined) {
|
|
48
|
-
actions.push(
|
|
48
|
+
actions.push(setAllFocusedNodes(payload.focusedNodePath))
|
|
49
49
|
}
|
|
50
50
|
|
|
51
51
|
if (payload.heightMetric !== undefined) {
|
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
import { createSelector } from "../../../angular-redux/createSelector"
|
|
2
|
+
import { CcState } from "../../store"
|
|
3
|
+
import { focusedNodePathSelector } from "./focusedNodePath.selector"
|
|
4
|
+
|
|
5
|
+
export const currentFocusedNodePathSelector: (state: CcState) => string | undefined = createSelector(
|
|
6
|
+
[focusedNodePathSelector],
|
|
7
|
+
focusedNodePath => focusedNodePath[0]
|
|
8
|
+
)
|
package/app/codeCharta/state/store/dynamicSettings/focusedNodePath/focusedNodePath.actions.ts
CHANGED
|
@@ -2,7 +2,9 @@ import { CCAction } from "../../../../codeCharta.model"
|
|
|
2
2
|
|
|
3
3
|
export enum FocusedNodePathActions {
|
|
4
4
|
FOCUS_NODE = "FOCUS_NODE",
|
|
5
|
-
UNFOCUS_NODE = "UNFOCUS_NODE"
|
|
5
|
+
UNFOCUS_NODE = "UNFOCUS_NODE",
|
|
6
|
+
UNFOCUS_ALL_NODES = "UNFOCUS_ALL_NODES",
|
|
7
|
+
SET_ALL_FOCUSED_NODES = "SET_ALL_FOCUSED_NODES"
|
|
6
8
|
}
|
|
7
9
|
|
|
8
10
|
export interface FocusNodeAction extends CCAction {
|
|
@@ -12,12 +14,19 @@ export interface FocusNodeAction extends CCAction {
|
|
|
12
14
|
|
|
13
15
|
export interface UnfocusNodeAction extends CCAction {
|
|
14
16
|
type: FocusedNodePathActions.UNFOCUS_NODE
|
|
15
|
-
payload: string
|
|
16
17
|
}
|
|
17
18
|
|
|
18
|
-
export
|
|
19
|
+
export interface UnfocusAllNodesAction extends CCAction {
|
|
20
|
+
type: FocusedNodePathActions.UNFOCUS_ALL_NODES
|
|
21
|
+
}
|
|
22
|
+
export interface SetAllFocusedNodesAction extends CCAction {
|
|
23
|
+
type: FocusedNodePathActions.SET_ALL_FOCUSED_NODES
|
|
24
|
+
payload: string[]
|
|
25
|
+
}
|
|
26
|
+
|
|
27
|
+
export type FocusedNodePathAction = FocusNodeAction | UnfocusNodeAction | UnfocusAllNodesAction | SetAllFocusedNodesAction
|
|
19
28
|
|
|
20
|
-
export function focusNode(focusedNodePath: string
|
|
29
|
+
export function focusNode(focusedNodePath: string): FocusNodeAction {
|
|
21
30
|
return {
|
|
22
31
|
type: FocusedNodePathActions.FOCUS_NODE,
|
|
23
32
|
payload: focusedNodePath
|
|
@@ -26,9 +35,20 @@ export function focusNode(focusedNodePath: string = defaultFocusedNodePath): Foc
|
|
|
26
35
|
|
|
27
36
|
export function unfocusNode(): UnfocusNodeAction {
|
|
28
37
|
return {
|
|
29
|
-
type: FocusedNodePathActions.UNFOCUS_NODE
|
|
30
|
-
|
|
38
|
+
type: FocusedNodePathActions.UNFOCUS_NODE
|
|
39
|
+
}
|
|
40
|
+
}
|
|
41
|
+
|
|
42
|
+
export function unfocusAllNodes(): UnfocusAllNodesAction {
|
|
43
|
+
return {
|
|
44
|
+
type: FocusedNodePathActions.UNFOCUS_ALL_NODES
|
|
45
|
+
}
|
|
46
|
+
}
|
|
47
|
+
export function setAllFocusedNodes(focusedNodePaths: string[]): SetAllFocusedNodesAction {
|
|
48
|
+
return {
|
|
49
|
+
type: FocusedNodePathActions.SET_ALL_FOCUSED_NODES,
|
|
50
|
+
payload: focusedNodePaths
|
|
31
51
|
}
|
|
32
52
|
}
|
|
33
53
|
|
|
34
|
-
export const defaultFocusedNodePath =
|
|
54
|
+
export const defaultFocusedNodePath: string[] = []
|
package/app/codeCharta/state/store/dynamicSettings/focusedNodePath/focusedNodePath.reducer.spec.ts
CHANGED
|
@@ -1,40 +1,56 @@
|
|
|
1
1
|
import { focusedNodePath } from "./focusedNodePath.reducer"
|
|
2
|
-
import { FocusedNodePathAction, focusNode, unfocusNode } from "./focusedNodePath.actions"
|
|
2
|
+
import { FocusedNodePathAction, focusNode, setAllFocusedNodes, unfocusAllNodes, unfocusNode } from "./focusedNodePath.actions"
|
|
3
3
|
|
|
4
4
|
describe("focusedNodePath", () => {
|
|
5
5
|
describe("Default State", () => {
|
|
6
6
|
it("should initialize the default state", () => {
|
|
7
7
|
const result = focusedNodePath(undefined, {} as FocusedNodePathAction)
|
|
8
8
|
|
|
9
|
-
expect(result).toEqual(
|
|
9
|
+
expect(result).toEqual([])
|
|
10
10
|
})
|
|
11
11
|
})
|
|
12
12
|
|
|
13
13
|
describe("Action: FOCUS_NODE", () => {
|
|
14
14
|
it("should set new focusedNodePath", () => {
|
|
15
|
-
const result = focusedNodePath(
|
|
15
|
+
const result = focusedNodePath([], focusNode("some/path/*.ts"))
|
|
16
16
|
|
|
17
|
-
expect(result).toEqual("some/path/*.ts")
|
|
17
|
+
expect(result).toEqual(["some/path/*.ts"])
|
|
18
18
|
})
|
|
19
19
|
|
|
20
|
-
it("should
|
|
21
|
-
const result = focusedNodePath("some/path/*.ts", focusNode())
|
|
20
|
+
it("should add focusedNodePath", () => {
|
|
21
|
+
const result = focusedNodePath(["some/path/*.ts"], focusNode("foo.ts"))
|
|
22
22
|
|
|
23
|
-
expect(result).toEqual("")
|
|
23
|
+
expect(result).toEqual(["foo.ts", "some/path/*.ts"])
|
|
24
24
|
})
|
|
25
25
|
|
|
26
26
|
it("should not allow to focus root folder", () => {
|
|
27
|
-
const result = focusedNodePath("/root"
|
|
27
|
+
const result = focusedNodePath([], focusNode("/root"))
|
|
28
28
|
|
|
29
|
-
expect(result).toEqual(
|
|
29
|
+
expect(result).toEqual([])
|
|
30
30
|
})
|
|
31
31
|
})
|
|
32
32
|
|
|
33
33
|
describe("Action: UNFOCUS_NODE", () => {
|
|
34
34
|
it("should remove focusedNodePath", () => {
|
|
35
|
-
const result = focusedNodePath("some/path/*.ts", unfocusNode())
|
|
35
|
+
const result = focusedNodePath(["some/path/*.ts", "foo.ts"], unfocusNode())
|
|
36
36
|
|
|
37
|
-
expect(result).toEqual("")
|
|
37
|
+
expect(result).toEqual(["foo.ts"])
|
|
38
|
+
})
|
|
39
|
+
})
|
|
40
|
+
|
|
41
|
+
describe("Action: UNFOCUS_ALL_NODES", () => {
|
|
42
|
+
it("should remove all focusedNodePaths", () => {
|
|
43
|
+
const result = focusedNodePath(["some/path/*.ts", "foo.ts"], unfocusAllNodes())
|
|
44
|
+
|
|
45
|
+
expect(result).toEqual([])
|
|
46
|
+
})
|
|
47
|
+
})
|
|
48
|
+
|
|
49
|
+
describe("Action: SET_ALL_FOCUSED_NODES", () => {
|
|
50
|
+
it("should set all focusedNodePaths", () => {
|
|
51
|
+
const result = focusedNodePath([], setAllFocusedNodes(["some/path/*.ts", "foo.ts"]))
|
|
52
|
+
|
|
53
|
+
expect(result).toEqual(["some/path/*.ts", "foo.ts"])
|
|
38
54
|
})
|
|
39
55
|
})
|
|
40
56
|
})
|
package/app/codeCharta/state/store/dynamicSettings/focusedNodePath/focusedNodePath.reducer.ts
CHANGED
|
@@ -1,12 +1,18 @@
|
|
|
1
|
-
import { FocusedNodePathAction, FocusedNodePathActions
|
|
1
|
+
import { defaultFocusedNodePath, FocusedNodePathAction, FocusedNodePathActions } from "./focusedNodePath.actions"
|
|
2
2
|
import { CodeChartaService } from "../../../../codeCharta.service"
|
|
3
3
|
|
|
4
|
-
export function focusedNodePath(state =
|
|
4
|
+
export function focusedNodePath(state = defaultFocusedNodePath, action: FocusedNodePathAction) {
|
|
5
5
|
switch (action.type) {
|
|
6
|
-
case FocusedNodePathActions.FOCUS_NODE:
|
|
7
|
-
|
|
6
|
+
case FocusedNodePathActions.FOCUS_NODE: {
|
|
7
|
+
if (action.payload === CodeChartaService.ROOT_PATH) return state
|
|
8
|
+
return [action.payload, ...state]
|
|
9
|
+
}
|
|
8
10
|
case FocusedNodePathActions.UNFOCUS_NODE:
|
|
9
|
-
return
|
|
11
|
+
return state.slice(1)
|
|
12
|
+
case FocusedNodePathActions.UNFOCUS_ALL_NODES:
|
|
13
|
+
return []
|
|
14
|
+
case FocusedNodePathActions.SET_ALL_FOCUSED_NODES:
|
|
15
|
+
return [...action.payload]
|
|
10
16
|
default:
|
|
11
17
|
return state
|
|
12
18
|
}
|
package/app/codeCharta/state/store/dynamicSettings/focusedNodePath/focusedNodePath.service.spec.ts
CHANGED
|
@@ -57,7 +57,7 @@ describe("FocusedNodePathService", () => {
|
|
|
57
57
|
|
|
58
58
|
focusedNodePathService.onStoreChanged(FocusedNodePathActions.FOCUS_NODE)
|
|
59
59
|
|
|
60
|
-
expect($rootScope.$broadcast).toHaveBeenCalledWith("focus-node", { focusedNodePath: "some/path/*.ts" })
|
|
60
|
+
expect($rootScope.$broadcast).toHaveBeenCalledWith("focus-node", { focusedNodePath: ["some/path/*.ts"] })
|
|
61
61
|
})
|
|
62
62
|
|
|
63
63
|
it("should notify all subscribers with the new focusedNodePath value", () => {
|
|
@@ -85,7 +85,7 @@ describe("FocusedNodePathService", () => {
|
|
|
85
85
|
|
|
86
86
|
focusedNodePathService.onFilesSelectionChanged()
|
|
87
87
|
|
|
88
|
-
expect(storeService.getState().dynamicSettings.focusedNodePath).toEqual(
|
|
88
|
+
expect(storeService.getState().dynamicSettings.focusedNodePath).toEqual([])
|
|
89
89
|
})
|
|
90
90
|
})
|
|
91
91
|
})
|
package/app/codeCharta/state/store/dynamicSettings/focusedNodePath/focusedNodePath.service.ts
CHANGED
|
@@ -43,7 +43,7 @@ export class FocusedNodePathService implements StoreSubscriber, FilesSelectionSu
|
|
|
43
43
|
return this.storeService.getState().dynamicSettings.focusedNodePath
|
|
44
44
|
}
|
|
45
45
|
|
|
46
|
-
private notifyFocus(newState: string) {
|
|
46
|
+
private notifyFocus(newState: string[]) {
|
|
47
47
|
this.$rootScope.$broadcast(FocusedNodePathService.FOCUS_NODE_EVENT, { focusedNodePath: newState })
|
|
48
48
|
}
|
|
49
49
|
|
|
@@ -3,7 +3,9 @@ import { BlacklistItem, CCAction } from "../../../../codeCharta.model"
|
|
|
3
3
|
export enum BlacklistActions {
|
|
4
4
|
ADD_BLACKLIST_ITEM = "ADD_BLACKLIST_ITEM",
|
|
5
5
|
REMOVE_BLACKLIST_ITEM = "REMOVE_BLACKLIST_ITEM",
|
|
6
|
-
SET_BLACKLIST = "SET_BLACKLIST"
|
|
6
|
+
SET_BLACKLIST = "SET_BLACKLIST",
|
|
7
|
+
ADD_BLACKLIST_ITEMS_IF_NOT_RESULTS_IN_EMPTY_MAP = "ADD_BLACKLIST_ITEMS_IF_NOT_RESULTS_IN_EMPTY_MAP",
|
|
8
|
+
ADD_BLACKLIST_ITEMS = "ADD_BLACKLIST_ITEMS"
|
|
7
9
|
}
|
|
8
10
|
|
|
9
11
|
export interface AddBlacklistAction extends CCAction {
|
|
@@ -11,6 +13,16 @@ export interface AddBlacklistAction extends CCAction {
|
|
|
11
13
|
payload: BlacklistItem
|
|
12
14
|
}
|
|
13
15
|
|
|
16
|
+
export interface AddBlacklistItemsIfNotResultsInEmptyMapAction extends CCAction {
|
|
17
|
+
type: BlacklistActions.ADD_BLACKLIST_ITEMS_IF_NOT_RESULTS_IN_EMPTY_MAP
|
|
18
|
+
payload: BlacklistItem[]
|
|
19
|
+
}
|
|
20
|
+
|
|
21
|
+
export interface AddBlacklistItemsAction extends CCAction {
|
|
22
|
+
type: BlacklistActions.ADD_BLACKLIST_ITEMS
|
|
23
|
+
payload: BlacklistItem[]
|
|
24
|
+
}
|
|
25
|
+
|
|
14
26
|
export interface RemoveBlacklistAction extends CCAction {
|
|
15
27
|
type: BlacklistActions.REMOVE_BLACKLIST_ITEM
|
|
16
28
|
payload: BlacklistItem
|
|
@@ -21,7 +33,12 @@ export interface SetBlacklistAction extends CCAction {
|
|
|
21
33
|
payload: BlacklistItem[]
|
|
22
34
|
}
|
|
23
35
|
|
|
24
|
-
export type BlacklistAction =
|
|
36
|
+
export type BlacklistAction =
|
|
37
|
+
| AddBlacklistAction
|
|
38
|
+
| RemoveBlacklistAction
|
|
39
|
+
| SetBlacklistAction
|
|
40
|
+
| AddBlacklistItemsAction
|
|
41
|
+
| AddBlacklistItemsIfNotResultsInEmptyMapAction
|
|
25
42
|
|
|
26
43
|
export function addBlacklistItem(item: BlacklistItem): AddBlacklistAction {
|
|
27
44
|
return {
|
|
@@ -30,6 +47,20 @@ export function addBlacklistItem(item: BlacklistItem): AddBlacklistAction {
|
|
|
30
47
|
}
|
|
31
48
|
}
|
|
32
49
|
|
|
50
|
+
export function addBlacklistItemsIfNotResultsInEmptyMap(items: BlacklistItem[]): AddBlacklistItemsIfNotResultsInEmptyMapAction {
|
|
51
|
+
return {
|
|
52
|
+
type: BlacklistActions.ADD_BLACKLIST_ITEMS_IF_NOT_RESULTS_IN_EMPTY_MAP,
|
|
53
|
+
payload: items
|
|
54
|
+
}
|
|
55
|
+
}
|
|
56
|
+
|
|
57
|
+
export function addBlacklistItems(items: BlacklistItem[]): AddBlacklistItemsAction {
|
|
58
|
+
return {
|
|
59
|
+
type: BlacklistActions.ADD_BLACKLIST_ITEMS,
|
|
60
|
+
payload: items
|
|
61
|
+
}
|
|
62
|
+
}
|
|
63
|
+
|
|
33
64
|
export function removeBlacklistItem(item: BlacklistItem): RemoveBlacklistAction {
|
|
34
65
|
return {
|
|
35
66
|
type: BlacklistActions.REMOVE_BLACKLIST_ITEM,
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { addBlacklistItem, BlacklistAction, setBlacklist, removeBlacklistItem } from "./blacklist.actions"
|
|
1
|
+
import { addBlacklistItem, BlacklistAction, setBlacklist, removeBlacklistItem, addBlacklistItems } from "./blacklist.actions"
|
|
2
2
|
import { blacklist } from "./blacklist.reducer"
|
|
3
3
|
import { BlacklistItem, BlacklistType } from "../../../../codeCharta.model"
|
|
4
4
|
|
|
@@ -21,6 +21,22 @@ describe("blacklist", () => {
|
|
|
21
21
|
})
|
|
22
22
|
})
|
|
23
23
|
|
|
24
|
+
describe("Action: ADD_BLACKLIST_ITEMS", () => {
|
|
25
|
+
it("should add all unique blacklist items to the blacklist", () => {
|
|
26
|
+
const existingItem: BlacklistItem = { type: BlacklistType.flatten, path: "foo/bar" }
|
|
27
|
+
const result = blacklist(
|
|
28
|
+
[existingItem],
|
|
29
|
+
addBlacklistItems([
|
|
30
|
+
existingItem,
|
|
31
|
+
{ type: BlacklistType.flatten, path: "foo/bar2" },
|
|
32
|
+
{ type: BlacklistType.flatten, path: "foo/bar2" }
|
|
33
|
+
])
|
|
34
|
+
)
|
|
35
|
+
|
|
36
|
+
expect(result).toEqual([existingItem, { type: BlacklistType.flatten, path: "foo/bar2" }])
|
|
37
|
+
})
|
|
38
|
+
})
|
|
39
|
+
|
|
24
40
|
describe("Action: REMOVE_BLACKLIST_ITEM", () => {
|
|
25
41
|
it("should remove a blacklist item, that is in the list", () => {
|
|
26
42
|
const result = blacklist([item], removeBlacklistItem(item))
|