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
package/Dockerfile
CHANGED
package/app/app.module.ts
CHANGED
|
@@ -4,7 +4,8 @@ import { Inject, NgModule } from "@angular/core"
|
|
|
4
4
|
import { BrowserModule } from "@angular/platform-browser"
|
|
5
5
|
import { platformBrowserDynamic } from "@angular/platform-browser-dynamic"
|
|
6
6
|
import { UpgradeModule } from "@angular/upgrade/static"
|
|
7
|
-
|
|
7
|
+
import { FormsModule } from "@angular/forms"
|
|
8
|
+
import { MaterialModule } from "./material/material.module"
|
|
8
9
|
import { MapTreeViewModule } from "./codeCharta/ui/mapTreeView/mapTreeView.module"
|
|
9
10
|
import { MapTreeViewComponent } from "./codeCharta/ui/mapTreeView/mapTreeView.component"
|
|
10
11
|
import { MatchingFilesCounterComponent } from "./codeCharta/ui/matchingFilesCounter/matchingFilesCounter.component"
|
|
@@ -18,22 +19,41 @@ import { LegendPanelComponent } from "./codeCharta/ui/legendPanel/legendPanel.co
|
|
|
18
19
|
import { LegendPanelModule } from "./codeCharta/ui/legendPanel/legendPanel.module"
|
|
19
20
|
import { ColorPickerForMapColorModule } from "./codeCharta/ui/colorPickerForMapColor/colorPickerForMapColor.module"
|
|
20
21
|
import { ColorPickerForMapColorComponent } from "./codeCharta/ui/colorPickerForMapColor/colorPickerForMapColor.component"
|
|
21
|
-
import {
|
|
22
|
-
import {
|
|
22
|
+
import { FilePanelFileSelectorComponent } from "./codeCharta/ui/filePanel/filePanelFileSelector/filePanelFileSelector.component"
|
|
23
|
+
import { FilePanelStateButtonsComponent } from "./codeCharta/ui/filePanel/filePanelStateButtons/filePanelStateButtons.component"
|
|
24
|
+
import { FilePanelDeltaSelectorComponent } from "./codeCharta/ui/filePanel/filePanelDeltaSelector/filePanelDeltaSelector.component"
|
|
25
|
+
import { EffectsModule } from "./codeCharta/state/angular-redux/effects/effects.module"
|
|
26
|
+
import { UnfocusNodesOnLoadingMapEffect } from "./codeCharta/state/effects/unfocusNodesOnLoadingMap.effect"
|
|
27
|
+
import { AddBlacklistItemsIfNotResultsInEmptyMapEffect } from "./codeCharta/state/effects/addBlacklistItemsIfNotResultsInEmptyMap/addBlacklistItemsIfNotResultsInEmptyMap.effect"
|
|
28
|
+
import { dialogs } from "./codeCharta/ui/dialogs/dialogs"
|
|
29
|
+
import { threeSceneServiceProvider } from "./codeCharta/services/ajs-upgraded-providers"
|
|
30
|
+
import { NodeContextMenuCardModule } from "./codeCharta/state/effects/nodeContextMenu/nodeContextMenuCard/nodeContextMenuCard.module"
|
|
31
|
+
import { OpenNodeContextMenuEffect } from "./codeCharta/state/effects/nodeContextMenu/openNodeContextMenu.effect"
|
|
32
|
+
import { InvertAreaOptionComponent } from "./codeCharta/ui/areaSettingsPanel/invertAreaOption/invertAreaOption.component"
|
|
23
33
|
|
|
24
34
|
@NgModule({
|
|
25
35
|
imports: [
|
|
26
36
|
BrowserModule,
|
|
27
37
|
UpgradeModule,
|
|
38
|
+
EffectsModule.forRoot([UnfocusNodesOnLoadingMapEffect, AddBlacklistItemsIfNotResultsInEmptyMapEffect, OpenNodeContextMenuEffect]),
|
|
28
39
|
MapTreeViewModule,
|
|
29
40
|
MatchingFilesCounterModule,
|
|
30
41
|
AttributeSideBarModule,
|
|
42
|
+
MaterialModule,
|
|
43
|
+
FormsModule,
|
|
31
44
|
Export3DMapButtonModule,
|
|
32
45
|
LegendPanelModule,
|
|
33
46
|
ColorPickerForMapColorModule,
|
|
34
|
-
|
|
47
|
+
NodeContextMenuCardModule
|
|
48
|
+
],
|
|
49
|
+
providers: [threeSceneServiceProvider],
|
|
50
|
+
declarations: [
|
|
51
|
+
FilePanelFileSelectorComponent,
|
|
52
|
+
FilePanelStateButtonsComponent,
|
|
53
|
+
FilePanelDeltaSelectorComponent,
|
|
54
|
+
InvertAreaOptionComponent,
|
|
55
|
+
...dialogs
|
|
35
56
|
],
|
|
36
|
-
declarations: [],
|
|
37
57
|
entryComponents: [
|
|
38
58
|
MapTreeViewComponent,
|
|
39
59
|
MatchingFilesCounterComponent,
|
|
@@ -42,7 +62,11 @@ import { MarkFolderColorPickerComponent } from "./codeCharta/ui/nodeContextMenu/
|
|
|
42
62
|
LegendPanelComponent,
|
|
43
63
|
LabelledColorPickerComponent,
|
|
44
64
|
ColorPickerForMapColorComponent,
|
|
45
|
-
|
|
65
|
+
FilePanelFileSelectorComponent,
|
|
66
|
+
FilePanelStateButtonsComponent,
|
|
67
|
+
FilePanelDeltaSelectorComponent,
|
|
68
|
+
InvertAreaOptionComponent,
|
|
69
|
+
...dialogs
|
|
46
70
|
]
|
|
47
71
|
})
|
|
48
72
|
export class AppModule {
|
|
@@ -76,6 +76,8 @@ export class CodeChartaController {
|
|
|
76
76
|
this.codeChartaService.loadFiles(values)
|
|
77
77
|
}
|
|
78
78
|
|
|
79
|
+
// TODO: Please make sure that this function works fine on Github pages with
|
|
80
|
+
// the updated file selection (no more single mode!)
|
|
79
81
|
private setRenderStateFromUrl() {
|
|
80
82
|
const renderState = this.urlUtils.getParameterByName("mode")
|
|
81
83
|
const files = getCCFiles(this.storeService.getState().files)
|
|
@@ -5,6 +5,7 @@ import { CodeMapBuilding } from "./ui/codeMap/rendering/codeMapBuilding"
|
|
|
5
5
|
import { FileState } from "./model/files/files"
|
|
6
6
|
import { CustomConfig } from "./model/customConfig/customConfig.api.model"
|
|
7
7
|
import Rectangle from "./util/algorithm/streetLayout/rectangle"
|
|
8
|
+
import { RightClickedNodeData } from "./state/store/appStatus/rightClickedNodeData/rightClickedNodeData.actions"
|
|
8
9
|
|
|
9
10
|
export interface NameDataPair {
|
|
10
11
|
fileName: string
|
|
@@ -25,10 +26,10 @@ export enum LayoutAlgorithm {
|
|
|
25
26
|
}
|
|
26
27
|
|
|
27
28
|
export enum SharpnessMode {
|
|
28
|
-
Standard = "
|
|
29
|
-
PixelRatioNoAA = "
|
|
30
|
-
PixelRatioFXAA = "
|
|
31
|
-
PixelRatioAA = "
|
|
29
|
+
Standard = "High",
|
|
30
|
+
PixelRatioNoAA = "Low",
|
|
31
|
+
PixelRatioFXAA = "Medium",
|
|
32
|
+
PixelRatioAA = "Best"
|
|
32
33
|
}
|
|
33
34
|
|
|
34
35
|
export interface CCFile {
|
|
@@ -119,7 +120,7 @@ export interface DynamicSettings {
|
|
|
119
120
|
colorMetric: string
|
|
120
121
|
distributionMetric: string
|
|
121
122
|
edgeMetric: string
|
|
122
|
-
focusedNodePath: string
|
|
123
|
+
focusedNodePath: string[]
|
|
123
124
|
searchPattern: string
|
|
124
125
|
margin: number
|
|
125
126
|
colorRange: ColorRange
|
|
@@ -135,6 +136,7 @@ export interface AppSettings {
|
|
|
135
136
|
cameraTarget: Vector3
|
|
136
137
|
hideFlatBuildings: boolean
|
|
137
138
|
invertHeight: boolean
|
|
139
|
+
invertArea: boolean
|
|
138
140
|
dynamicMargin: boolean
|
|
139
141
|
isWhiteBackground: boolean
|
|
140
142
|
mapColors: MapColors
|
|
@@ -404,6 +406,7 @@ export interface LookUp {
|
|
|
404
406
|
export interface AppStatus {
|
|
405
407
|
hoveredBuildingPath: string | null
|
|
406
408
|
selectedBuildingId: number | null
|
|
409
|
+
rightClickedNodeData: RightClickedNodeData
|
|
407
410
|
}
|
|
408
411
|
|
|
409
412
|
export enum PanelSelection {
|
|
@@ -6,9 +6,9 @@ import { BlacklistType, CCFile, NodeMetricData, NodeType } from "./codeCharta.mo
|
|
|
6
6
|
import { StoreService } from "./state/store.service"
|
|
7
7
|
import { removeFile, resetFiles } from "./state/store/files/files.actions"
|
|
8
8
|
import { ExportBlacklistType, ExportCCFile } from "./codeCharta.api.model"
|
|
9
|
-
import { getCCFiles,
|
|
9
|
+
import { getCCFiles, isPartialState } from "./model/files/files.helper"
|
|
10
10
|
import { DialogService } from "./ui/dialog/dialog.service"
|
|
11
|
-
import {
|
|
11
|
+
import { CCFileValidationResult, ERROR_MESSAGES } from "./util/fileValidator"
|
|
12
12
|
import packageJson from "../../package.json"
|
|
13
13
|
import { clone } from "./util/clone"
|
|
14
14
|
import { nodeMetricDataSelector } from "./state/selectors/accumulatedData/metricData/nodeMetricData.selector"
|
|
@@ -53,8 +53,7 @@ describe("codeChartaService", () => {
|
|
|
53
53
|
|
|
54
54
|
function withMockedDialogService() {
|
|
55
55
|
dialogService = codeChartaService["dialogService"] = jest.fn().mockReturnValue({
|
|
56
|
-
|
|
57
|
-
showValidationWarningDialog: jest.fn()
|
|
56
|
+
showValidationDialog: jest.fn()
|
|
58
57
|
})()
|
|
59
58
|
}
|
|
60
59
|
|
|
@@ -137,7 +136,7 @@ describe("codeChartaService", () => {
|
|
|
137
136
|
])
|
|
138
137
|
|
|
139
138
|
expect(getCCFiles(storeService.getState().files)[0]).toEqual(expected)
|
|
140
|
-
expect(
|
|
139
|
+
expect(isPartialState(storeService.getState().files)).toBeTruthy()
|
|
141
140
|
})
|
|
142
141
|
|
|
143
142
|
it("should load a valid file and update root data", async () => {
|
|
@@ -150,9 +149,8 @@ describe("codeChartaService", () => {
|
|
|
150
149
|
])
|
|
151
150
|
|
|
152
151
|
expect(getCCFiles(storeService.getState().files)[0]).toEqual(expected)
|
|
153
|
-
expect(
|
|
154
|
-
expect(dialogService.
|
|
155
|
-
expect(dialogService.showValidationErrorDialog).not.toHaveBeenCalled()
|
|
152
|
+
expect(isPartialState(storeService.getState().files)).toBeTruthy()
|
|
153
|
+
expect(dialogService.showValidationDialog).not.toHaveBeenCalled()
|
|
156
154
|
|
|
157
155
|
expect(CodeChartaService.ROOT_NAME).toEqual(expected.map.name)
|
|
158
156
|
expect(CodeChartaService.ROOT_PATH).toEqual(`/${expected.map.name}`)
|
|
@@ -253,7 +251,7 @@ describe("codeChartaService", () => {
|
|
|
253
251
|
await codeChartaService.loadFiles([{ fileName: "SecondFile", content: valid2ndFileContent, fileSize: 42 }])
|
|
254
252
|
|
|
255
253
|
expect(storeService.getState().files[0].selectedAs).toEqual("None")
|
|
256
|
-
expect(storeService.getState().files[1].selectedAs).toEqual("
|
|
254
|
+
expect(storeService.getState().files[1].selectedAs).toEqual("Partial")
|
|
257
255
|
})
|
|
258
256
|
|
|
259
257
|
it("should load the default scenario after loading a valid file", async () => {
|
|
@@ -287,41 +285,50 @@ describe("codeChartaService", () => {
|
|
|
287
285
|
})
|
|
288
286
|
|
|
289
287
|
it("should show error on invalid file", async () => {
|
|
290
|
-
const expectedError:
|
|
291
|
-
|
|
292
|
-
|
|
293
|
-
|
|
288
|
+
const expectedError: CCFileValidationResult[] = [
|
|
289
|
+
{
|
|
290
|
+
fileName,
|
|
291
|
+
errors: [ERROR_MESSAGES.fileIsInvalid],
|
|
292
|
+
warnings: []
|
|
293
|
+
}
|
|
294
|
+
]
|
|
294
295
|
|
|
295
296
|
await codeChartaService.loadFiles([{ fileName, content: null, fileSize: 0 }])
|
|
296
297
|
|
|
297
298
|
expect(storeService.getState().files).toHaveLength(0)
|
|
298
|
-
expect(dialogService.
|
|
299
|
+
expect(dialogService.showValidationDialog).toHaveBeenCalledWith(expectedError)
|
|
299
300
|
})
|
|
300
301
|
|
|
301
302
|
it("should show error on a random string", async () => {
|
|
302
|
-
const expectedError:
|
|
303
|
-
|
|
304
|
-
|
|
305
|
-
|
|
303
|
+
const expectedError: CCFileValidationResult[] = [
|
|
304
|
+
{
|
|
305
|
+
fileName,
|
|
306
|
+
errors: [ERROR_MESSAGES.apiVersionIsInvalid],
|
|
307
|
+
warnings: []
|
|
308
|
+
}
|
|
309
|
+
]
|
|
306
310
|
|
|
307
311
|
await codeChartaService.loadFiles([{ fileName, fileSize: 42, content: "string" as unknown as ExportCCFile }])
|
|
308
312
|
|
|
309
313
|
expect(storeService.getState().files).toHaveLength(0)
|
|
310
|
-
expect(dialogService.
|
|
314
|
+
expect(dialogService.showValidationDialog).toHaveBeenCalledWith(expectedError)
|
|
311
315
|
})
|
|
312
316
|
|
|
313
317
|
it("should show error if a file is missing a required property", async () => {
|
|
314
|
-
const expectedError:
|
|
315
|
-
|
|
316
|
-
|
|
317
|
-
|
|
318
|
+
const expectedError: CCFileValidationResult[] = [
|
|
319
|
+
{
|
|
320
|
+
fileName,
|
|
321
|
+
errors: ["Required error: should have required property 'projectName'"],
|
|
322
|
+
warnings: []
|
|
323
|
+
}
|
|
324
|
+
]
|
|
318
325
|
|
|
319
326
|
const invalidFileContent = validFileContent
|
|
320
327
|
delete invalidFileContent.projectName
|
|
321
328
|
await codeChartaService.loadFiles([{ fileName, fileSize: 42, content: invalidFileContent }])
|
|
322
329
|
|
|
323
330
|
expect(storeService.getState().files).toHaveLength(0)
|
|
324
|
-
expect(dialogService.
|
|
331
|
+
expect(dialogService.showValidationDialog).toHaveBeenCalledWith(expectedError)
|
|
325
332
|
})
|
|
326
333
|
|
|
327
334
|
it("should convert old blacklist type", async () => {
|
|
@@ -339,46 +346,30 @@ describe("codeChartaService", () => {
|
|
|
339
346
|
expect(getCCFiles(storeService.getState().files)[0].settings.fileSettings.blacklist).toEqual(blacklist)
|
|
340
347
|
})
|
|
341
348
|
|
|
342
|
-
it("should break the loop after the first invalid file was validated", async () => {
|
|
343
|
-
const expectedError: CCValidationResult = {
|
|
344
|
-
error: ["Required error: should have required property 'projectName'"],
|
|
345
|
-
warning: []
|
|
346
|
-
}
|
|
347
|
-
|
|
348
|
-
const invalidFileContent = validFileContent
|
|
349
|
-
delete invalidFileContent.projectName
|
|
350
|
-
|
|
351
|
-
await codeChartaService.loadFiles([
|
|
352
|
-
{ fileName, content: invalidFileContent, fileSize: 42 },
|
|
353
|
-
{ fileName, content: invalidFileContent, fileSize: 42 }
|
|
354
|
-
])
|
|
355
|
-
|
|
356
|
-
expect(dialogService.showValidationErrorDialog).toHaveBeenCalledTimes(1)
|
|
357
|
-
expect(dialogService.showValidationErrorDialog).toHaveBeenCalledWith(expectedError)
|
|
358
|
-
})
|
|
359
|
-
|
|
360
349
|
it("should not show a validation error if filenames are duplicated when their path is different", async () => {
|
|
361
350
|
validFileContent.nodes[0].children[0].name = "duplicate"
|
|
362
351
|
validFileContent.nodes[0].children[1].children[0].name = "duplicate"
|
|
363
352
|
|
|
364
353
|
await codeChartaService.loadFiles([{ fileName, content: validFileContent, fileSize: 42 }])
|
|
365
354
|
|
|
366
|
-
expect(dialogService.
|
|
355
|
+
expect(dialogService.showValidationDialog).toHaveBeenCalledTimes(0)
|
|
367
356
|
expect(storeService.getState().files).toHaveLength(1)
|
|
368
357
|
})
|
|
369
358
|
|
|
370
359
|
it("should show a validation error if two files in a folder have the same name", async () => {
|
|
371
360
|
validFileContent.nodes[0].children[1].children[0].name = "duplicate"
|
|
372
361
|
validFileContent.nodes[0].children[1].children[1].name = "duplicate"
|
|
373
|
-
const expectedError:
|
|
374
|
-
|
|
375
|
-
|
|
376
|
-
|
|
362
|
+
const expectedError: CCFileValidationResult[] = [
|
|
363
|
+
{
|
|
364
|
+
fileName,
|
|
365
|
+
errors: [`${ERROR_MESSAGES.nodesNotUnique} Found duplicate of File with path: /root/Parent Leaf/duplicate`],
|
|
366
|
+
warnings: []
|
|
367
|
+
}
|
|
368
|
+
]
|
|
377
369
|
|
|
378
370
|
await codeChartaService.loadFiles([{ fileName, content: validFileContent, fileSize: 42 }])
|
|
379
371
|
|
|
380
|
-
expect(dialogService.
|
|
381
|
-
expect(dialogService.showValidationErrorDialog).toHaveBeenCalledWith(expectedError)
|
|
372
|
+
expect(dialogService.showValidationDialog).toHaveBeenCalledWith(expectedError)
|
|
382
373
|
})
|
|
383
374
|
|
|
384
375
|
it("should not show a validation error if two files in a folder have the same name but different type", async () => {
|
|
@@ -389,7 +380,7 @@ describe("codeChartaService", () => {
|
|
|
389
380
|
|
|
390
381
|
await codeChartaService.loadFiles([{ fileName, content: validFileContent, fileSize: 42 }])
|
|
391
382
|
|
|
392
|
-
expect(dialogService.
|
|
383
|
+
expect(dialogService.showValidationDialog).toHaveBeenCalledTimes(0)
|
|
393
384
|
expect(storeService.getState().files).toHaveLength(1)
|
|
394
385
|
})
|
|
395
386
|
|
|
@@ -1,7 +1,7 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import { CCFileValidationResult, checkErrors, checkWarnings } from "./util/fileValidator"
|
|
2
2
|
import { NodeDecorator } from "./util/nodeDecorator"
|
|
3
3
|
import { StoreService } from "./state/store.service"
|
|
4
|
-
import { setFiles,
|
|
4
|
+
import { setFiles, setMultipleByNames } from "./state/store/files/files.actions"
|
|
5
5
|
import { DialogService } from "./ui/dialog/dialog.service"
|
|
6
6
|
import { setState } from "./state/store/state.actions"
|
|
7
7
|
import { ScenarioHelper } from "./util/scenarioHelper"
|
|
@@ -25,41 +25,46 @@ export class CodeChartaService {
|
|
|
25
25
|
|
|
26
26
|
async loadFiles(nameDataPairs: NameDataPair[]) {
|
|
27
27
|
this.fileStates = this.storeService.getState().files
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
if (error.error.length > 0) {
|
|
34
|
-
this.fileStates = []
|
|
35
|
-
this.recentFiles = []
|
|
36
|
-
this.storeService.dispatch(setIsLoadingFile(false))
|
|
37
|
-
await this.dialogService.showValidationErrorDialog(error)
|
|
38
|
-
break
|
|
39
|
-
}
|
|
40
|
-
|
|
41
|
-
if (error.warning.length > 0) {
|
|
42
|
-
this.addFile(nameDataPair)
|
|
43
|
-
this.addRecentFile(nameDataPair.fileName)
|
|
44
|
-
this.storeService.dispatch(setIsLoadingFile(false))
|
|
45
|
-
await this.dialogService.showValidationWarningDialog(error)
|
|
46
|
-
}
|
|
47
|
-
}
|
|
48
|
-
}
|
|
28
|
+
const fileValidationResults: CCFileValidationResult[] = []
|
|
29
|
+
|
|
30
|
+
this.getValidationResults(nameDataPairs, fileValidationResults)
|
|
31
|
+
|
|
32
|
+
this.storeService.dispatch(setIsLoadingFile(false))
|
|
49
33
|
|
|
50
|
-
if (
|
|
34
|
+
if (fileValidationResults.length > 0) await this.dialogService.showValidationDialog(fileValidationResults)
|
|
35
|
+
|
|
36
|
+
if (this.recentFiles.length > 0) {
|
|
51
37
|
this.storeService.dispatch(setRecentFiles(this.recentFiles))
|
|
52
38
|
this.storeService.dispatch(setFiles(this.fileStates))
|
|
53
39
|
|
|
54
|
-
this.fileStates = []
|
|
55
|
-
this.recentFiles = []
|
|
56
|
-
|
|
57
40
|
const recentFile = this.storeService.getState().dynamicSettings.recentFiles[0]
|
|
58
41
|
const rootName = this.storeService.getState().files.find(f => f.file.fileMeta.fileName === recentFile).file.map.name
|
|
59
|
-
this.storeService.dispatch(
|
|
42
|
+
this.storeService.dispatch(setMultipleByNames(this.recentFiles))
|
|
60
43
|
|
|
61
44
|
CodeChartaService.updateRootData(rootName)
|
|
62
45
|
this.setDefaultScenario()
|
|
46
|
+
|
|
47
|
+
this.fileStates = []
|
|
48
|
+
this.recentFiles = []
|
|
49
|
+
}
|
|
50
|
+
}
|
|
51
|
+
|
|
52
|
+
private getValidationResults(nameDataPairs: NameDataPair[], fileValidationResults: CCFileValidationResult[]) {
|
|
53
|
+
for (const nameDataPair of nameDataPairs) {
|
|
54
|
+
const fileValidationResult: CCFileValidationResult = {
|
|
55
|
+
fileName: nameDataPair?.fileName,
|
|
56
|
+
errors: [],
|
|
57
|
+
warnings: []
|
|
58
|
+
}
|
|
59
|
+
fileValidationResult.errors.push(...checkErrors(nameDataPair?.content))
|
|
60
|
+
|
|
61
|
+
if (fileValidationResult.errors.length === 0) {
|
|
62
|
+
fileValidationResult.warnings.push(...checkWarnings(nameDataPair?.content))
|
|
63
|
+
this.addFile(nameDataPair)
|
|
64
|
+
}
|
|
65
|
+
|
|
66
|
+
if (fileValidationResult.errors.length > 0 || fileValidationResult.warnings.length > 0)
|
|
67
|
+
fileValidationResults.push(fileValidationResult)
|
|
63
68
|
}
|
|
64
69
|
}
|
|
65
70
|
|
|
@@ -129,8 +134,4 @@ export class CodeChartaService {
|
|
|
129
134
|
CodeChartaService.ROOT_NAME = rootName
|
|
130
135
|
CodeChartaService.ROOT_PATH = `/${CodeChartaService.ROOT_NAME}`
|
|
131
136
|
}
|
|
132
|
-
|
|
133
|
-
private addRecentFile(fileName: string) {
|
|
134
|
-
this.recentFiles.push(fileName)
|
|
135
|
-
}
|
|
136
137
|
}
|
|
@@ -63,7 +63,7 @@ describe("codecharta", () => {
|
|
|
63
63
|
it("should throw errors when file parameters in url are invalid and load sample data instead", async () => {
|
|
64
64
|
await goto(`${CC_URL}?file=invalid234`)
|
|
65
65
|
await handleErrorDialog()
|
|
66
|
-
await checkSelectedFileName("sample1.cc.json")
|
|
66
|
+
await checkSelectedFileName("sample1.cc.json, sample2.cc.json")
|
|
67
67
|
await checkAllFileNames(["sample1.cc.json", "sample2.cc.json"])
|
|
68
68
|
})
|
|
69
69
|
})
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
import { InjectionToken, Injector } from "@angular/core"
|
|
2
|
+
|
|
3
|
+
export const ThreeSceneServiceToken = new InjectionToken("ThreeSceneService")
|
|
4
|
+
|
|
5
|
+
export function ThreeSceneServiceFactory(injector: Injector) {
|
|
6
|
+
return injector.get("threeSceneService")
|
|
7
|
+
}
|
|
8
|
+
|
|
9
|
+
export const threeSceneServiceProvider = {
|
|
10
|
+
provide: ThreeSceneServiceToken,
|
|
11
|
+
useFactory: ThreeSceneServiceFactory,
|
|
12
|
+
deps: ["$injector"]
|
|
13
|
+
}
|
|
@@ -0,0 +1,37 @@
|
|
|
1
|
+
import { mocked } from "ts-jest/utils"
|
|
2
|
+
import { Subject } from "rxjs"
|
|
3
|
+
import { Store } from "../../store/store"
|
|
4
|
+
import { createEffect } from "./createEffect"
|
|
5
|
+
|
|
6
|
+
jest.mock("../../store/store", () => ({
|
|
7
|
+
Store: {}
|
|
8
|
+
}))
|
|
9
|
+
const MockedStore = mocked(Store)
|
|
10
|
+
|
|
11
|
+
describe("createEffect", () => {
|
|
12
|
+
let source
|
|
13
|
+
|
|
14
|
+
beforeEach(() => {
|
|
15
|
+
source = new Subject()
|
|
16
|
+
MockedStore.dispatch = jest.fn()
|
|
17
|
+
})
|
|
18
|
+
|
|
19
|
+
afterEach(() => {
|
|
20
|
+
source.complete()
|
|
21
|
+
})
|
|
22
|
+
|
|
23
|
+
it("should observe and dispatch each received value", () => {
|
|
24
|
+
createEffect(() => source)
|
|
25
|
+
source.next({ type: "some-action-type" })
|
|
26
|
+
source.next({ type: "some-other-action-type" })
|
|
27
|
+
expect(MockedStore.dispatch).toHaveBeenCalledTimes(2)
|
|
28
|
+
expect(MockedStore.dispatch.mock.calls[0][0]).toEqual({ type: "some-action-type" })
|
|
29
|
+
expect(MockedStore.dispatch.mock.calls[1][0]).toEqual({ type: "some-other-action-type" })
|
|
30
|
+
})
|
|
31
|
+
|
|
32
|
+
it("should not dispatch if dispatch is set to false", () => {
|
|
33
|
+
createEffect(() => source, { dispatch: false })
|
|
34
|
+
source.next({ type: "some-action-type" })
|
|
35
|
+
expect(MockedStore.dispatch).not.toHaveBeenCalled()
|
|
36
|
+
})
|
|
37
|
+
})
|
|
@@ -0,0 +1,25 @@
|
|
|
1
|
+
import { Action } from "redux"
|
|
2
|
+
import { Observable } from "rxjs"
|
|
3
|
+
import { Store } from "../../store/store"
|
|
4
|
+
|
|
5
|
+
type DontDispatchConfig = { dispatch: false }
|
|
6
|
+
type DispatchConfig = { dispatch?: true }
|
|
7
|
+
type Config = DispatchConfig | DontDispatchConfig
|
|
8
|
+
|
|
9
|
+
/** Simple placeholder for NgRx's createEffect. The goal is to provide the
|
|
10
|
+
* same api as NgRx, so that we can switch to NgRx in the long run.
|
|
11
|
+
* Please note that its functionality is very minimal so far.
|
|
12
|
+
*/
|
|
13
|
+
export function createEffect(source: () => Observable<unknown>, config?: Config) {
|
|
14
|
+
source().subscribe(output => {
|
|
15
|
+
if (config?.dispatch === false) return
|
|
16
|
+
|
|
17
|
+
if (!isAction(output)) throw new Error("output must be an action")
|
|
18
|
+
|
|
19
|
+
Store.dispatch(output)
|
|
20
|
+
})
|
|
21
|
+
}
|
|
22
|
+
|
|
23
|
+
function isAction(something: unknown): something is Action {
|
|
24
|
+
return something && Object.prototype.hasOwnProperty.call(something, "type")
|
|
25
|
+
}
|
|
@@ -0,0 +1,36 @@
|
|
|
1
|
+
import { APP_INITIALIZER, Inject, InjectionToken, ModuleWithProviders, NgModule, Optional, SkipSelf } from "@angular/core"
|
|
2
|
+
import { Action } from "redux"
|
|
3
|
+
import { Observable, Subject } from "rxjs"
|
|
4
|
+
|
|
5
|
+
export type Actions = Observable<Action>
|
|
6
|
+
export const ActionsToken = new InjectionToken<Actions>("Actions")
|
|
7
|
+
|
|
8
|
+
/** Simple placeholder for NgRx's EffectsModule. The goal is to provide the
|
|
9
|
+
* same api as NgRx, so that we can switch to NgRx in the long run.
|
|
10
|
+
*/
|
|
11
|
+
@NgModule({})
|
|
12
|
+
export class EffectsModule {
|
|
13
|
+
static actions$ = new Subject<Action>()
|
|
14
|
+
|
|
15
|
+
constructor(@Optional() @SkipSelf() @Inject(EffectsModule) parentModule?: EffectsModule) {
|
|
16
|
+
if (parentModule) throw new Error("EffectsModule is already loaded. Import it in the AppModule only")
|
|
17
|
+
}
|
|
18
|
+
|
|
19
|
+
static forRoot(effects = []): ModuleWithProviders<EffectsModule> {
|
|
20
|
+
return {
|
|
21
|
+
ngModule: EffectsModule,
|
|
22
|
+
providers: [
|
|
23
|
+
{ provide: ActionsToken, useValue: EffectsModule.actions$ },
|
|
24
|
+
effects,
|
|
25
|
+
{
|
|
26
|
+
provide: APP_INITIALIZER,
|
|
27
|
+
deps: effects,
|
|
28
|
+
useFactory: () => () => {
|
|
29
|
+
// initialized effects"
|
|
30
|
+
},
|
|
31
|
+
multi: true
|
|
32
|
+
}
|
|
33
|
+
]
|
|
34
|
+
}
|
|
35
|
+
}
|
|
36
|
+
}
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
import { Action } from "redux"
|
|
2
|
+
import { filter, map, Observable } from "rxjs"
|
|
3
|
+
|
|
4
|
+
export function ofType<T extends Action>(type: string) {
|
|
5
|
+
return function (source: Observable<Action>) {
|
|
6
|
+
return source.pipe(
|
|
7
|
+
filter(action => action.type === type),
|
|
8
|
+
map(action => action as T)
|
|
9
|
+
)
|
|
10
|
+
}
|
|
11
|
+
}
|
|
@@ -0,0 +1,60 @@
|
|
|
1
|
+
import { ApplicationInitStatus } from "@angular/core"
|
|
2
|
+
import { TestBed } from "@angular/core/testing"
|
|
3
|
+
import { MatDialog } from "@angular/material/dialog"
|
|
4
|
+
import { Action } from "redux"
|
|
5
|
+
import { Subject } from "rxjs"
|
|
6
|
+
import { BlacklistType } from "../../../codeCharta.model"
|
|
7
|
+
import { FILE_STATES_JAVA } from "../../../util/dataMocks"
|
|
8
|
+
|
|
9
|
+
import { EffectsModule } from "../../angular-redux/effects/effects.module"
|
|
10
|
+
import { setFiles } from "../../store/files/files.actions"
|
|
11
|
+
import { addBlacklistItems, addBlacklistItemsIfNotResultsInEmptyMap } from "../../store/fileSettings/blacklist/blacklist.actions"
|
|
12
|
+
import { Store } from "../../store/store"
|
|
13
|
+
import { AddBlacklistItemsIfNotResultsInEmptyMapEffect } from "./addBlacklistItemsIfNotResultsInEmptyMap.effect"
|
|
14
|
+
|
|
15
|
+
describe("AddBlacklistItemsIfNotResultsInEmptyMapEffect", () => {
|
|
16
|
+
const mockedDialog = { open: jest.fn() }
|
|
17
|
+
let storeDispatchSpy
|
|
18
|
+
|
|
19
|
+
beforeEach(async () => {
|
|
20
|
+
Store["initialize"]()
|
|
21
|
+
storeDispatchSpy = jest.spyOn(Store, "dispatch")
|
|
22
|
+
mockedDialog.open = jest.fn()
|
|
23
|
+
|
|
24
|
+
EffectsModule.actions$ = new Subject<Action>()
|
|
25
|
+
TestBed.configureTestingModule({
|
|
26
|
+
imports: [EffectsModule.forRoot([AddBlacklistItemsIfNotResultsInEmptyMapEffect])],
|
|
27
|
+
providers: [{ provide: MatDialog, useValue: mockedDialog }]
|
|
28
|
+
})
|
|
29
|
+
await TestBed.inject(ApplicationInitStatus).donePromise
|
|
30
|
+
})
|
|
31
|
+
|
|
32
|
+
afterEach(() => {
|
|
33
|
+
EffectsModule.actions$.complete()
|
|
34
|
+
})
|
|
35
|
+
|
|
36
|
+
it("should ignore a not relevant action", () => {
|
|
37
|
+
EffectsModule.actions$.next({ type: "whatever" })
|
|
38
|
+
expect(storeDispatchSpy).not.toHaveBeenCalled()
|
|
39
|
+
expect(mockedDialog.open).not.toHaveBeenCalled()
|
|
40
|
+
})
|
|
41
|
+
|
|
42
|
+
it("should not blacklist items if it would lead to an empty map but show error dialog", () => {
|
|
43
|
+
EffectsModule.actions$.next(addBlacklistItemsIfNotResultsInEmptyMap([{ type: BlacklistType.exclude, path: "foo/bar" }]))
|
|
44
|
+
expect(storeDispatchSpy).not.toHaveBeenCalledWith(addBlacklistItems([{ type: BlacklistType.exclude, path: "foo/bar" }]))
|
|
45
|
+
expect(mockedDialog.open).toHaveBeenCalledTimes(1)
|
|
46
|
+
})
|
|
47
|
+
|
|
48
|
+
it("should blacklist items if it doesn't lead to an empty map", () => {
|
|
49
|
+
Store.dispatch(setFiles(FILE_STATES_JAVA))
|
|
50
|
+
|
|
51
|
+
EffectsModule.actions$.next(
|
|
52
|
+
addBlacklistItemsIfNotResultsInEmptyMap([{ type: BlacklistType.exclude, path: "/root/src/main/file1.java" }])
|
|
53
|
+
)
|
|
54
|
+
|
|
55
|
+
expect(storeDispatchSpy).toHaveBeenCalledWith(
|
|
56
|
+
addBlacklistItems([{ type: BlacklistType.exclude, path: "/root/src/main/file1.java" }])
|
|
57
|
+
)
|
|
58
|
+
expect(mockedDialog.open).not.toHaveBeenCalled()
|
|
59
|
+
})
|
|
60
|
+
})
|