codecharta-visualization 1.87.1 → 1.88.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/app/app.module.ts +18 -8
- package/app/codeCharta/codeCharta.component.ts +2 -0
- package/app/codeCharta/codeCharta.model.ts +2 -0
- 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/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/state.actions.ts +3 -1
- package/app/codeCharta/ui/codeMap/codeMap.mouseEvent.service.ts +6 -8
- package/app/codeCharta/ui/customConfigs/customConfigs.component.html +9 -9
- package/app/codeCharta/ui/dialog/dialog.addCustomConfigSettings.component.html +2 -2
- 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.service.spec.ts +68 -0
- package/app/codeCharta/ui/dialog/dialog.service.ts +38 -17
- 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/mapTreeView/mapTreeView.level.e2e.ts +7 -5
- 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/nodeContextMenu/markFolderRow/markFolderRow.component.html +22 -0
- package/app/codeCharta/ui/nodeContextMenu/markFolderRow/markFolderRow.component.scss +31 -0
- package/app/codeCharta/ui/nodeContextMenu/markFolderRow/markFolderRow.component.spec.ts +35 -0
- package/app/codeCharta/ui/nodeContextMenu/markFolderRow/markFolderRow.component.ts +30 -0
- package/app/codeCharta/ui/nodeContextMenu/{markFolderColorPicker/markFolderColorPicker.module.ts → markFolderRow/markFolderRow.module.ts} +4 -5
- package/app/codeCharta/ui/nodeContextMenu/markFolderRow/selectors/markFolderItems.selector.spec.ts +17 -0
- package/app/codeCharta/ui/nodeContextMenu/markFolderRow/selectors/markFolderItems.selector.ts +29 -0
- package/app/codeCharta/ui/nodeContextMenu/markFolderRow/selectors/rightClickedNode.selector.spec.ts +15 -0
- package/app/codeCharta/ui/nodeContextMenu/markFolderRow/selectors/rightClickedNode.selector.ts +9 -0
- package/app/codeCharta/ui/nodeContextMenu/nodeContextMenu.component.html +2 -15
- package/app/codeCharta/ui/nodeContextMenu/nodeContextMenu.component.scss +0 -15
- package/app/codeCharta/ui/nodeContextMenu/nodeContextMenu.component.spec.ts +10 -119
- package/app/codeCharta/ui/nodeContextMenu/nodeContextMenu.component.ts +40 -134
- package/app/codeCharta/ui/nodeContextMenu/nodeContextMenu.module.ts +2 -2
- package/app/codeCharta/ui/ribbonBar/ribbonBar.component.html +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 -2
- package/app/codeCharta/util/customConfigHelper.spec.ts +155 -60
- package/app/codeCharta/util/customConfigHelper.ts +33 -3
- package/app/codeCharta/util/dataMocks.ts +4 -2
- package/app/codeCharta/util/fileValidator.spec.ts +69 -182
- package/app/codeCharta/util/fileValidator.ts +61 -37
- package/dist/webpack/bundle.js +852 -485
- package/dist/webpack/bundle.js.map +1 -1
- package/package.json +1 -1
- package/app/codeCharta/ui/nodeContextMenu/markFolderColorPicker/markFolderColorPicker.component.html +0 -9
- package/app/codeCharta/ui/nodeContextMenu/markFolderColorPicker/markFolderColorPicker.component.scss +0 -13
- package/app/codeCharta/ui/nodeContextMenu/markFolderColorPicker/markFolderColorPicker.component.ts +0 -10
|
@@ -4,7 +4,7 @@
|
|
|
4
4
|
<screenshot-button-component></screenshot-button-component>
|
|
5
5
|
<cc-export-threed-map-button></cc-export-threed-map-button>
|
|
6
6
|
|
|
7
|
-
<file-panel
|
|
7
|
+
<cc-file-panel ng-class="{ hidden: $ctrl._viewModel.isNodeHovered }"></cc-file-panel>
|
|
8
8
|
<node-path-panel-component ng-class="{ hidden: !$ctrl._viewModel.isNodeHovered }"></node-path-panel-component>
|
|
9
9
|
|
|
10
10
|
<div class="right-aligned">
|
package/app/codeCharta/ui/ui.ts
CHANGED
|
@@ -70,7 +70,6 @@ angular
|
|
|
70
70
|
"app.codeCharta.ui.dialog",
|
|
71
71
|
"app.codeCharta.ui.fileChooser",
|
|
72
72
|
"app.codeCharta.ui.fileExtensionBar",
|
|
73
|
-
"app.codeCharta.ui.filePanel",
|
|
74
73
|
"app.codeCharta.ui.heightSettingsPanel",
|
|
75
74
|
"app.codeCharta.ui.loadingGif",
|
|
76
75
|
"app.codeCharta.ui.metricChooser",
|
|
@@ -84,7 +83,8 @@ angular
|
|
|
84
83
|
"app.codeCharta.ui.viewCube",
|
|
85
84
|
"app.codeCharta.ui.layoutSelection",
|
|
86
85
|
"app.codeCharta.ui.sharpnessModeSelector",
|
|
87
|
-
"app.codeCharta.ui.maxTreeMapFiles"
|
|
86
|
+
"app.codeCharta.ui.maxTreeMapFiles",
|
|
87
|
+
"app.codeCharta.ui.filePanel"
|
|
88
88
|
])
|
|
89
89
|
.directive("ccSortingButton", downgradeComponent({ component: SortingButtonComponent }))
|
|
90
90
|
.directive("ccSortingOption", downgradeComponent({ component: SortingOptionComponent }))
|
|
@@ -22,7 +22,7 @@ describe("CustomConfigHelper", () => {
|
|
|
22
22
|
const customConfigStub = {
|
|
23
23
|
id: "invalid-md5-checksum",
|
|
24
24
|
name: "stubbedConfig1",
|
|
25
|
-
mapSelectionMode: CustomConfigMapSelectionMode.
|
|
25
|
+
mapSelectionMode: CustomConfigMapSelectionMode.MULTIPLE,
|
|
26
26
|
assignedMaps: ["test.cc.json"],
|
|
27
27
|
stateSettings: {}
|
|
28
28
|
} as CustomConfig
|
|
@@ -58,7 +58,7 @@ describe("CustomConfigHelper", () => {
|
|
|
58
58
|
const customConfigStub = {
|
|
59
59
|
id: "invalid-md5-checksum",
|
|
60
60
|
name: "stubbedConfig2",
|
|
61
|
-
mapSelectionMode: CustomConfigMapSelectionMode.
|
|
61
|
+
mapSelectionMode: CustomConfigMapSelectionMode.MULTIPLE,
|
|
62
62
|
assignedMaps: ["test.cc.json"],
|
|
63
63
|
stateSettings: {}
|
|
64
64
|
} as CustomConfig
|
|
@@ -81,6 +81,106 @@ describe("CustomConfigHelper", () => {
|
|
|
81
81
|
expect(localStorage.getItem).toHaveBeenCalledWith(CUSTOM_CONFIGS_LOCAL_STORAGE_ELEMENT)
|
|
82
82
|
expect(JSON.parse).toHaveBeenCalledWith(undefined, stateObjectReviver)
|
|
83
83
|
})
|
|
84
|
+
|
|
85
|
+
it("should load Custom Configs from local storage with version 1.0.0, update SINGLE mode in MULTIPLE and change version to 1.0.1 ", () => {
|
|
86
|
+
const customConfigStub1 = {
|
|
87
|
+
id: "invalid-md5-checksum1",
|
|
88
|
+
name: "stubbedConfig1",
|
|
89
|
+
mapSelectionMode: CustomConfigMapSelectionMode.SINGLE,
|
|
90
|
+
assignedMaps: ["test1.cc.json"],
|
|
91
|
+
stateSettings: {}
|
|
92
|
+
} as CustomConfig
|
|
93
|
+
|
|
94
|
+
const customConfigStub2 = {
|
|
95
|
+
id: "invalid-md5-checksum2",
|
|
96
|
+
name: "stubbedConfig2",
|
|
97
|
+
mapSelectionMode: CustomConfigMapSelectionMode.MULTIPLE,
|
|
98
|
+
assignedMaps: ["test2.cc.json"],
|
|
99
|
+
stateSettings: {}
|
|
100
|
+
} as CustomConfig
|
|
101
|
+
|
|
102
|
+
const customConfigStub3 = {
|
|
103
|
+
id: "invalid-md5-checksum3",
|
|
104
|
+
name: "stubbedConfig3",
|
|
105
|
+
mapSelectionMode: CustomConfigMapSelectionMode.DELTA,
|
|
106
|
+
assignedMaps: ["test3.cc.json"],
|
|
107
|
+
stateSettings: {}
|
|
108
|
+
} as CustomConfig
|
|
109
|
+
|
|
110
|
+
const localStorageCustomConfigs: LocalStorageCustomConfigs = {
|
|
111
|
+
version: "1.0.0",
|
|
112
|
+
customConfigs: [
|
|
113
|
+
[customConfigStub1.id, customConfigStub1],
|
|
114
|
+
[customConfigStub2.id, customConfigStub2],
|
|
115
|
+
[customConfigStub3.id, customConfigStub3]
|
|
116
|
+
]
|
|
117
|
+
}
|
|
118
|
+
|
|
119
|
+
CustomConfigHelper["customConfigs"].clear()
|
|
120
|
+
JSON["parse"] = jest.fn().mockImplementation(() => {
|
|
121
|
+
return localStorageCustomConfigs
|
|
122
|
+
})
|
|
123
|
+
|
|
124
|
+
const spyOnGetItem = spyOn(Storage.prototype, "getItem")
|
|
125
|
+
const spyOnRemoveItem = spyOn(Storage.prototype, "removeItem")
|
|
126
|
+
const spyOnSetItem = spyOn(Storage.prototype, "setItem")
|
|
127
|
+
const spyOnJSON = spyOn(JSON, "stringify")
|
|
128
|
+
|
|
129
|
+
const loadedCustomConfigs = CustomConfigHelper["loadCustomConfigs"]()
|
|
130
|
+
|
|
131
|
+
expect(spyOnGetItem).toHaveBeenCalledTimes(1)
|
|
132
|
+
expect(spyOnRemoveItem).toHaveBeenCalledTimes(1)
|
|
133
|
+
expect(spyOnSetItem).toHaveBeenCalledTimes(1)
|
|
134
|
+
expect(spyOnJSON).toHaveBeenCalledTimes(1)
|
|
135
|
+
expect(loadedCustomConfigs.size).toBe(3)
|
|
136
|
+
expect(loadedCustomConfigs.get("invalid-md5-checksum1").mapSelectionMode).toBe(CustomConfigMapSelectionMode.MULTIPLE)
|
|
137
|
+
expect(loadedCustomConfigs.get("invalid-md5-checksum2").mapSelectionMode).toBe(CustomConfigMapSelectionMode.MULTIPLE)
|
|
138
|
+
expect(loadedCustomConfigs.get("invalid-md5-checksum3").mapSelectionMode).toBe(CustomConfigMapSelectionMode.DELTA)
|
|
139
|
+
})
|
|
140
|
+
|
|
141
|
+
it("should load Custom Configs from local storage with version 1.0.1 and should not make any changes to them", () => {
|
|
142
|
+
const customConfigStub1 = {
|
|
143
|
+
id: "invalid-md5-checksum1",
|
|
144
|
+
name: "stubbedConfig1",
|
|
145
|
+
mapSelectionMode: CustomConfigMapSelectionMode.MULTIPLE,
|
|
146
|
+
assignedMaps: ["test1.cc.json"],
|
|
147
|
+
stateSettings: {}
|
|
148
|
+
} as CustomConfig
|
|
149
|
+
|
|
150
|
+
const customConfigStub2 = {
|
|
151
|
+
id: "invalid-md5-checksum2",
|
|
152
|
+
name: "stubbedConfig2",
|
|
153
|
+
mapSelectionMode: CustomConfigMapSelectionMode.DELTA,
|
|
154
|
+
assignedMaps: ["test2.cc.json"],
|
|
155
|
+
stateSettings: {}
|
|
156
|
+
} as CustomConfig
|
|
157
|
+
|
|
158
|
+
const localStorageCustomConfigs: LocalStorageCustomConfigs = {
|
|
159
|
+
version: "1.0.1",
|
|
160
|
+
customConfigs: [
|
|
161
|
+
[customConfigStub1.id, customConfigStub1],
|
|
162
|
+
[customConfigStub2.id, customConfigStub2]
|
|
163
|
+
]
|
|
164
|
+
}
|
|
165
|
+
|
|
166
|
+
CustomConfigHelper["customConfigs"].clear()
|
|
167
|
+
JSON["parse"] = jest.fn().mockImplementation(() => {
|
|
168
|
+
return localStorageCustomConfigs
|
|
169
|
+
})
|
|
170
|
+
|
|
171
|
+
const spyOnGetItem = spyOn(Storage.prototype, "getItem")
|
|
172
|
+
const spyOnRemoveItem = spyOn(Storage.prototype, "removeItem")
|
|
173
|
+
const spyOnSetItem = spyOn(Storage.prototype, "setItem")
|
|
174
|
+
|
|
175
|
+
const loadedCustomConfigs = CustomConfigHelper["loadCustomConfigs"]()
|
|
176
|
+
|
|
177
|
+
expect(spyOnGetItem).toHaveBeenCalledTimes(1)
|
|
178
|
+
expect(spyOnRemoveItem).toHaveBeenCalledTimes(0)
|
|
179
|
+
expect(spyOnSetItem).toHaveBeenCalledTimes(0)
|
|
180
|
+
expect(loadedCustomConfigs.size).toBe(2)
|
|
181
|
+
expect(loadedCustomConfigs.get("invalid-md5-checksum1").mapSelectionMode).toBe(CustomConfigMapSelectionMode.MULTIPLE)
|
|
182
|
+
expect(loadedCustomConfigs.get("invalid-md5-checksum2").mapSelectionMode).toBe(CustomConfigMapSelectionMode.DELTA)
|
|
183
|
+
})
|
|
84
184
|
})
|
|
85
185
|
|
|
86
186
|
describe("getCustomConfigsAmountByMapAndMode", () => {
|
|
@@ -88,7 +188,7 @@ describe("CustomConfigHelper", () => {
|
|
|
88
188
|
const customConfigStub1 = {
|
|
89
189
|
id: "1-invalid-md5-checksum",
|
|
90
190
|
name: "stubbedConfig3",
|
|
91
|
-
mapSelectionMode: CustomConfigMapSelectionMode.
|
|
191
|
+
mapSelectionMode: CustomConfigMapSelectionMode.MULTIPLE,
|
|
92
192
|
assignedMaps: ["testy.cc.json"],
|
|
93
193
|
mapChecksum: "123",
|
|
94
194
|
customConfigVersion: "1",
|
|
@@ -97,7 +197,7 @@ describe("CustomConfigHelper", () => {
|
|
|
97
197
|
const customConfigStub2 = {
|
|
98
198
|
id: "2-invalid-md5-checksum",
|
|
99
199
|
name: "stubbedConfig4",
|
|
100
|
-
mapSelectionMode: CustomConfigMapSelectionMode.
|
|
200
|
+
mapSelectionMode: CustomConfigMapSelectionMode.MULTIPLE,
|
|
101
201
|
assignedMaps: ["testy.cc.json"],
|
|
102
202
|
mapChecksum: "123",
|
|
103
203
|
customConfigVersion: "1",
|
|
@@ -106,7 +206,7 @@ describe("CustomConfigHelper", () => {
|
|
|
106
206
|
const customConfigStub3 = {
|
|
107
207
|
id: "3-invalid-md5-checksum",
|
|
108
208
|
name: "stubbedConfig5",
|
|
109
|
-
mapSelectionMode: CustomConfigMapSelectionMode.
|
|
209
|
+
mapSelectionMode: CustomConfigMapSelectionMode.MULTIPLE,
|
|
110
210
|
assignedMaps: ["another.cc.json"],
|
|
111
211
|
mapChecksum: "123",
|
|
112
212
|
customConfigVersion: "1",
|
|
@@ -130,19 +230,19 @@ describe("CustomConfigHelper", () => {
|
|
|
130
230
|
expect(
|
|
131
231
|
CustomConfigHelper.getCustomConfigsAmountByMapAndMode(
|
|
132
232
|
customConfigStub1.assignedMaps.join(" "),
|
|
133
|
-
CustomConfigMapSelectionMode.
|
|
233
|
+
CustomConfigMapSelectionMode.MULTIPLE
|
|
134
234
|
)
|
|
135
235
|
).toBe(2)
|
|
136
236
|
expect(
|
|
137
237
|
CustomConfigHelper.getCustomConfigsAmountByMapAndMode(
|
|
138
238
|
customConfigStub3.assignedMaps.join(" "),
|
|
139
|
-
CustomConfigMapSelectionMode.
|
|
239
|
+
CustomConfigMapSelectionMode.MULTIPLE
|
|
140
240
|
)
|
|
141
241
|
).toBe(1)
|
|
142
242
|
expect(
|
|
143
243
|
CustomConfigHelper.getCustomConfigsAmountByMapAndMode(
|
|
144
244
|
customConfigStub4.assignedMaps.join(" "),
|
|
145
|
-
CustomConfigMapSelectionMode.
|
|
245
|
+
CustomConfigMapSelectionMode.MULTIPLE
|
|
146
246
|
)
|
|
147
247
|
).toBe(1)
|
|
148
248
|
expect(
|
|
@@ -155,33 +255,6 @@ describe("CustomConfigHelper", () => {
|
|
|
155
255
|
})
|
|
156
256
|
|
|
157
257
|
describe("getConfigNameSuggestion", () => {
|
|
158
|
-
it("should return the right CustomConfig name suggestion for SINGLE mode", () => {
|
|
159
|
-
const customConfigStub1 = {
|
|
160
|
-
id: "invalid-md5-checksum",
|
|
161
|
-
name: "stubbedConfig7",
|
|
162
|
-
mapSelectionMode: CustomConfigMapSelectionMode.SINGLE,
|
|
163
|
-
assignedMaps: ["testy.cc.json"],
|
|
164
|
-
mapChecksum: "123",
|
|
165
|
-
customConfigVersion: "1",
|
|
166
|
-
stateSettings: {}
|
|
167
|
-
} as CustomConfig
|
|
168
|
-
|
|
169
|
-
jest.mock("../ui/customConfigs/customConfigFileStateConnector")
|
|
170
|
-
|
|
171
|
-
const getJointMapNameMock = jest.fn()
|
|
172
|
-
getJointMapNameMock.mockReturnValue(customConfigStub1.assignedMaps.join(" "))
|
|
173
|
-
|
|
174
|
-
CustomConfigFileStateConnector.prototype.getJointMapName = getJointMapNameMock
|
|
175
|
-
CustomConfigFileStateConnector.prototype.getMapSelectionMode = jest.fn().mockReturnValue(CustomConfigMapSelectionMode.SINGLE)
|
|
176
|
-
|
|
177
|
-
// Reset customConfigs in CustomConfigHelper
|
|
178
|
-
CustomConfigHelper["customConfigs"].clear()
|
|
179
|
-
expect(CustomConfigHelper.getConfigNameSuggestionByFileState(CustomConfigFileStateConnector.prototype)).toBe("testy.cc.json #1")
|
|
180
|
-
|
|
181
|
-
CustomConfigHelper["customConfigs"].set(customConfigStub1.id, customConfigStub1)
|
|
182
|
-
expect(CustomConfigHelper.getConfigNameSuggestionByFileState(CustomConfigFileStateConnector.prototype)).toBe("testy.cc.json #2")
|
|
183
|
-
})
|
|
184
|
-
|
|
185
258
|
it("should return the right CustomConfig name suggestion for MULTIPLE mode", () => {
|
|
186
259
|
const customConfigStub1 = {
|
|
187
260
|
id: "invalid-md5-checksum",
|
|
@@ -262,7 +335,7 @@ describe("CustomConfigHelper", () => {
|
|
|
262
335
|
const customConfigStub1 = {
|
|
263
336
|
id: "invalid-md5-checksum",
|
|
264
337
|
name: "stubbedConfig10",
|
|
265
|
-
mapSelectionMode: CustomConfigMapSelectionMode.
|
|
338
|
+
mapSelectionMode: CustomConfigMapSelectionMode.MULTIPLE,
|
|
266
339
|
assignedMaps: ["testy.cc.json"],
|
|
267
340
|
mapChecksum: "123",
|
|
268
341
|
customConfigVersion: "1",
|
|
@@ -309,15 +382,6 @@ describe("CustomConfigHelper", () => {
|
|
|
309
382
|
describe("sortCustomConfigDropDownList", () => {
|
|
310
383
|
it("should put applicable CustomConfigs Group at the beginning of the list and sort by mode afterwards", () => {
|
|
311
384
|
const customConfigItemGroups = new Map<string, CustomConfigItemGroup>([
|
|
312
|
-
[
|
|
313
|
-
"notApplicableSingle",
|
|
314
|
-
{
|
|
315
|
-
mapNames: "notApplicableSingle.cc.json",
|
|
316
|
-
mapSelectionMode: CustomConfigMapSelectionMode.SINGLE,
|
|
317
|
-
hasApplicableItems: false,
|
|
318
|
-
customConfigItems: []
|
|
319
|
-
}
|
|
320
|
-
],
|
|
321
385
|
[
|
|
322
386
|
"applicableMultiple",
|
|
323
387
|
{
|
|
@@ -363,7 +427,6 @@ describe("CustomConfigHelper", () => {
|
|
|
363
427
|
expect(customConfigItemGroupsDropDown[1].mapNames).toBe("notApplicableDelta.cc.json")
|
|
364
428
|
expect(customConfigItemGroupsDropDown[2].mapNames).toBe("notApplicableDelta2.cc.json notApplicableDelta2.1.cc.json")
|
|
365
429
|
expect(customConfigItemGroupsDropDown[3].mapNames).toBe("notApplicableMultiple1.cc.json notApplicableMultiple2.cc.json")
|
|
366
|
-
expect(customConfigItemGroupsDropDown[4].mapNames).toBe("notApplicableSingle.cc.json")
|
|
367
430
|
})
|
|
368
431
|
})
|
|
369
432
|
|
|
@@ -372,7 +435,7 @@ describe("CustomConfigHelper", () => {
|
|
|
372
435
|
const customConfigStub1 = {
|
|
373
436
|
id: "1-invalid-md5-checksum",
|
|
374
437
|
name: "config1",
|
|
375
|
-
mapSelectionMode: CustomConfigMapSelectionMode.
|
|
438
|
+
mapSelectionMode: CustomConfigMapSelectionMode.MULTIPLE,
|
|
376
439
|
assignedMaps: ["mocky.cc.json"],
|
|
377
440
|
mapChecksum: "123",
|
|
378
441
|
customConfigVersion: "1",
|
|
@@ -406,7 +469,7 @@ describe("CustomConfigHelper", () => {
|
|
|
406
469
|
|
|
407
470
|
const getMapSelectionModeMock = jest.fn()
|
|
408
471
|
getMapSelectionModeMock
|
|
409
|
-
.mockReturnValueOnce(CustomConfigMapSelectionMode.
|
|
472
|
+
.mockReturnValueOnce(CustomConfigMapSelectionMode.MULTIPLE)
|
|
410
473
|
.mockReturnValueOnce(CustomConfigMapSelectionMode.DELTA)
|
|
411
474
|
|
|
412
475
|
CustomConfigFileStateConnector.prototype.getJointMapName = getJointMapNameMock
|
|
@@ -415,7 +478,7 @@ describe("CustomConfigHelper", () => {
|
|
|
415
478
|
|
|
416
479
|
const customConfigItemGroups = CustomConfigHelper.getCustomConfigItemGroups(CustomConfigFileStateConnector.prototype)
|
|
417
480
|
|
|
418
|
-
const singleGroup = customConfigItemGroups.get("mocky.cc.
|
|
481
|
+
const singleGroup = customConfigItemGroups.get("mocky.cc.json_MULTIPLE")
|
|
419
482
|
expect(singleGroup.hasApplicableItems).toBe(true)
|
|
420
483
|
expect(singleGroup.customConfigItems[0].name).toBe("config1")
|
|
421
484
|
expect(singleGroup.customConfigItems[0].isApplicable).toBe(true)
|
|
@@ -429,7 +492,7 @@ describe("CustomConfigHelper", () => {
|
|
|
429
492
|
const customConfigStub1 = {
|
|
430
493
|
id: "1-invalid-md5-checksum",
|
|
431
494
|
name: "config1",
|
|
432
|
-
mapSelectionMode: CustomConfigMapSelectionMode.
|
|
495
|
+
mapSelectionMode: CustomConfigMapSelectionMode.MULTIPLE,
|
|
433
496
|
assignedMaps: ["mocky.cc.json"],
|
|
434
497
|
mapChecksum: "123",
|
|
435
498
|
customConfigVersion: "1",
|
|
@@ -438,7 +501,7 @@ describe("CustomConfigHelper", () => {
|
|
|
438
501
|
const customConfigStub2 = {
|
|
439
502
|
id: "2-invalid-md5-checksum",
|
|
440
503
|
name: "config2",
|
|
441
|
-
mapSelectionMode: CustomConfigMapSelectionMode.
|
|
504
|
+
mapSelectionMode: CustomConfigMapSelectionMode.MULTIPLE,
|
|
442
505
|
assignedMaps: ["another.mocky.cc.json"],
|
|
443
506
|
mapChecksum: "1234",
|
|
444
507
|
customConfigVersion: "1",
|
|
@@ -475,9 +538,9 @@ describe("CustomConfigHelper", () => {
|
|
|
475
538
|
|
|
476
539
|
const getMapSelectionModeMock = jest.fn()
|
|
477
540
|
getMapSelectionModeMock
|
|
478
|
-
.mockReturnValueOnce(CustomConfigMapSelectionMode.
|
|
479
|
-
.mockReturnValueOnce(CustomConfigMapSelectionMode.
|
|
480
|
-
.mockReturnValueOnce(CustomConfigMapSelectionMode.
|
|
541
|
+
.mockReturnValueOnce(CustomConfigMapSelectionMode.MULTIPLE)
|
|
542
|
+
.mockReturnValueOnce(CustomConfigMapSelectionMode.MULTIPLE)
|
|
543
|
+
.mockReturnValueOnce(CustomConfigMapSelectionMode.MULTIPLE)
|
|
481
544
|
|
|
482
545
|
CustomConfigFileStateConnector.prototype.getJointMapName = getJointMapNameMock
|
|
483
546
|
CustomConfigFileStateConnector.prototype.getChecksumOfAssignedMaps = getChecksumOfAssignedMapsMock
|
|
@@ -485,11 +548,11 @@ describe("CustomConfigHelper", () => {
|
|
|
485
548
|
|
|
486
549
|
const customConfigItemGroups = CustomConfigHelper.getCustomConfigItemGroups(CustomConfigFileStateConnector.prototype)
|
|
487
550
|
|
|
488
|
-
const singleGroup = customConfigItemGroups.get("mocky.cc.
|
|
551
|
+
const singleGroup = customConfigItemGroups.get("mocky.cc.json_MULTIPLE")
|
|
489
552
|
expect(singleGroup.customConfigItems[0].name).toBe("config1")
|
|
490
553
|
expect(singleGroup.customConfigItems[0].isApplicable).toBe(false)
|
|
491
554
|
|
|
492
|
-
const anotherSingleGroup = customConfigItemGroups.get("another.mocky.cc.
|
|
555
|
+
const anotherSingleGroup = customConfigItemGroups.get("another.mocky.cc.json_MULTIPLE")
|
|
493
556
|
expect(anotherSingleGroup.customConfigItems[0].name).toBe("config2")
|
|
494
557
|
expect(anotherSingleGroup.customConfigItems[0].isApplicable).toBe(false)
|
|
495
558
|
|
|
@@ -500,11 +563,42 @@ describe("CustomConfigHelper", () => {
|
|
|
500
563
|
})
|
|
501
564
|
|
|
502
565
|
describe("importCustomConfigs", () => {
|
|
566
|
+
it("should import Configs in SINGLE Mode and change mode to MULTIPLE", () => {
|
|
567
|
+
const configStub = {
|
|
568
|
+
id: "invalid-md5-checksum",
|
|
569
|
+
name: "to-be-imported",
|
|
570
|
+
mapSelectionMode: CustomConfigMapSelectionMode.SINGLE,
|
|
571
|
+
assignedMaps: ["exampleMap1.cc.json", "exampleMap2cc.json"]
|
|
572
|
+
} as ExportCustomConfig
|
|
573
|
+
|
|
574
|
+
const exportedCustomConfigs: Map<string, ExportCustomConfig> = new Map()
|
|
575
|
+
exportedCustomConfigs.set(configStub.id, configStub)
|
|
576
|
+
|
|
577
|
+
const mockedDownloadFile: CustomConfigsDownloadFile = {
|
|
578
|
+
downloadApiVersion: "",
|
|
579
|
+
timestamp: 0,
|
|
580
|
+
customConfigs: exportedCustomConfigs
|
|
581
|
+
}
|
|
582
|
+
|
|
583
|
+
spyOn(JSON, "parse")
|
|
584
|
+
JSON["parse"] = jest.fn().mockReturnValue(mockedDownloadFile)
|
|
585
|
+
|
|
586
|
+
// Mock first config to be already existent
|
|
587
|
+
CustomConfigHelper["customConfigs"].clear()
|
|
588
|
+
CustomConfigHelper.importCustomConfigs("not-relevant-json-string-due-to-mocking")
|
|
589
|
+
const customConfigs = CustomConfigHelper.getCustomConfigs()
|
|
590
|
+
|
|
591
|
+
expect(customConfigs.size).toBe(1)
|
|
592
|
+
expect(customConfigs.has(configStub.id)).toBeTruthy()
|
|
593
|
+
expect(customConfigs.get(configStub.id).name).toBe(configStub.name)
|
|
594
|
+
expect(customConfigs.get(configStub.id).mapSelectionMode).toBe(CustomConfigMapSelectionMode.MULTIPLE)
|
|
595
|
+
})
|
|
596
|
+
|
|
503
597
|
it("should import not existing Configs and prevent duplicate names, if any", () => {
|
|
504
598
|
const alreadyExistingConfigStub = {
|
|
505
599
|
id: "1-invalid-md5-checksum",
|
|
506
600
|
name: "already-existing-exported-config",
|
|
507
|
-
mapSelectionMode: CustomConfigMapSelectionMode.
|
|
601
|
+
mapSelectionMode: CustomConfigMapSelectionMode.MULTIPLE,
|
|
508
602
|
assignedMaps: ["exampleMap1.cc.json", "exampleMap2cc.json"]
|
|
509
603
|
} as ExportCustomConfig
|
|
510
604
|
|
|
@@ -516,7 +610,7 @@ describe("CustomConfigHelper", () => {
|
|
|
516
610
|
const exportCustomConfigDuplicateName = {
|
|
517
611
|
id: "3-invalid-md5-checksum-imported",
|
|
518
612
|
name: "already-existing-exported-config",
|
|
519
|
-
mapSelectionMode: CustomConfigMapSelectionMode.
|
|
613
|
+
mapSelectionMode: CustomConfigMapSelectionMode.MULTIPLE,
|
|
520
614
|
assignedMaps: ["exampleMap1.cc.json", "exampleMap2cc.json"],
|
|
521
615
|
// Timestamp of 2020-11-20_13-19
|
|
522
616
|
creationTime: 1_605_878_386_493
|
|
@@ -591,16 +685,17 @@ describe("CustomConfigHelper", () => {
|
|
|
591
685
|
)
|
|
592
686
|
})
|
|
593
687
|
})
|
|
688
|
+
|
|
594
689
|
describe("get custom config by name", () => {
|
|
595
690
|
it("should return null when config name is invalid", () => {
|
|
596
|
-
const result = CustomConfigHelper.getCustomConfigByName(CustomConfigMapSelectionMode.
|
|
691
|
+
const result = CustomConfigHelper.getCustomConfigByName(CustomConfigMapSelectionMode.MULTIPLE, [], "invalidConfig")
|
|
597
692
|
expect(result).toEqual(null)
|
|
598
693
|
})
|
|
599
694
|
it("should return custom config", () => {
|
|
600
695
|
const customConfigStub = {
|
|
601
696
|
id: "invalid-md5-checksum",
|
|
602
697
|
name: "stubbedConfig1",
|
|
603
|
-
mapSelectionMode: CustomConfigMapSelectionMode.
|
|
698
|
+
mapSelectionMode: CustomConfigMapSelectionMode.MULTIPLE,
|
|
604
699
|
assignedMaps: ["test.cc.json"],
|
|
605
700
|
stateSettings: {}
|
|
606
701
|
} as CustomConfig
|
|
@@ -22,8 +22,8 @@ import { ThreeOrbitControlsService } from "../ui/codeMap/threeViewer/threeOrbitC
|
|
|
22
22
|
import { CodeChartaStorage } from "./codeChartaStorage"
|
|
23
23
|
|
|
24
24
|
export const CUSTOM_CONFIG_FILE_EXTENSION = ".cc.config.json"
|
|
25
|
-
const CUSTOM_CONFIGS_LOCAL_STORAGE_VERSION = "1.0.
|
|
26
|
-
const CUSTOM_CONFIGS_DOWNLOAD_FILE_VERSION = "1.0.
|
|
25
|
+
const CUSTOM_CONFIGS_LOCAL_STORAGE_VERSION = "1.0.1"
|
|
26
|
+
const CUSTOM_CONFIGS_DOWNLOAD_FILE_VERSION = "1.0.1"
|
|
27
27
|
export const CUSTOM_CONFIGS_LOCAL_STORAGE_ELEMENT = "CodeCharta::customConfigs"
|
|
28
28
|
|
|
29
29
|
export class CustomConfigHelper {
|
|
@@ -90,11 +90,36 @@ export class CustomConfigHelper {
|
|
|
90
90
|
}
|
|
91
91
|
|
|
92
92
|
private static loadCustomConfigs() {
|
|
93
|
+
const ccLocalStorage = this.getCcLocalStorage()
|
|
94
|
+
return new Map(ccLocalStorage?.customConfigs)
|
|
95
|
+
}
|
|
96
|
+
|
|
97
|
+
// TODO [2022-08-01]: remove replace method for SINGLE mode when deadline is reached
|
|
98
|
+
private static getCcLocalStorage() {
|
|
93
99
|
const ccLocalStorage: LocalStorageCustomConfigs = JSON.parse(
|
|
94
100
|
CustomConfigHelper.getStorage().getItem(CUSTOM_CONFIGS_LOCAL_STORAGE_ELEMENT),
|
|
95
101
|
stateObjectReviver
|
|
96
102
|
)
|
|
97
|
-
|
|
103
|
+
if (ccLocalStorage?.version === "1.0.0") {
|
|
104
|
+
return this.replaceSingleModeInLocalStorage(ccLocalStorage)
|
|
105
|
+
}
|
|
106
|
+
|
|
107
|
+
return ccLocalStorage
|
|
108
|
+
}
|
|
109
|
+
|
|
110
|
+
// TODO [2022-08-01]: remove replace method for SINGLE mode when deadline is reached
|
|
111
|
+
private static replaceSingleModeInLocalStorage(ccLocalStorage: LocalStorageCustomConfigs) {
|
|
112
|
+
for (const [, customConfig] of ccLocalStorage?.customConfigs.values() ?? []) {
|
|
113
|
+
if (customConfig.mapSelectionMode === "SINGLE") {
|
|
114
|
+
customConfig.mapSelectionMode = CustomConfigMapSelectionMode.MULTIPLE
|
|
115
|
+
}
|
|
116
|
+
}
|
|
117
|
+
|
|
118
|
+
ccLocalStorage.version = CUSTOM_CONFIGS_LOCAL_STORAGE_VERSION
|
|
119
|
+
CustomConfigHelper.getStorage().removeItem(CUSTOM_CONFIGS_LOCAL_STORAGE_ELEMENT)
|
|
120
|
+
CustomConfigHelper.getStorage().setItem(CUSTOM_CONFIGS_LOCAL_STORAGE_ELEMENT, JSON.stringify(ccLocalStorage, stateObjectReviver))
|
|
121
|
+
|
|
122
|
+
return ccLocalStorage
|
|
98
123
|
}
|
|
99
124
|
|
|
100
125
|
static addCustomConfigs(newCustomConfigs: CustomConfig[]) {
|
|
@@ -153,6 +178,11 @@ export class CustomConfigHelper {
|
|
|
153
178
|
const importedCustomConfigsFile: CustomConfigsDownloadFile = JSON.parse(content, stateObjectReviver)
|
|
154
179
|
|
|
155
180
|
for (const exportedConfig of importedCustomConfigsFile.customConfigs.values()) {
|
|
181
|
+
// TODO [2022-08-01]: remove condition for SINGLE mode when deadline is reached
|
|
182
|
+
if (exportedConfig.mapSelectionMode === "SINGLE") {
|
|
183
|
+
exportedConfig.mapSelectionMode = CustomConfigMapSelectionMode.MULTIPLE
|
|
184
|
+
}
|
|
185
|
+
|
|
156
186
|
const alreadyExistingConfig = CustomConfigHelper.getCustomConfigSettings(exportedConfig.id)
|
|
157
187
|
|
|
158
188
|
// Check for a duplicate Config by matching checksums
|
|
@@ -1818,7 +1818,8 @@ export const STATE: State = {
|
|
|
1818
1818
|
},
|
|
1819
1819
|
appStatus: {
|
|
1820
1820
|
hoveredBuildingPath: null,
|
|
1821
|
-
selectedBuildingId: null
|
|
1821
|
+
selectedBuildingId: null,
|
|
1822
|
+
rightClickedNodeData: null
|
|
1822
1823
|
}
|
|
1823
1824
|
}
|
|
1824
1825
|
|
|
@@ -1901,7 +1902,8 @@ export const DEFAULT_STATE: State = {
|
|
|
1901
1902
|
},
|
|
1902
1903
|
appStatus: {
|
|
1903
1904
|
hoveredBuildingPath: null,
|
|
1904
|
-
selectedBuildingId: null
|
|
1905
|
+
selectedBuildingId: null,
|
|
1906
|
+
rightClickedNodeData: null
|
|
1905
1907
|
}
|
|
1906
1908
|
}
|
|
1907
1909
|
|