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
|
@@ -1,318 +0,0 @@
|
|
|
1
|
-
import "./nodeContextMenu.component.scss"
|
|
2
|
-
import angular, { IRootScopeService } from "angular"
|
|
3
|
-
import { CodeMapActionsService } from "../codeMap/codeMap.actions.service"
|
|
4
|
-
import { BlacklistItem, BlacklistType, CodeMapNode, MapColors, NodeType } from "../../codeCharta.model"
|
|
5
|
-
import { CodeMapPreRenderService } from "../codeMap/codeMap.preRender.service"
|
|
6
|
-
import { StoreService } from "../../state/store.service"
|
|
7
|
-
import { addBlacklistItem, removeBlacklistItem } from "../../state/store/fileSettings/blacklist/blacklist.actions"
|
|
8
|
-
import { focusNode } from "../../state/store/dynamicSettings/focusedNodePath/focusedNodePath.actions"
|
|
9
|
-
import { CodeMapBuilding } from "../codeMap/rendering/codeMapBuilding"
|
|
10
|
-
import { BuildingRightClickedEventSubscriber, CodeMapMouseEventService } from "../codeMap/codeMap.mouseEvent.service"
|
|
11
|
-
import { MapColorsService, MapColorsSubscriber } from "../../state/store/appSettings/mapColors/mapColors.service"
|
|
12
|
-
import { getCodeMapNodeFromPath } from "../../util/codeMapHelper"
|
|
13
|
-
import { ThreeSceneService } from "../codeMap/threeViewer/threeSceneService"
|
|
14
|
-
import { DialogService } from "../dialog/dialog.service"
|
|
15
|
-
import { BlacklistService } from "../../state/store/fileSettings/blacklist/blacklist.service"
|
|
16
|
-
import { ERROR_MESSAGES } from "../../util/fileValidator"
|
|
17
|
-
|
|
18
|
-
export enum ClickType {
|
|
19
|
-
RightClick = 2
|
|
20
|
-
}
|
|
21
|
-
|
|
22
|
-
export interface ShowNodeContextMenuSubscriber {
|
|
23
|
-
onShowNodeContextMenu(path: string, type: string, x: number, y: number)
|
|
24
|
-
}
|
|
25
|
-
|
|
26
|
-
export interface HideNodeContextMenuSubscriber {
|
|
27
|
-
onHideNodeContextMenu()
|
|
28
|
-
}
|
|
29
|
-
|
|
30
|
-
export class NodeContextMenuController
|
|
31
|
-
implements BuildingRightClickedEventSubscriber, ShowNodeContextMenuSubscriber, HideNodeContextMenuSubscriber, MapColorsSubscriber
|
|
32
|
-
{
|
|
33
|
-
private static SHOW_NODE_CONTEXT_MENU_EVENT = "show-node-context-menu"
|
|
34
|
-
private static HIDE_NODE_CONTEXT_MENU_EVENT = "hide-node-context-menu"
|
|
35
|
-
private static instance: NodeContextMenuController
|
|
36
|
-
|
|
37
|
-
private _viewModel: {
|
|
38
|
-
codeMapNode: CodeMapNode
|
|
39
|
-
showNodeContextMenu: boolean
|
|
40
|
-
markingColors: string[]
|
|
41
|
-
nodePath: string
|
|
42
|
-
lastPartOfNodePath: string
|
|
43
|
-
isNodeFocused: boolean
|
|
44
|
-
isParentFocused: boolean
|
|
45
|
-
} = {
|
|
46
|
-
codeMapNode: null,
|
|
47
|
-
showNodeContextMenu: false,
|
|
48
|
-
markingColors: null,
|
|
49
|
-
nodePath: "",
|
|
50
|
-
lastPartOfNodePath: "",
|
|
51
|
-
isNodeFocused: false,
|
|
52
|
-
isParentFocused: false
|
|
53
|
-
}
|
|
54
|
-
|
|
55
|
-
constructor(
|
|
56
|
-
private $element: Element,
|
|
57
|
-
private $window,
|
|
58
|
-
public $rootScope: IRootScopeService,
|
|
59
|
-
private storeService: StoreService,
|
|
60
|
-
private codeMapActionsService: CodeMapActionsService,
|
|
61
|
-
private codeMapPreRenderService: CodeMapPreRenderService,
|
|
62
|
-
private threeSceneService: ThreeSceneService,
|
|
63
|
-
private dialogService: DialogService,
|
|
64
|
-
private blacklistService: BlacklistService
|
|
65
|
-
) {
|
|
66
|
-
"ngInject"
|
|
67
|
-
NodeContextMenuController.instance = this
|
|
68
|
-
MapColorsService.subscribe(this.$rootScope, this)
|
|
69
|
-
CodeMapMouseEventService.subscribeToBuildingRightClickedEvents(this.$rootScope, this)
|
|
70
|
-
NodeContextMenuController.subscribeToShowNodeContextMenu(this.$rootScope, this)
|
|
71
|
-
NodeContextMenuController.subscribeToHideNodeContextMenu(this.$rootScope, this)
|
|
72
|
-
}
|
|
73
|
-
|
|
74
|
-
onMapColorsChanged(mapColors: MapColors) {
|
|
75
|
-
this._viewModel.markingColors = mapColors.markingColors
|
|
76
|
-
}
|
|
77
|
-
|
|
78
|
-
onBuildingRightClicked(building: CodeMapBuilding, x: number, y: number) {
|
|
79
|
-
const nodeType = building.node.isLeaf ? NodeType.FILE : NodeType.FOLDER
|
|
80
|
-
this.onShowNodeContextMenu(building.node.path, nodeType, x, y)
|
|
81
|
-
}
|
|
82
|
-
|
|
83
|
-
onShowNodeContextMenu(path: string, nodeType: string, mouseX: number, mouseY: number) {
|
|
84
|
-
this._viewModel.codeMapNode = getCodeMapNodeFromPath(path, nodeType, this.codeMapPreRenderService.getRenderMap())
|
|
85
|
-
this._viewModel.nodePath = path
|
|
86
|
-
this._viewModel.lastPartOfNodePath = `${path.lastIndexOf("/") === 0 ? "" : "..."}${path.slice(path.lastIndexOf("/"))}`
|
|
87
|
-
|
|
88
|
-
const focusedNodePath = this.storeService.getState().dynamicSettings.focusedNodePath
|
|
89
|
-
this._viewModel.isNodeFocused = path === focusedNodePath
|
|
90
|
-
this._viewModel.isParentFocused = path.startsWith(focusedNodePath) && path !== focusedNodePath
|
|
91
|
-
|
|
92
|
-
this._viewModel.showNodeContextMenu = true
|
|
93
|
-
|
|
94
|
-
const { x, y } = this.calculatePosition(mouseX, mouseY)
|
|
95
|
-
this.setPosition(x, y)
|
|
96
|
-
|
|
97
|
-
// Add event listeners, so that opened node context menu can be closed again later
|
|
98
|
-
// when clicking (left or right button)
|
|
99
|
-
// or using the mouse wheel on the body element.
|
|
100
|
-
document.body.addEventListener("click", this.onBodyLeftClickHideNodeContextMenu, true)
|
|
101
|
-
document.body.addEventListener("mousedown", this.onBodyRightClickHideNodeContextMenu, true)
|
|
102
|
-
document.getElementById("codeMap").addEventListener("wheel", this.onMapWheelHideNodeContextMenu, true)
|
|
103
|
-
}
|
|
104
|
-
|
|
105
|
-
onBodyLeftClickHideNodeContextMenu = (mouseEvent: MouseEvent) => {
|
|
106
|
-
if (this.isEventFromColorPicker(mouseEvent)) return
|
|
107
|
-
|
|
108
|
-
// Just close node context menu, if you click anywhere on the map.
|
|
109
|
-
NodeContextMenuController.broadcastHideEvent(this.$rootScope)
|
|
110
|
-
|
|
111
|
-
// The listener is added when showing the node context menu.
|
|
112
|
-
// Thus, remove the listener when clicking the body element with the left or right button
|
|
113
|
-
// to fire hide events only (once) when it is really necessary.
|
|
114
|
-
document.body.removeEventListener("click", this.onBodyLeftClickHideNodeContextMenu, true)
|
|
115
|
-
}
|
|
116
|
-
|
|
117
|
-
onBodyRightClickHideNodeContextMenu = event => {
|
|
118
|
-
// On mouse down (right button), the menu must be hidden immediately.
|
|
119
|
-
// Otherwise, if mouseup would be used and you would move the map with keeping the right button pressed,
|
|
120
|
-
// the menu would not be closed.
|
|
121
|
-
if (event.button === ClickType.RightClick) {
|
|
122
|
-
NodeContextMenuController.broadcastHideEvent(this.$rootScope)
|
|
123
|
-
}
|
|
124
|
-
|
|
125
|
-
// The listener is added when showing the node context menu.
|
|
126
|
-
// Thus, remove the listener when clicking the body element with the left or right button
|
|
127
|
-
// to fire hide events only (once) when it is really necessary.
|
|
128
|
-
document.body.removeEventListener("mousedown", this.onBodyRightClickHideNodeContextMenu, true)
|
|
129
|
-
}
|
|
130
|
-
|
|
131
|
-
onMapWheelHideNodeContextMenu = () => {
|
|
132
|
-
// If you zoom in and out the map, the node context menu should be closed.
|
|
133
|
-
NodeContextMenuController.broadcastHideEvent(this.$rootScope)
|
|
134
|
-
|
|
135
|
-
// The listener is added when showing the node context menu.
|
|
136
|
-
// Thus, remove the listener when using the mouse wheel on the body element
|
|
137
|
-
// to fire hide events only (once) when it is really necessary.
|
|
138
|
-
document.getElementById("codeMap").removeEventListener("wheel", this.onMapWheelHideNodeContextMenu, true)
|
|
139
|
-
}
|
|
140
|
-
|
|
141
|
-
onHideNodeContextMenu() {
|
|
142
|
-
this._viewModel.showNodeContextMenu = false
|
|
143
|
-
}
|
|
144
|
-
|
|
145
|
-
focusNode() {
|
|
146
|
-
this.storeService.dispatch(focusNode(this._viewModel.codeMapNode.path))
|
|
147
|
-
}
|
|
148
|
-
|
|
149
|
-
flattenNode() {
|
|
150
|
-
const codeMapNode = this._viewModel.codeMapNode
|
|
151
|
-
const blacklistItem: BlacklistItem = {
|
|
152
|
-
path: codeMapNode.path,
|
|
153
|
-
type: BlacklistType.flatten,
|
|
154
|
-
nodeType: codeMapNode.type
|
|
155
|
-
}
|
|
156
|
-
this.storeService.dispatch(addBlacklistItem(blacklistItem))
|
|
157
|
-
}
|
|
158
|
-
|
|
159
|
-
showFlattenedNode() {
|
|
160
|
-
const codeMapNode = this._viewModel.codeMapNode
|
|
161
|
-
const blacklistItem: BlacklistItem = {
|
|
162
|
-
path: codeMapNode.path,
|
|
163
|
-
type: BlacklistType.flatten,
|
|
164
|
-
nodeType: codeMapNode.type
|
|
165
|
-
}
|
|
166
|
-
this.storeService.dispatch(removeBlacklistItem(blacklistItem))
|
|
167
|
-
}
|
|
168
|
-
|
|
169
|
-
excludeNode() {
|
|
170
|
-
const codeMapNode = this._viewModel.codeMapNode
|
|
171
|
-
const blacklistItem: BlacklistItem = {
|
|
172
|
-
path: codeMapNode.path,
|
|
173
|
-
type: BlacklistType.exclude,
|
|
174
|
-
nodeType: codeMapNode.type
|
|
175
|
-
}
|
|
176
|
-
|
|
177
|
-
if (this.blacklistService.resultsInEmptyMap([blacklistItem])) {
|
|
178
|
-
this.dialogService.showErrorDialog(ERROR_MESSAGES.blacklistError, "Blacklist Error")
|
|
179
|
-
} else {
|
|
180
|
-
this.storeService.dispatch(addBlacklistItem(blacklistItem))
|
|
181
|
-
}
|
|
182
|
-
}
|
|
183
|
-
|
|
184
|
-
addNodeToConstantHighlight() {
|
|
185
|
-
this.threeSceneService.addNodeAndChildrenToConstantHighlight(this._viewModel.codeMapNode)
|
|
186
|
-
this.onHideNodeContextMenu()
|
|
187
|
-
}
|
|
188
|
-
|
|
189
|
-
removeNodeFromConstantHighlight() {
|
|
190
|
-
this.threeSceneService.removeNodeAndChildrenFromConstantHighlight(this._viewModel.codeMapNode)
|
|
191
|
-
this.onHideNodeContextMenu()
|
|
192
|
-
}
|
|
193
|
-
|
|
194
|
-
clickColor(color: string) {
|
|
195
|
-
if (this.isNodeOrParentMarked(color)) {
|
|
196
|
-
this.unmarkFolder()
|
|
197
|
-
} else {
|
|
198
|
-
this.markFolder(color)
|
|
199
|
-
}
|
|
200
|
-
}
|
|
201
|
-
|
|
202
|
-
markFolder = (color: string) => {
|
|
203
|
-
this.codeMapActionsService.markFolder(this._viewModel.codeMapNode, color)
|
|
204
|
-
}
|
|
205
|
-
|
|
206
|
-
unmarkFolder() {
|
|
207
|
-
this.codeMapActionsService.unmarkFolder(this._viewModel.codeMapNode)
|
|
208
|
-
}
|
|
209
|
-
|
|
210
|
-
calculatePosition(mouseX: number, mouseY: number) {
|
|
211
|
-
const width = this.$element[0].children[0].clientWidth
|
|
212
|
-
const height = this.$element[0].children[0].clientHeight
|
|
213
|
-
return {
|
|
214
|
-
x: Math.min(mouseX, this.$window.innerWidth - width),
|
|
215
|
-
y: Math.min(mouseY, this.$window.innerHeight - height)
|
|
216
|
-
}
|
|
217
|
-
}
|
|
218
|
-
|
|
219
|
-
setPosition(x: number, y: number) {
|
|
220
|
-
angular.element(this.$element[0].children[0]).css("top", `${y}px`)
|
|
221
|
-
angular.element(this.$element[0].children[0]).css("left", `${x}px`)
|
|
222
|
-
}
|
|
223
|
-
|
|
224
|
-
isNodeOrParentMarked(color?: string) {
|
|
225
|
-
if (!color || !this._viewModel.codeMapNode) {
|
|
226
|
-
return false
|
|
227
|
-
}
|
|
228
|
-
|
|
229
|
-
if (this.isNodeMarked()) {
|
|
230
|
-
return this.packageMatchesColor(color)
|
|
231
|
-
}
|
|
232
|
-
return this.packageMatchesColorOfParentMP(color)
|
|
233
|
-
}
|
|
234
|
-
|
|
235
|
-
private isEventFromColorPicker(mouseEvent: MouseEvent) {
|
|
236
|
-
const elements = mouseEvent.composedPath() as Node[]
|
|
237
|
-
return elements.some(element => element?.nodeName === "CC-MARK-FOLDER-COLOR-PICKER" || element?.nodeName === "COLOR-CHROME")
|
|
238
|
-
}
|
|
239
|
-
|
|
240
|
-
private isNodeMarked() {
|
|
241
|
-
return this.storeService.getState().fileSettings.markedPackages.some(mp => mp.path === this._viewModel.codeMapNode.path)
|
|
242
|
-
}
|
|
243
|
-
|
|
244
|
-
private packageMatchesColor(color: string) {
|
|
245
|
-
return this.storeService
|
|
246
|
-
.getState()
|
|
247
|
-
.fileSettings.markedPackages.some(mp => mp.path === this._viewModel.codeMapNode.path && mp.color === color)
|
|
248
|
-
}
|
|
249
|
-
|
|
250
|
-
private packageMatchesColorOfParentMP(color: string) {
|
|
251
|
-
const index = this.codeMapActionsService.getParentMarkedPackageIndex(this._viewModel.codeMapNode.path)
|
|
252
|
-
if (index === -1) {
|
|
253
|
-
return false
|
|
254
|
-
}
|
|
255
|
-
return this.storeService.getState().fileSettings.markedPackages[index].color === color
|
|
256
|
-
}
|
|
257
|
-
|
|
258
|
-
isNodeConstantlyHighlighted() {
|
|
259
|
-
if (this._viewModel.codeMapNode) {
|
|
260
|
-
const { lookUp } = this.storeService.getState()
|
|
261
|
-
const codeMapBuilding: CodeMapBuilding = lookUp.idToBuilding.get(this._viewModel.codeMapNode.id)
|
|
262
|
-
if (codeMapBuilding) {
|
|
263
|
-
return this.threeSceneService.getConstantHighlight().has(codeMapBuilding.id)
|
|
264
|
-
}
|
|
265
|
-
}
|
|
266
|
-
return false
|
|
267
|
-
}
|
|
268
|
-
|
|
269
|
-
isNodeOrParentFocused() {
|
|
270
|
-
const { focusedNodePath } = this.storeService.getState().dynamicSettings
|
|
271
|
-
return Boolean(focusedNodePath && this._viewModel.codeMapNode?.path.startsWith(focusedNodePath))
|
|
272
|
-
}
|
|
273
|
-
|
|
274
|
-
isNodeFocused() {
|
|
275
|
-
if (this._viewModel.codeMapNode) {
|
|
276
|
-
return this._viewModel.codeMapNode.path === this.storeService.getState().dynamicSettings.focusedNodePath
|
|
277
|
-
}
|
|
278
|
-
return false
|
|
279
|
-
}
|
|
280
|
-
|
|
281
|
-
nodeIsFolder() {
|
|
282
|
-
return this._viewModel.codeMapNode?.children?.length > 0
|
|
283
|
-
}
|
|
284
|
-
|
|
285
|
-
static broadcastShowEvent($rootScope, path: string, type: string, x, y) {
|
|
286
|
-
const rootScope = $rootScope || NodeContextMenuController.instance.$rootScope
|
|
287
|
-
rootScope.$broadcast(NodeContextMenuController.SHOW_NODE_CONTEXT_MENU_EVENT, {
|
|
288
|
-
path,
|
|
289
|
-
type,
|
|
290
|
-
x,
|
|
291
|
-
y
|
|
292
|
-
})
|
|
293
|
-
}
|
|
294
|
-
|
|
295
|
-
static broadcastHideEvent($rootScope?: IRootScopeService) {
|
|
296
|
-
const rootScope = $rootScope || NodeContextMenuController.instance.$rootScope
|
|
297
|
-
rootScope.$broadcast(NodeContextMenuController.HIDE_NODE_CONTEXT_MENU_EVENT)
|
|
298
|
-
}
|
|
299
|
-
|
|
300
|
-
static subscribeToShowNodeContextMenu($rootScope: IRootScopeService, subscriber: ShowNodeContextMenuSubscriber) {
|
|
301
|
-
$rootScope.$on(NodeContextMenuController.SHOW_NODE_CONTEXT_MENU_EVENT, (_event, data) => {
|
|
302
|
-
subscriber.onShowNodeContextMenu(data.path, data.type, data.x, data.y)
|
|
303
|
-
})
|
|
304
|
-
}
|
|
305
|
-
|
|
306
|
-
static subscribeToHideNodeContextMenu($rootScope: IRootScopeService, subscriber: HideNodeContextMenuSubscriber) {
|
|
307
|
-
const rootScope = $rootScope || NodeContextMenuController.instance.$rootScope
|
|
308
|
-
rootScope.$on(NodeContextMenuController.HIDE_NODE_CONTEXT_MENU_EVENT, () => {
|
|
309
|
-
subscriber.onHideNodeContextMenu()
|
|
310
|
-
})
|
|
311
|
-
}
|
|
312
|
-
}
|
|
313
|
-
|
|
314
|
-
export const nodeContextMenuComponent = {
|
|
315
|
-
selector: "nodeContextMenuComponent",
|
|
316
|
-
template: require("./nodeContextMenu.component.html"),
|
|
317
|
-
controller: NodeContextMenuController
|
|
318
|
-
}
|
|
@@ -1,13 +0,0 @@
|
|
|
1
|
-
import "../../state/state.module"
|
|
2
|
-
import "../../ui/ui"
|
|
3
|
-
|
|
4
|
-
import angular from "angular"
|
|
5
|
-
import { downgradeComponent } from "@angular/upgrade/static"
|
|
6
|
-
|
|
7
|
-
import { nodeContextMenuComponent } from "./nodeContextMenu.component"
|
|
8
|
-
import { MarkFolderColorPickerComponent } from "./markFolderColorPicker/markFolderColorPicker.component"
|
|
9
|
-
|
|
10
|
-
angular
|
|
11
|
-
.module("app.codeCharta.ui.nodeContextMenu", ["app.codeCharta.state", "app.codeCharta.ui"])
|
|
12
|
-
.component(nodeContextMenuComponent.selector, nodeContextMenuComponent)
|
|
13
|
-
.directive("ccMarkFolderColorPicker", downgradeComponent({ component: MarkFolderColorPickerComponent }))
|
|
@@ -1,15 +0,0 @@
|
|
|
1
|
-
<div layout="column">
|
|
2
|
-
<md-button aria-label="Remove Focus from node" ng-click="$ctrl.removeFocusedNode()" title="Show previous focused node"
|
|
3
|
-
><i class="fa fa-bullseye"></i>
|
|
4
|
-
<span ng-show="$ctrl.isParentFocused">Unfocus Parent</span>
|
|
5
|
-
<span ng-show="$ctrl.isNodeFocused">Unfocus</span>
|
|
6
|
-
</md-button>
|
|
7
|
-
<md-button
|
|
8
|
-
aria-label="Remove Focus from all nodes"
|
|
9
|
-
ng-click="$ctrl.removeFocusedNode(true)"
|
|
10
|
-
title="Show complete map"
|
|
11
|
-
ng-show="$ctrl._viewModel.focusedNodes.length > 1"
|
|
12
|
-
><i class="fa fa-bullseye"></i>
|
|
13
|
-
<span>Unfocus All</span>
|
|
14
|
-
</md-button>
|
|
15
|
-
</div>
|
|
@@ -1,106 +0,0 @@
|
|
|
1
|
-
import "./unfocusButton.module"
|
|
2
|
-
import { UnfocusButtonController } from "./unfocusButton.component"
|
|
3
|
-
import { getService, instantiateModule } from "../../../../mocks/ng.mockhelper"
|
|
4
|
-
import { IRootScopeService } from "angular"
|
|
5
|
-
import { StoreService } from "../../state/store.service"
|
|
6
|
-
import { focusNode } from "../../state/store/dynamicSettings/focusedNodePath/focusedNodePath.actions"
|
|
7
|
-
import { TEST_DELTA_MAP_A } from "../../util/dataMocks"
|
|
8
|
-
import { setIdToNode } from "../../state/store/lookUp/idToNode/idToNode.actions"
|
|
9
|
-
import { NodeDecorator } from "../../util/nodeDecorator"
|
|
10
|
-
import { FocusedNodePathService } from "../../state/store/dynamicSettings/focusedNodePath/focusedNodePath.service"
|
|
11
|
-
|
|
12
|
-
describe("UnfocusButtonController", () => {
|
|
13
|
-
let unfocusButtonController: UnfocusButtonController
|
|
14
|
-
let $rootScope: IRootScopeService
|
|
15
|
-
let storeService: StoreService
|
|
16
|
-
|
|
17
|
-
beforeEach(() => {
|
|
18
|
-
restartSystem()
|
|
19
|
-
rebuildController()
|
|
20
|
-
})
|
|
21
|
-
|
|
22
|
-
function restartSystem() {
|
|
23
|
-
instantiateModule("app.codeCharta.ui.unfocusButton")
|
|
24
|
-
|
|
25
|
-
$rootScope = getService<IRootScopeService>("$rootScope")
|
|
26
|
-
storeService = getService<StoreService>("storeService")
|
|
27
|
-
|
|
28
|
-
NodeDecorator.decorateMapWithPathAttribute(TEST_DELTA_MAP_A)
|
|
29
|
-
NodeDecorator.decorateMap(
|
|
30
|
-
TEST_DELTA_MAP_A.map,
|
|
31
|
-
{
|
|
32
|
-
nodeMetricData: [],
|
|
33
|
-
edgeMetricData: []
|
|
34
|
-
},
|
|
35
|
-
[]
|
|
36
|
-
)
|
|
37
|
-
const map = new Map([
|
|
38
|
-
[TEST_DELTA_MAP_A.map.children[0].id, TEST_DELTA_MAP_A.map.children[0]],
|
|
39
|
-
[TEST_DELTA_MAP_A.map.children[1].id, TEST_DELTA_MAP_A.map.children[1]],
|
|
40
|
-
[TEST_DELTA_MAP_A.map.children[1].children[0].id, TEST_DELTA_MAP_A.map.children[1].children[0]]
|
|
41
|
-
])
|
|
42
|
-
storeService.dispatch(setIdToNode(map))
|
|
43
|
-
}
|
|
44
|
-
|
|
45
|
-
function rebuildController() {
|
|
46
|
-
unfocusButtonController = new UnfocusButtonController($rootScope, storeService)
|
|
47
|
-
}
|
|
48
|
-
|
|
49
|
-
describe("constructor", () => {
|
|
50
|
-
it("should subscribe to focus node", () => {
|
|
51
|
-
FocusedNodePathService.subscribeToFocusNode = jest.fn()
|
|
52
|
-
|
|
53
|
-
rebuildController()
|
|
54
|
-
|
|
55
|
-
expect(FocusedNodePathService.subscribeToFocusNode).toHaveBeenCalledWith($rootScope, unfocusButtonController)
|
|
56
|
-
})
|
|
57
|
-
})
|
|
58
|
-
|
|
59
|
-
describe("on focus node", () => {
|
|
60
|
-
it("should add the node to focusedNodes", function () {
|
|
61
|
-
unfocusButtonController.onFocusNode("/root/app")
|
|
62
|
-
expect(unfocusButtonController["_viewModel"].focusedNodes.length).toBeGreaterThan(0)
|
|
63
|
-
})
|
|
64
|
-
it("should not add the node to focusedNodes", function () {
|
|
65
|
-
unfocusButtonController.onFocusNode("/root/app")
|
|
66
|
-
unfocusButtonController.onFocusNode("/root/app")
|
|
67
|
-
expect(unfocusButtonController["_viewModel"].focusedNodes.length).toBe(1)
|
|
68
|
-
|
|
69
|
-
unfocusButtonController.onFocusNode("")
|
|
70
|
-
expect(unfocusButtonController["_viewModel"].focusedNodes.length).toBe(1)
|
|
71
|
-
})
|
|
72
|
-
})
|
|
73
|
-
|
|
74
|
-
describe("removeFocusedNode", () => {
|
|
75
|
-
it("should apply previous focusedNodePath in storeService", () => {
|
|
76
|
-
unfocusButtonController["_viewModel"].focusedNodes = ["/root", "/root/app"]
|
|
77
|
-
storeService.dispatch(focusNode("/root/app"))
|
|
78
|
-
|
|
79
|
-
unfocusButtonController.removeFocusedNode()
|
|
80
|
-
|
|
81
|
-
expect(unfocusButtonController["_viewModel"].focusedNodes.length).toBe(1)
|
|
82
|
-
expect(unfocusButtonController["_viewModel"].focusedNodes).toEqual(["/root"])
|
|
83
|
-
})
|
|
84
|
-
|
|
85
|
-
it("should clear focusedNodePath in storeService", () => {
|
|
86
|
-
unfocusButtonController["_viewModel"].focusedNodes = ["/root", "/root/app"]
|
|
87
|
-
storeService.dispatch(focusNode("/root/app"))
|
|
88
|
-
|
|
89
|
-
unfocusButtonController.removeFocusedNode(true)
|
|
90
|
-
|
|
91
|
-
expect(unfocusButtonController["_viewModel"].focusedNodes.length).toBe(0)
|
|
92
|
-
expect(storeService.getState().dynamicSettings.focusedNodePath).toBe("")
|
|
93
|
-
})
|
|
94
|
-
})
|
|
95
|
-
|
|
96
|
-
describe("onIsLoadingFileChanged", () => {
|
|
97
|
-
it("should clear focusedNodes", () => {
|
|
98
|
-
unfocusButtonController["_viewModel"].focusedNodes = ["/root", "/root/app"]
|
|
99
|
-
|
|
100
|
-
unfocusButtonController.onIsLoadingFileChanged(true)
|
|
101
|
-
|
|
102
|
-
expect(unfocusButtonController["_viewModel"].isLoadingFile).toBe(true)
|
|
103
|
-
expect(unfocusButtonController["_viewModel"].focusedNodes).toEqual([])
|
|
104
|
-
})
|
|
105
|
-
})
|
|
106
|
-
})
|
|
@@ -1,62 +0,0 @@
|
|
|
1
|
-
import "./unfocusButton.component.scss"
|
|
2
|
-
import { IRootScopeService } from "angular"
|
|
3
|
-
import { focusNode, unfocusNode } from "../../state/store/dynamicSettings/focusedNodePath/focusedNodePath.actions"
|
|
4
|
-
import { StoreService } from "../../state/store.service"
|
|
5
|
-
import { NodeContextMenuController } from "../nodeContextMenu/nodeContextMenu.component"
|
|
6
|
-
import { IsLoadingFileService, IsLoadingFileSubscriber } from "../../state/store/appSettings/isLoadingFile/isLoadingFile.service"
|
|
7
|
-
import { FocusedNodePathService, FocusNodeSubscriber } from "../../state/store/dynamicSettings/focusedNodePath/focusedNodePath.service"
|
|
8
|
-
|
|
9
|
-
export class UnfocusButtonController implements IsLoadingFileSubscriber, FocusNodeSubscriber {
|
|
10
|
-
private _viewModel: {
|
|
11
|
-
isLoadingFile: boolean
|
|
12
|
-
isNodeFocused: boolean
|
|
13
|
-
isParentFocused: boolean
|
|
14
|
-
focusedNodes: string[]
|
|
15
|
-
} = {
|
|
16
|
-
isLoadingFile: false,
|
|
17
|
-
isNodeFocused: false,
|
|
18
|
-
isParentFocused: false,
|
|
19
|
-
focusedNodes: []
|
|
20
|
-
}
|
|
21
|
-
|
|
22
|
-
// @ts-ignore
|
|
23
|
-
private isNodeFocused: boolean
|
|
24
|
-
// @ts-ignore
|
|
25
|
-
private isParentFocused: boolean
|
|
26
|
-
|
|
27
|
-
constructor(private $rootScope: IRootScopeService, private storeService: StoreService) {
|
|
28
|
-
"ngInject"
|
|
29
|
-
IsLoadingFileService.subscribe(this.$rootScope, this)
|
|
30
|
-
FocusedNodePathService.subscribeToFocusNode(this.$rootScope, this)
|
|
31
|
-
}
|
|
32
|
-
|
|
33
|
-
onFocusNode(focusedNodePath: string) {
|
|
34
|
-
if (focusedNodePath && !this._viewModel.focusedNodes.includes(focusedNodePath)) {
|
|
35
|
-
this._viewModel.focusedNodes.push(focusedNodePath)
|
|
36
|
-
}
|
|
37
|
-
}
|
|
38
|
-
|
|
39
|
-
removeFocusedNode(removeAll = false) {
|
|
40
|
-
this.storeService.dispatch(unfocusNode())
|
|
41
|
-
if (!removeAll) {
|
|
42
|
-
this._viewModel.focusedNodes.pop()
|
|
43
|
-
const lastFocusedNode = this._viewModel.focusedNodes[this._viewModel.focusedNodes.length - 1]
|
|
44
|
-
this.storeService.dispatch(focusNode(lastFocusedNode))
|
|
45
|
-
} else {
|
|
46
|
-
this._viewModel.focusedNodes = []
|
|
47
|
-
}
|
|
48
|
-
NodeContextMenuController.broadcastHideEvent(this.$rootScope)
|
|
49
|
-
}
|
|
50
|
-
|
|
51
|
-
onIsLoadingFileChanged(isLoadingFile: boolean) {
|
|
52
|
-
this._viewModel.isLoadingFile = isLoadingFile
|
|
53
|
-
this._viewModel.focusedNodes = []
|
|
54
|
-
}
|
|
55
|
-
}
|
|
56
|
-
|
|
57
|
-
export const unfocusButtonComponent = {
|
|
58
|
-
selector: "unfocusButtonComponent",
|
|
59
|
-
template: require("./unfocusButton.component.html"),
|
|
60
|
-
controller: UnfocusButtonController,
|
|
61
|
-
bindings: { isNodeFocused: "<", isParentFocused: "<" }
|
|
62
|
-
}
|
|
@@ -1,7 +0,0 @@
|
|
|
1
|
-
import "../../state/state.module"
|
|
2
|
-
import angular from "angular"
|
|
3
|
-
import { unfocusButtonComponent } from "./unfocusButton.component"
|
|
4
|
-
|
|
5
|
-
angular
|
|
6
|
-
.module("app.codeCharta.ui.unfocusButton", ["app.codeCharta.state"])
|
|
7
|
-
.component(unfocusButtonComponent.selector, unfocusButtonComponent)
|