codecharta-visualization 1.86.0 → 1.87.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 +6 -2
- package/app/codeCharta/codeCharta.model.ts +1 -1
- 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/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/state.splitter.spec.ts +4 -4
- package/app/codeCharta/state/store.service.spec.ts +3 -3
- package/app/codeCharta/state/store.service.ts +5 -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/codeMap/codeMap.actions.service.ts +1 -40
- package/app/codeCharta/ui/codeMap/codeMap.mouseEvent.service.ts +10 -16
- 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 +21 -3
- 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/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/nodeContextMenu/focusButtons/focusButtons.component.html +24 -0
- package/app/codeCharta/ui/nodeContextMenu/focusButtons/focusButtons.component.spec.ts +55 -0
- package/app/codeCharta/ui/nodeContextMenu/focusButtons/focusButtons.component.ts +38 -0
- package/app/codeCharta/ui/nodeContextMenu/focusButtons/focusButtons.module.ts +13 -0
- package/app/codeCharta/ui/nodeContextMenu/focusButtons/isNodeFocused.pipe.spec.ts +31 -0
- package/app/codeCharta/ui/nodeContextMenu/focusButtons/isNodeFocused.pipe.ts +25 -0
- package/app/codeCharta/ui/nodeContextMenu/markFolderColorPicker/markFolderColorPicker.component.html +8 -4
- package/app/codeCharta/ui/nodeContextMenu/markFolderColorPicker/markFolderColorPicker.component.ts +1 -21
- package/app/codeCharta/ui/nodeContextMenu/markFolderColorPicker/markFolderColorPicker.module.ts +1 -2
- package/app/codeCharta/ui/nodeContextMenu/nodeContextMenu.component.html +2 -12
- package/app/codeCharta/ui/nodeContextMenu/nodeContextMenu.component.scss +3 -1
- package/app/codeCharta/ui/nodeContextMenu/nodeContextMenu.component.spec.ts +28 -125
- package/app/codeCharta/ui/nodeContextMenu/nodeContextMenu.component.ts +29 -55
- package/app/codeCharta/ui/nodeContextMenu/nodeContextMenu.module.ts +2 -0
- package/app/codeCharta/ui/ui.ts +0 -2
- 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 +1 -1
- 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 +1 -1
- package/app/codeCharta/util/dataMocks.ts +2 -2
- package/app/codeCharta/util/fileExtensionCalculator.ts +1 -1
- package/dist/webpack/bundle.js +963 -934
- package/dist/webpack/bundle.js.map +1 -1
- package/package.json +6 -5
- package/app/codeCharta/state/store/dynamicSettings/focusedNodePath/focusedNodePath.splitter.ts +0 -8
- package/app/codeCharta/ui/codeMap/codeMap.actions.service.spec.ts +0 -147
- 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/package.json
CHANGED
|
@@ -10,7 +10,7 @@
|
|
|
10
10
|
"url": "https://github.com/MaibornWolff/codecharta.git"
|
|
11
11
|
},
|
|
12
12
|
"name": "codecharta-visualization",
|
|
13
|
-
"version": "1.
|
|
13
|
+
"version": "1.87.0",
|
|
14
14
|
"engines": {
|
|
15
15
|
"node": ">=16"
|
|
16
16
|
},
|
|
@@ -133,6 +133,7 @@
|
|
|
133
133
|
"remark": "^13.0.0",
|
|
134
134
|
"remark-html": "^13.0.1",
|
|
135
135
|
"remark-loader": "^4.0.0",
|
|
136
|
+
"rxjs": "^7.5.1",
|
|
136
137
|
"shelljs": "^0.8.4",
|
|
137
138
|
"three": "^0.126.1",
|
|
138
139
|
"three-orbit-controls": "^82.1.0",
|
|
@@ -157,8 +158,8 @@
|
|
|
157
158
|
"@types/node": "^16.0.0",
|
|
158
159
|
"@types/puppeteer": "^5.4.3",
|
|
159
160
|
"@types/three": "^0.126.0",
|
|
160
|
-
"@typescript-eslint/eslint-plugin": "^
|
|
161
|
-
"@typescript-eslint/parser": "^
|
|
161
|
+
"@typescript-eslint/eslint-plugin": "^5.0.0",
|
|
162
|
+
"@typescript-eslint/parser": "^5.0.0",
|
|
162
163
|
"babel-loader": "^8.2.2",
|
|
163
164
|
"babel-plugin-angularjs-annotate": "^0.10.0",
|
|
164
165
|
"bestzip": "^2.2.0",
|
|
@@ -166,9 +167,9 @@
|
|
|
166
167
|
"clean-webpack-plugin": "^4.0.0",
|
|
167
168
|
"cross-env": "^7.0.3",
|
|
168
169
|
"css-loader": "^6.0.0",
|
|
169
|
-
"eslint": "^
|
|
170
|
+
"eslint": "^8.0.0",
|
|
170
171
|
"eslint-config-prettier": "^8.2.0",
|
|
171
|
-
"eslint-plugin-unicorn": "^
|
|
172
|
+
"eslint-plugin-unicorn": "^40.0.0",
|
|
172
173
|
"file-loader": "^6.2.0",
|
|
173
174
|
"html-loader": "^1.1.0",
|
|
174
175
|
"html-loader-jest": "^0.2.1",
|
|
@@ -1,147 +0,0 @@
|
|
|
1
|
-
import "./codeMap.module"
|
|
2
|
-
import "../../codeCharta.module"
|
|
3
|
-
import { CodeMapActionsService } from "./codeMap.actions.service"
|
|
4
|
-
import { getService, instantiateModule } from "../../../../mocks/ng.mockhelper"
|
|
5
|
-
import { CodeMapNode } from "../../codeCharta.model"
|
|
6
|
-
import { VALID_NODE_WITH_PATH } from "../../util/dataMocks"
|
|
7
|
-
import { StoreService } from "../../state/store.service"
|
|
8
|
-
import { setMarkedPackages } from "../../state/store/fileSettings/markedPackages/markedPackages.actions"
|
|
9
|
-
import { EdgeMetricDataService } from "../../state/store/metricData/edgeMetricData/edgeMetricData.service"
|
|
10
|
-
import { clone } from "../../util/clone"
|
|
11
|
-
|
|
12
|
-
describe("CodeMapActionService", () => {
|
|
13
|
-
let codeMapActionsService: CodeMapActionsService
|
|
14
|
-
let edgeMetricDataService: EdgeMetricDataService
|
|
15
|
-
let storeService: StoreService
|
|
16
|
-
|
|
17
|
-
let nodeA: CodeMapNode
|
|
18
|
-
|
|
19
|
-
function restartSystem() {
|
|
20
|
-
instantiateModule("app.codeCharta.ui.codeMap")
|
|
21
|
-
|
|
22
|
-
edgeMetricDataService = getService<EdgeMetricDataService>("edgeMetricDataService")
|
|
23
|
-
storeService = getService<StoreService>("storeService")
|
|
24
|
-
|
|
25
|
-
nodeA = clone(VALID_NODE_WITH_PATH)
|
|
26
|
-
storeService.dispatch(setMarkedPackages())
|
|
27
|
-
}
|
|
28
|
-
|
|
29
|
-
function rebuildService() {
|
|
30
|
-
codeMapActionsService = new CodeMapActionsService(edgeMetricDataService, storeService)
|
|
31
|
-
}
|
|
32
|
-
|
|
33
|
-
beforeEach(() => {
|
|
34
|
-
restartSystem()
|
|
35
|
-
rebuildService()
|
|
36
|
-
})
|
|
37
|
-
|
|
38
|
-
describe("markFolder", () => {
|
|
39
|
-
it("should mark a folder that is not marked yet and has no marked children packages", () => {
|
|
40
|
-
const expected = [{ color: "0x000000", path: "/root" }]
|
|
41
|
-
|
|
42
|
-
codeMapActionsService.markFolder(nodeA, "0x000000")
|
|
43
|
-
|
|
44
|
-
expect(storeService.getState().fileSettings.markedPackages).toHaveLength(1)
|
|
45
|
-
expect(storeService.getState().fileSettings.markedPackages).toEqual(expected)
|
|
46
|
-
})
|
|
47
|
-
|
|
48
|
-
it("should remove the children of a marked package if color is the same", () => {
|
|
49
|
-
const expected = [{ color: "0x000000", path: "/root" }]
|
|
50
|
-
|
|
51
|
-
codeMapActionsService.markFolder(nodeA.children[0], "0x000000")
|
|
52
|
-
codeMapActionsService.markFolder(nodeA, "0x000000")
|
|
53
|
-
|
|
54
|
-
expect(storeService.getState().fileSettings.markedPackages).toHaveLength(1)
|
|
55
|
-
expect(storeService.getState().fileSettings.markedPackages).toEqual(expected)
|
|
56
|
-
})
|
|
57
|
-
|
|
58
|
-
it("should not remove the children of a marked package if color is different", () => {
|
|
59
|
-
const expected = [
|
|
60
|
-
{ color: "0x000000", path: "/root" },
|
|
61
|
-
{ color: "0x000001", path: "/root/big leaf" }
|
|
62
|
-
]
|
|
63
|
-
|
|
64
|
-
codeMapActionsService.markFolder(nodeA, "0x000000")
|
|
65
|
-
codeMapActionsService.markFolder(nodeA.children[0], "0x000001")
|
|
66
|
-
|
|
67
|
-
expect(storeService.getState().fileSettings.markedPackages).toHaveLength(2)
|
|
68
|
-
expect(storeService.getState().fileSettings.markedPackages).toEqual(expected)
|
|
69
|
-
})
|
|
70
|
-
|
|
71
|
-
it("should not mark with a new color if sub-nodes are already marked", () => {
|
|
72
|
-
const expected = [
|
|
73
|
-
{ color: "0x000003", path: "/root" },
|
|
74
|
-
{ color: "0x000001", path: "/root/big leaf" },
|
|
75
|
-
{ color: "0x000002", path: "/root/Parent Leaf" }
|
|
76
|
-
]
|
|
77
|
-
|
|
78
|
-
codeMapActionsService.markFolder(nodeA, "0x000000")
|
|
79
|
-
codeMapActionsService.markFolder(nodeA.children[0], "0x000001")
|
|
80
|
-
codeMapActionsService.markFolder(nodeA.children[1], "0x000002")
|
|
81
|
-
|
|
82
|
-
codeMapActionsService.markFolder(nodeA, "0x000003")
|
|
83
|
-
|
|
84
|
-
expect(storeService.getState().fileSettings.markedPackages).toHaveLength(3)
|
|
85
|
-
expect(storeService.getState().fileSettings.markedPackages).toEqual(expected)
|
|
86
|
-
})
|
|
87
|
-
})
|
|
88
|
-
|
|
89
|
-
describe("unmarkFolder", () => {
|
|
90
|
-
it("should unmark a folder that is marked and has no marked children packages", () => {
|
|
91
|
-
codeMapActionsService.markFolder(nodeA, "0x000000")
|
|
92
|
-
|
|
93
|
-
codeMapActionsService.unmarkFolder(nodeA)
|
|
94
|
-
|
|
95
|
-
expect(storeService.getState().fileSettings.markedPackages).toHaveLength(0)
|
|
96
|
-
expect(storeService.getState().fileSettings.markedPackages).toEqual([])
|
|
97
|
-
})
|
|
98
|
-
|
|
99
|
-
it("should not unmark marked children nodes", () => {
|
|
100
|
-
const expected = [
|
|
101
|
-
{ color: "0x000000", path: "/root/big leaf" },
|
|
102
|
-
{ color: "0x000000", path: "/root/Parent Leaf" }
|
|
103
|
-
]
|
|
104
|
-
|
|
105
|
-
codeMapActionsService.markFolder(nodeA.children[0], "0x000000")
|
|
106
|
-
codeMapActionsService.markFolder(nodeA.children[1], "0x000000")
|
|
107
|
-
|
|
108
|
-
codeMapActionsService.unmarkFolder(nodeA)
|
|
109
|
-
|
|
110
|
-
expect(storeService.getState().fileSettings.markedPackages).toHaveLength(2)
|
|
111
|
-
expect(storeService.getState().fileSettings.markedPackages).toEqual(expected)
|
|
112
|
-
})
|
|
113
|
-
})
|
|
114
|
-
|
|
115
|
-
describe("getParentMarkedPackageIndex", () => {
|
|
116
|
-
it("should return null if there are no marked packages", () => {
|
|
117
|
-
const result = codeMapActionsService.getParentMarkedPackageIndex(nodeA.path)
|
|
118
|
-
|
|
119
|
-
expect(result).toEqual(-1)
|
|
120
|
-
})
|
|
121
|
-
|
|
122
|
-
it("should return null if node is a marked package", () => {
|
|
123
|
-
codeMapActionsService.markFolder(nodeA, "0x000000")
|
|
124
|
-
|
|
125
|
-
const result = codeMapActionsService.getParentMarkedPackageIndex(nodeA.path)
|
|
126
|
-
|
|
127
|
-
expect(result).toEqual(-1)
|
|
128
|
-
})
|
|
129
|
-
|
|
130
|
-
it("should return marked package of root", () => {
|
|
131
|
-
codeMapActionsService.markFolder(nodeA, "0x000000")
|
|
132
|
-
|
|
133
|
-
const result = codeMapActionsService.getParentMarkedPackageIndex(nodeA.children[0].path)
|
|
134
|
-
|
|
135
|
-
expect(result).toEqual(0)
|
|
136
|
-
})
|
|
137
|
-
|
|
138
|
-
it("should return the correct parent marked package", () => {
|
|
139
|
-
codeMapActionsService.markFolder(nodeA, "0x000000")
|
|
140
|
-
codeMapActionsService.markFolder(nodeA.children[1], "0x000001")
|
|
141
|
-
|
|
142
|
-
const result = codeMapActionsService.getParentMarkedPackageIndex(nodeA.children[1].children[0].path)
|
|
143
|
-
|
|
144
|
-
expect(result).toEqual(1)
|
|
145
|
-
})
|
|
146
|
-
})
|
|
147
|
-
})
|
|
@@ -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)
|