codecharta-visualization 1.89.0 → 1.90.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 +16 -2
- package/app/codeCharta/assets/gameObjectsFile.json +75 -0
- package/app/codeCharta/codeCharta.model.ts +1 -10
- package/app/codeCharta/services/idToBuilding/idToBuilding.service.ts +17 -0
- package/app/codeCharta/state/effects/nodeContextMenu/highlightButtons/highlightButtons.component.spec.ts +14 -23
- package/app/codeCharta/state/effects/nodeContextMenu/highlightButtons/highlightButtons.component.ts +7 -5
- package/app/codeCharta/state/effects/nodeContextMenu/nodeContextMenuCard/nodeContextMenuCard.component.spec.ts +3 -1
- package/app/codeCharta/state/effects/nodeContextMenu/rightClickedCodeMapNode.selector.ts +1 -1
- package/app/codeCharta/state/effects/trackEventUsageData/trackEventUsageData.effect.spec.ts +56 -0
- package/app/codeCharta/state/effects/trackEventUsageData/trackEventUsageData.effect.ts +49 -0
- package/app/codeCharta/state/effects/unfocusNodesOnLoadingMap.effect.ts +2 -1
- package/app/codeCharta/state/injector.service.ts +0 -4
- package/app/codeCharta/state/selectors/accumulatedData/idToNode.selector.spec.ts +15 -0
- package/app/codeCharta/state/selectors/accumulatedData/idToNode.selector.ts +16 -0
- package/app/codeCharta/state/selectors/selectedNode.selector.ts +5 -2
- package/app/codeCharta/state/state.module.ts +0 -4
- package/app/codeCharta/state/store/appSettings/isLoadingMap/isLoadingMap.reducer.ts +1 -5
- package/app/codeCharta/state/store/state.actions.ts +0 -2
- package/app/codeCharta/state/store/state.reducer.ts +0 -2
- package/app/codeCharta/state/store/state.splitter.ts +0 -10
- package/app/codeCharta/state/store.service.ts +0 -16
- package/app/codeCharta/ui/attributeSideBar/attributeSideBar.component.spec.ts +5 -1
- package/app/codeCharta/ui/attributeSideBar/attributeSideBar.component.ts +2 -2
- package/app/codeCharta/ui/attributeSideBar/attributeSideBarHeaderSection/attributeSideBarHeaderSection.component.html +0 -1
- package/app/codeCharta/ui/attributeSideBar/attributeSideBarHeaderSection/attributeSideBarHeaderSection.component.spec.ts +3 -45
- package/app/codeCharta/ui/attributeSideBar/attributeSideBarHeaderSection/attributeSideBarHeaderSection.component.ts +2 -8
- package/app/codeCharta/ui/attributeSideBar/attributeSideBarHeaderSection/nodePath/nodePath.component.html +1 -1
- package/app/codeCharta/ui/attributeSideBar/attributeSideBarHeaderSection/nodePath/nodePath.component.spec.ts +3 -2
- package/app/codeCharta/ui/attributeSideBar/attributeSideBarHeaderSection/nodePath/nodePath.component.ts +2 -2
- package/app/codeCharta/ui/attributeSideBar/attributeSideBarSecondaryMetrics/secondaryMetrics.selector.ts +2 -2
- package/app/codeCharta/ui/attributeSideBar/metricDeltaSelected/metricDeltaSelected.component.spec.ts +26 -23
- package/app/codeCharta/ui/attributeSideBar/metricDeltaSelected/metricDeltaSelected.component.ts +2 -2
- package/app/codeCharta/ui/attributeSideBar/util/showAttributeTypeSelector.selector.spec.ts +2 -2
- package/app/codeCharta/ui/attributeSideBar/util/showAttributeTypeSelector.selector.ts +2 -2
- package/app/codeCharta/ui/codeMap/codeMap.mouseEvent.service.spec.ts +28 -45
- package/app/codeCharta/ui/codeMap/codeMap.mouseEvent.service.ts +7 -11
- package/app/codeCharta/ui/codeMap/codeMap.preRender.service.ts +4 -46
- package/app/codeCharta/ui/codeMap/threeViewer/threeSceneService.spec.ts +26 -19
- package/app/codeCharta/ui/codeMap/threeViewer/threeSceneService.ts +13 -25
- package/app/codeCharta/ui/codeMap/threeViewer/threeViewer.module.ts +3 -0
- package/app/codeCharta/ui/dialog/dialog.globalSettings.component.ts +3 -5
- package/app/codeCharta/ui/dialog/dialog.globalSettings.e2e.ts +1 -1
- package/app/codeCharta/ui/fileChooser/fileChooser.component.spec.ts +1 -0
- package/app/codeCharta/ui/fileChooser/fileChooser.component.ts +6 -1
- package/app/codeCharta/ui/fileChooser/fileChooser.e2e.ts +5 -0
- package/app/codeCharta/ui/filePanel/filePanel.component.html +1 -0
- package/app/codeCharta/ui/filePanel/filePanel.component.spec.ts +7 -0
- package/app/codeCharta/ui/filePanel/filePanel.component.ts +1 -2
- package/app/codeCharta/ui/filePanel/filePanel.module.ts +2 -0
- package/app/codeCharta/ui/filePanel/filePanelFileSelector/filePanelFileSelector.component.html +7 -1
- package/app/codeCharta/ui/filePanel/filePanelFileSelector/filePanelFileSelector.component.scss +6 -0
- package/app/codeCharta/ui/filePanel/filePanelFileSelector/filePanelFileSelector.component.ts +2 -1
- package/app/codeCharta/ui/filePanel/filePanelFileSelector/removeFileButton/removeFileButton.component.html +3 -0
- package/app/codeCharta/ui/filePanel/filePanelFileSelector/removeFileButton/removeFileButton.component.scss +9 -0
- package/app/codeCharta/ui/filePanel/filePanelFileSelector/removeFileButton/removeFileButton.component.ts +11 -0
- package/app/codeCharta/ui/rangeSlider/rangeSlider.component.ts +9 -33
- package/app/codeCharta/util/__snapshots__/usageDataTracker.spec.ts.snap +1 -16
- package/app/codeCharta/util/codeMapHelper.ts +3 -2
- package/app/codeCharta/util/customConfigHelper.ts +4 -16
- package/app/codeCharta/util/dataMocks.ts +0 -8
- package/app/codeCharta/util/envDetector.ts +0 -4
- package/app/codeCharta/util/gameObjectsParser/__snapshots__/gameObjectsImporter.spec.ts.snap +121 -0
- package/app/codeCharta/util/gameObjectsParser/gameObjectsImporter.spec.ts +11 -0
- package/app/codeCharta/util/gameObjectsParser/gameObjectsImporter.ts +170 -0
- package/app/codeCharta/util/gameObjectsParser/gameObjectsMocks.ts +75 -0
- package/app/codeCharta/util/gameObjectsParser/gameObjectsSchema.json +271 -0
- package/app/codeCharta/util/gameObjectsParser/gameObjectsValidator.spec.ts +18 -0
- package/app/codeCharta/util/gameObjectsParser/gameObjectsValidator.ts +7 -0
- package/app/codeCharta/util/nodeDecorator.ts +1 -0
- package/app/codeCharta/util/usageDataTracker.spec.ts +36 -76
- package/app/codeCharta/util/usageDataTracker.ts +20 -31
- package/conf/webpack.config.js +7 -7
- package/dist/webpack/bundle.js +871 -1260
- package/dist/webpack/bundle.js.map +1 -1
- package/package.json +10 -11
- package/app/codeCharta/state/selectors/selectedBuilding.selector.ts +0 -8
- package/app/codeCharta/state/store/lookUp/idToBuilding/idToBuilding.actions.ts +0 -22
- package/app/codeCharta/state/store/lookUp/idToBuilding/idToBuilding.reducer.spec.ts +0 -33
- package/app/codeCharta/state/store/lookUp/idToBuilding/idToBuilding.reducer.ts +0 -14
- package/app/codeCharta/state/store/lookUp/idToBuilding/idToBuilding.selector.ts +0 -3
- package/app/codeCharta/state/store/lookUp/idToBuilding/idToBuilding.service.spec.ts +0 -40
- package/app/codeCharta/state/store/lookUp/idToBuilding/idToBuilding.service.ts +0 -23
- package/app/codeCharta/state/store/lookUp/idToBuilding/idToBuilding.splitter.ts +0 -6
- package/app/codeCharta/state/store/lookUp/idToNode/idToNode.actions.ts +0 -22
- package/app/codeCharta/state/store/lookUp/idToNode/idToNode.reducer.spec.ts +0 -39
- package/app/codeCharta/state/store/lookUp/idToNode/idToNode.reducer.ts +0 -11
- package/app/codeCharta/state/store/lookUp/idToNode/idToNode.selector.ts +0 -4
- package/app/codeCharta/state/store/lookUp/idToNode/idToNode.service.spec.ts +0 -57
- package/app/codeCharta/state/store/lookUp/idToNode/idToNode.service.ts +0 -23
- package/app/codeCharta/state/store/lookUp/idToNode/idToNode.splitter.ts +0 -6
- package/app/codeCharta/state/store/lookUp/lookUp.actions.ts +0 -27
- package/app/codeCharta/state/store/lookUp/lookUp.reducer.ts +0 -10
- package/app/codeCharta/state/store/lookUp/lookUp.selector.ts +0 -3
- package/app/codeCharta/state/store/lookUp/lookUp.splitter.ts +0 -19
- package/app/codeCharta/ui/removeFileButton/removeFileButton.component.html +0 -5
- package/app/codeCharta/ui/removeFileButton/removeFileButton.component.scss +0 -41
- package/app/codeCharta/ui/removeFileButton/removeFileButton.component.ts +0 -18
- package/app/codeCharta/ui/removeFileButton/removeFileButton.module.ts +0 -7
- package/app/codeCharta/util/codeChartaFileStorage.spec.ts +0 -73
- package/app/codeCharta/util/codeChartaStorage.ts +0 -62
- package/app/codeCharta/util/lazyLoader.spec.ts +0 -33
- package/app/codeCharta/util/lazyLoader.ts +0 -50
- package/dist/webpack/vendors-node_modules_open_index_js.bundle.js +0 -1036
- package/dist/webpack/vendors-node_modules_open_index_js.bundle.js.map +0 -1
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.90.0",
|
|
14
14
|
"engines": {
|
|
15
15
|
"node": ">=16"
|
|
16
16
|
},
|
|
@@ -39,7 +39,7 @@
|
|
|
39
39
|
},
|
|
40
40
|
"main": "dist/webpack/index.html",
|
|
41
41
|
"build": {
|
|
42
|
-
"nwVersion": "0.
|
|
42
|
+
"nwVersion": "0.61.0",
|
|
43
43
|
"output": "./dist/packages/",
|
|
44
44
|
"outputPattern": "codecharta-visualization-${VERSION}-${PLATFORM}-${ARCH}",
|
|
45
45
|
"files": "./dist/webpack/**/*",
|
|
@@ -64,9 +64,9 @@
|
|
|
64
64
|
],
|
|
65
65
|
"scripts": {
|
|
66
66
|
"start": "nw .",
|
|
67
|
-
"build": "webpack --config ./conf/webpack.config.js --env
|
|
68
|
-
"build:web": "webpack --config ./conf/webpack.config.js --env
|
|
69
|
-
"dev": "webpack serve --config ./conf/webpack.config.js --env
|
|
67
|
+
"build": "webpack --config ./conf/webpack.config.js --env DEV=false",
|
|
68
|
+
"build:web": "webpack --config ./conf/webpack.config.js --env DEV=false",
|
|
69
|
+
"dev": "webpack serve --config ./conf/webpack.config.js --env DEV=true",
|
|
70
70
|
"test": "jest --config ./jest.config.json .*\\.spec\\.ts --env=jsdom",
|
|
71
71
|
"test:auto": "npm test -- --watch",
|
|
72
72
|
"test:autoNoCoverage": "npm run test:auto -- --coverage false",
|
|
@@ -126,8 +126,7 @@
|
|
|
126
126
|
"md5": "^2.3.0",
|
|
127
127
|
"ngx-color": "^7.3.3",
|
|
128
128
|
"nouislider": "^15.0.0",
|
|
129
|
-
"nw": "^0.
|
|
130
|
-
"open": "^8.0.6",
|
|
129
|
+
"nw": "^0.61.0",
|
|
131
130
|
"percent-round": "^2.2.1",
|
|
132
131
|
"redux": "^4.0.5",
|
|
133
132
|
"remark": "^13.0.0",
|
|
@@ -137,7 +136,7 @@
|
|
|
137
136
|
"shelljs": "^0.8.4",
|
|
138
137
|
"three": "^0.126.1",
|
|
139
138
|
"three-orbit-controls": "^82.1.0",
|
|
140
|
-
"typescript-json-schema": "^0.
|
|
139
|
+
"typescript-json-schema": "^0.53.0",
|
|
141
140
|
"zone.js": "^0.11.4"
|
|
142
141
|
},
|
|
143
142
|
"devDependencies": {
|
|
@@ -181,9 +180,9 @@
|
|
|
181
180
|
"lint-staged": "^11.0.0",
|
|
182
181
|
"makeshift": "^1.1.0",
|
|
183
182
|
"node-polyfill-webpack-plugin": "^1.1.4",
|
|
184
|
-
"node-sass": "^
|
|
183
|
+
"node-sass": "^7.0.0",
|
|
185
184
|
"nwjs-builder-phoenix": "^1.15.0",
|
|
186
|
-
"puppeteer": "^
|
|
185
|
+
"puppeteer": "^13.0.0",
|
|
187
186
|
"sass-loader": "^12.0.0",
|
|
188
187
|
"style-loader": "^2.0.0",
|
|
189
188
|
"ts-jest": "^26.5.5",
|
|
@@ -191,7 +190,7 @@
|
|
|
191
190
|
"typescript": "^4.3.5",
|
|
192
191
|
"webpack": "^5.33.2",
|
|
193
192
|
"webpack-cli": "^4.7.2",
|
|
194
|
-
"webpack-dev-server": "^
|
|
193
|
+
"webpack-dev-server": "^4.0.0",
|
|
195
194
|
"webpack-glsl-loader": "^1.0.1"
|
|
196
195
|
},
|
|
197
196
|
"optionalDependencies": {
|
|
@@ -1,8 +0,0 @@
|
|
|
1
|
-
import { createSelector } from "../angular-redux/store"
|
|
2
|
-
import { selectedBuildingIdSelector } from "../store/appStatus/selectedBuildingId/selectedBuildingId.selector"
|
|
3
|
-
import { idToBuildingSelector } from "../store/lookUp/idToBuilding/idToBuilding.selector"
|
|
4
|
-
|
|
5
|
-
export const selectedBuildingSelector = createSelector(
|
|
6
|
-
[selectedBuildingIdSelector, idToBuildingSelector],
|
|
7
|
-
(selectedBuildingId, idToBuilding) => idToBuilding.get(selectedBuildingId)
|
|
8
|
-
)
|
|
@@ -1,22 +0,0 @@
|
|
|
1
|
-
import { Action } from "redux"
|
|
2
|
-
import { CodeMapBuilding } from "../../../../ui/codeMap/rendering/codeMapBuilding"
|
|
3
|
-
|
|
4
|
-
export enum IdToBuildingActions {
|
|
5
|
-
SET_ID_TO_BUILDING = "SET_ID_TO_BUILDING"
|
|
6
|
-
}
|
|
7
|
-
|
|
8
|
-
export interface SetIdToBuildingAction extends Action {
|
|
9
|
-
type: IdToBuildingActions.SET_ID_TO_BUILDING
|
|
10
|
-
payload: Map<number, CodeMapBuilding>
|
|
11
|
-
}
|
|
12
|
-
|
|
13
|
-
export type IdToBuildingAction = SetIdToBuildingAction
|
|
14
|
-
|
|
15
|
-
export function setIdToBuilding(idToBuilding: Map<number, CodeMapBuilding> = defaultIdToBuilding): SetIdToBuildingAction {
|
|
16
|
-
return {
|
|
17
|
-
type: IdToBuildingActions.SET_ID_TO_BUILDING,
|
|
18
|
-
payload: idToBuilding
|
|
19
|
-
}
|
|
20
|
-
}
|
|
21
|
-
|
|
22
|
-
export const defaultIdToBuilding: Map<number, CodeMapBuilding> = new Map()
|
|
@@ -1,33 +0,0 @@
|
|
|
1
|
-
import { idToBuilding } from "./idToBuilding.reducer"
|
|
2
|
-
import { IdToBuildingAction, setIdToBuilding } from "./idToBuilding.actions"
|
|
3
|
-
import { CODE_MAP_BUILDING } from "../../../../util/dataMocks"
|
|
4
|
-
|
|
5
|
-
describe("idToBuilding", () => {
|
|
6
|
-
describe("Default State", () => {
|
|
7
|
-
it("should initialize the default state", () => {
|
|
8
|
-
const result = idToBuilding(undefined, {} as IdToBuildingAction)
|
|
9
|
-
|
|
10
|
-
expect(result).toEqual(new Map())
|
|
11
|
-
})
|
|
12
|
-
})
|
|
13
|
-
|
|
14
|
-
describe("Action: SET_ID_TO_BUILDING", () => {
|
|
15
|
-
it("should set new idToBuilding", () => {
|
|
16
|
-
const map = new Map()
|
|
17
|
-
map.set(CODE_MAP_BUILDING.node.id, CODE_MAP_BUILDING)
|
|
18
|
-
|
|
19
|
-
const result = idToBuilding(new Map(), setIdToBuilding(map))
|
|
20
|
-
|
|
21
|
-
expect(result).toEqual(map)
|
|
22
|
-
})
|
|
23
|
-
|
|
24
|
-
it("should set default idToBuilding", () => {
|
|
25
|
-
const map = new Map()
|
|
26
|
-
map.set(CODE_MAP_BUILDING.node.id, CODE_MAP_BUILDING)
|
|
27
|
-
|
|
28
|
-
const result = idToBuilding(map, setIdToBuilding())
|
|
29
|
-
|
|
30
|
-
expect(result).toEqual(new Map())
|
|
31
|
-
})
|
|
32
|
-
})
|
|
33
|
-
})
|
|
@@ -1,14 +0,0 @@
|
|
|
1
|
-
import { IdToBuildingAction, IdToBuildingActions, setIdToBuilding } from "./idToBuilding.actions"
|
|
2
|
-
import { CodeMapBuilding } from "../../../../ui/codeMap/rendering/codeMapBuilding"
|
|
3
|
-
|
|
4
|
-
export function idToBuilding(
|
|
5
|
-
state: Map<number, CodeMapBuilding> = setIdToBuilding().payload,
|
|
6
|
-
action: IdToBuildingAction
|
|
7
|
-
): Map<number, CodeMapBuilding> {
|
|
8
|
-
switch (action.type) {
|
|
9
|
-
case IdToBuildingActions.SET_ID_TO_BUILDING:
|
|
10
|
-
return new Map(action.payload)
|
|
11
|
-
default:
|
|
12
|
-
return state
|
|
13
|
-
}
|
|
14
|
-
}
|
|
@@ -1,40 +0,0 @@
|
|
|
1
|
-
import "../../../state.module"
|
|
2
|
-
import { IRootScopeService } from "angular"
|
|
3
|
-
import { StoreService } from "../../../store.service"
|
|
4
|
-
import { getService, instantiateModule } from "../../../../../../mocks/ng.mockhelper"
|
|
5
|
-
import { IdToBuildingService } from "./idToBuilding.service"
|
|
6
|
-
import { withMockedEventMethods } from "../../../../util/dataMocks"
|
|
7
|
-
import { ThreeSceneService } from "../../../../ui/codeMap/threeViewer/threeSceneService"
|
|
8
|
-
|
|
9
|
-
describe("IdToBuildingService", () => {
|
|
10
|
-
let idToBuildingService: IdToBuildingService
|
|
11
|
-
let storeService: StoreService
|
|
12
|
-
let $rootScope: IRootScopeService
|
|
13
|
-
|
|
14
|
-
beforeEach(() => {
|
|
15
|
-
restartSystem()
|
|
16
|
-
rebuildService()
|
|
17
|
-
withMockedEventMethods($rootScope)
|
|
18
|
-
})
|
|
19
|
-
|
|
20
|
-
function restartSystem() {
|
|
21
|
-
instantiateModule("app.codeCharta.state")
|
|
22
|
-
|
|
23
|
-
$rootScope = getService<IRootScopeService>("$rootScope")
|
|
24
|
-
storeService = getService<StoreService>("storeService")
|
|
25
|
-
}
|
|
26
|
-
|
|
27
|
-
function rebuildService() {
|
|
28
|
-
idToBuildingService = new IdToBuildingService($rootScope, storeService)
|
|
29
|
-
}
|
|
30
|
-
|
|
31
|
-
describe("constructor", () => {
|
|
32
|
-
it("should subscribe to CodeMapMeshChange", () => {
|
|
33
|
-
ThreeSceneService.subscribeToCodeMapMeshChangedEvent = jest.fn()
|
|
34
|
-
|
|
35
|
-
rebuildService()
|
|
36
|
-
|
|
37
|
-
expect(ThreeSceneService.subscribeToCodeMapMeshChangedEvent).toHaveBeenCalledWith($rootScope, idToBuildingService)
|
|
38
|
-
})
|
|
39
|
-
})
|
|
40
|
-
})
|
|
@@ -1,23 +0,0 @@
|
|
|
1
|
-
import { StoreService } from "../../../store.service"
|
|
2
|
-
import { IRootScopeService } from "angular"
|
|
3
|
-
import { CodeMapBuilding } from "../../../../ui/codeMap/rendering/codeMapBuilding"
|
|
4
|
-
import { CodeMapMeshChangedSubscriber, ThreeSceneService } from "../../../../ui/codeMap/threeViewer/threeSceneService"
|
|
5
|
-
import { CodeMapMesh } from "../../../../ui/codeMap/rendering/codeMapMesh"
|
|
6
|
-
import { setIdToBuilding } from "./idToBuilding.actions"
|
|
7
|
-
|
|
8
|
-
export class IdToBuildingService implements CodeMapMeshChangedSubscriber {
|
|
9
|
-
constructor(private $rootScope: IRootScopeService, private storeService: StoreService) {
|
|
10
|
-
"ngInject"
|
|
11
|
-
ThreeSceneService.subscribeToCodeMapMeshChangedEvent(this.$rootScope, this)
|
|
12
|
-
}
|
|
13
|
-
|
|
14
|
-
onCodeMapMeshChanged(mapMesh: CodeMapMesh) {
|
|
15
|
-
const idToBuilding: Map<number, CodeMapBuilding> = new Map()
|
|
16
|
-
|
|
17
|
-
for (const building of mapMesh.getMeshDescription().buildings) {
|
|
18
|
-
idToBuilding.set(building.node.id, building)
|
|
19
|
-
}
|
|
20
|
-
|
|
21
|
-
this.storeService.dispatch(setIdToBuilding(idToBuilding), { silent: true })
|
|
22
|
-
}
|
|
23
|
-
}
|
|
@@ -1,22 +0,0 @@
|
|
|
1
|
-
import { Action } from "redux"
|
|
2
|
-
import { CodeMapNode } from "../../../../codeCharta.model"
|
|
3
|
-
|
|
4
|
-
export enum IdToNodeActions {
|
|
5
|
-
SET_ID_TO_NODE = "SET_ID_TO_NODE"
|
|
6
|
-
}
|
|
7
|
-
|
|
8
|
-
export interface SetIdToNodeAction extends Action {
|
|
9
|
-
type: IdToNodeActions.SET_ID_TO_NODE
|
|
10
|
-
payload: Map<number, CodeMapNode>
|
|
11
|
-
}
|
|
12
|
-
|
|
13
|
-
export type IdToNodeAction = SetIdToNodeAction
|
|
14
|
-
|
|
15
|
-
export function setIdToNode(idToNode: Map<number, CodeMapNode> = defaultIdToNode): SetIdToNodeAction {
|
|
16
|
-
return {
|
|
17
|
-
type: IdToNodeActions.SET_ID_TO_NODE,
|
|
18
|
-
payload: idToNode
|
|
19
|
-
}
|
|
20
|
-
}
|
|
21
|
-
|
|
22
|
-
export const defaultIdToNode: Map<number, CodeMapNode> = new Map()
|
|
@@ -1,39 +0,0 @@
|
|
|
1
|
-
import { idToNode } from "./idToNode.reducer"
|
|
2
|
-
import { IdToNodeAction, setIdToNode } from "./idToNode.actions"
|
|
3
|
-
import { NodeDecorator } from "../../../../util/nodeDecorator"
|
|
4
|
-
import { TEST_FILE_WITH_PATHS } from "../../../../util/dataMocks"
|
|
5
|
-
import { CodeMapNode } from "../../../../codeCharta.model"
|
|
6
|
-
|
|
7
|
-
describe("idToNode", () => {
|
|
8
|
-
beforeEach(() => {
|
|
9
|
-
NodeDecorator.decorateMapWithPathAttribute(TEST_FILE_WITH_PATHS)
|
|
10
|
-
})
|
|
11
|
-
|
|
12
|
-
describe("Default State", () => {
|
|
13
|
-
it("should initialize the default state", () => {
|
|
14
|
-
const result = idToNode(undefined, {} as IdToNodeAction)
|
|
15
|
-
|
|
16
|
-
expect(result).toEqual(new Map())
|
|
17
|
-
})
|
|
18
|
-
})
|
|
19
|
-
|
|
20
|
-
describe("Action: SET_ID_TO_NODE", () => {
|
|
21
|
-
it("should set new idToNode", () => {
|
|
22
|
-
const map = new Map<number, CodeMapNode>()
|
|
23
|
-
map.set(TEST_FILE_WITH_PATHS.map.id, TEST_FILE_WITH_PATHS.map)
|
|
24
|
-
|
|
25
|
-
const result = idToNode(new Map(), setIdToNode(map))
|
|
26
|
-
|
|
27
|
-
expect(result).toEqual(map)
|
|
28
|
-
})
|
|
29
|
-
|
|
30
|
-
it("should set default idToNode", () => {
|
|
31
|
-
const map = new Map<number, CodeMapNode>()
|
|
32
|
-
map.set(TEST_FILE_WITH_PATHS.map.id, TEST_FILE_WITH_PATHS.map)
|
|
33
|
-
|
|
34
|
-
const result = idToNode(map, setIdToNode())
|
|
35
|
-
|
|
36
|
-
expect(result).toEqual(new Map())
|
|
37
|
-
})
|
|
38
|
-
})
|
|
39
|
-
})
|
|
@@ -1,11 +0,0 @@
|
|
|
1
|
-
import { IdToNodeAction, IdToNodeActions, setIdToNode } from "./idToNode.actions"
|
|
2
|
-
import { CodeMapNode } from "../../../../codeCharta.model"
|
|
3
|
-
|
|
4
|
-
export function idToNode(state: Map<number, CodeMapNode> = setIdToNode().payload, action: IdToNodeAction): Map<number, CodeMapNode> {
|
|
5
|
-
switch (action.type) {
|
|
6
|
-
case IdToNodeActions.SET_ID_TO_NODE:
|
|
7
|
-
return new Map(action.payload)
|
|
8
|
-
default:
|
|
9
|
-
return state
|
|
10
|
-
}
|
|
11
|
-
}
|
|
@@ -1,57 +0,0 @@
|
|
|
1
|
-
import "../../../state.module"
|
|
2
|
-
import { IRootScopeService } from "angular"
|
|
3
|
-
import { StoreService } from "../../../store.service"
|
|
4
|
-
import { getService, instantiateModule } from "../../../../../../mocks/ng.mockhelper"
|
|
5
|
-
import { IdToNodeService } from "./idToNode.service"
|
|
6
|
-
import { TEST_FILE_WITH_PATHS, withMockedEventMethods } from "../../../../util/dataMocks"
|
|
7
|
-
import { NodeDecorator } from "../../../../util/nodeDecorator"
|
|
8
|
-
import { CodeMapPreRenderService } from "../../../../ui/codeMap/codeMap.preRender.service"
|
|
9
|
-
|
|
10
|
-
describe("IdToNodeService", () => {
|
|
11
|
-
let idToNodeService: IdToNodeService
|
|
12
|
-
let storeService: StoreService
|
|
13
|
-
let $rootScope: IRootScopeService
|
|
14
|
-
|
|
15
|
-
beforeEach(() => {
|
|
16
|
-
restartSystem()
|
|
17
|
-
rebuildService()
|
|
18
|
-
withMockedEventMethods($rootScope)
|
|
19
|
-
NodeDecorator.decorateMap(
|
|
20
|
-
TEST_FILE_WITH_PATHS.map,
|
|
21
|
-
{
|
|
22
|
-
nodeMetricData: [],
|
|
23
|
-
edgeMetricData: []
|
|
24
|
-
},
|
|
25
|
-
[]
|
|
26
|
-
)
|
|
27
|
-
})
|
|
28
|
-
|
|
29
|
-
function restartSystem() {
|
|
30
|
-
instantiateModule("app.codeCharta.state")
|
|
31
|
-
|
|
32
|
-
$rootScope = getService<IRootScopeService>("$rootScope")
|
|
33
|
-
storeService = getService<StoreService>("storeService")
|
|
34
|
-
}
|
|
35
|
-
|
|
36
|
-
function rebuildService() {
|
|
37
|
-
idToNodeService = new IdToNodeService($rootScope, storeService)
|
|
38
|
-
}
|
|
39
|
-
|
|
40
|
-
describe("constructor", () => {
|
|
41
|
-
it("should subscribe to renderMapChange", () => {
|
|
42
|
-
CodeMapPreRenderService.subscribe = jest.fn()
|
|
43
|
-
|
|
44
|
-
rebuildService()
|
|
45
|
-
|
|
46
|
-
expect(CodeMapPreRenderService.subscribe).toHaveBeenCalledWith($rootScope, idToNodeService)
|
|
47
|
-
})
|
|
48
|
-
})
|
|
49
|
-
|
|
50
|
-
describe("onRenderMapChanged", () => {
|
|
51
|
-
it("should update the map", () => {
|
|
52
|
-
idToNodeService.onRenderMapChanged(TEST_FILE_WITH_PATHS.map)
|
|
53
|
-
|
|
54
|
-
expect(storeService.getState().lookUp.idToNode.size).toBe(6)
|
|
55
|
-
})
|
|
56
|
-
})
|
|
57
|
-
})
|
|
@@ -1,23 +0,0 @@
|
|
|
1
|
-
import { StoreService } from "../../../store.service"
|
|
2
|
-
import { IRootScopeService } from "angular"
|
|
3
|
-
import { CodeMapPreRenderService, CodeMapPreRenderServiceSubscriber } from "../../../../ui/codeMap/codeMap.preRender.service"
|
|
4
|
-
import { CodeMapNode } from "../../../../codeCharta.model"
|
|
5
|
-
import { hierarchy } from "d3-hierarchy"
|
|
6
|
-
import { setIdToNode } from "./idToNode.actions"
|
|
7
|
-
|
|
8
|
-
export class IdToNodeService implements CodeMapPreRenderServiceSubscriber {
|
|
9
|
-
constructor(private $rootScope: IRootScopeService, private storeService: StoreService) {
|
|
10
|
-
"ngInject"
|
|
11
|
-
CodeMapPreRenderService.subscribe(this.$rootScope, this)
|
|
12
|
-
}
|
|
13
|
-
|
|
14
|
-
onRenderMapChanged(map: CodeMapNode) {
|
|
15
|
-
const idToNode: Map<number, CodeMapNode> = new Map([[map.id, map]])
|
|
16
|
-
|
|
17
|
-
for (const { data } of hierarchy(map)) {
|
|
18
|
-
idToNode.set(data.id, data)
|
|
19
|
-
}
|
|
20
|
-
|
|
21
|
-
this.storeService.dispatch(setIdToNode(idToNode), { silent: true })
|
|
22
|
-
}
|
|
23
|
-
}
|
|
@@ -1,27 +0,0 @@
|
|
|
1
|
-
import { CCAction, RecursivePartial, LookUp } from "../../../codeCharta.model"
|
|
2
|
-
|
|
3
|
-
import { defaultIdToNode } from "./idToNode/idToNode.actions"
|
|
4
|
-
import { defaultIdToBuilding } from "./idToBuilding/idToBuilding.actions"
|
|
5
|
-
|
|
6
|
-
export enum LookUpActions {
|
|
7
|
-
SET_LOOK_UP = "SET_LOOK_UP"
|
|
8
|
-
}
|
|
9
|
-
|
|
10
|
-
export interface SetLookUpAction extends CCAction {
|
|
11
|
-
type: LookUpActions.SET_LOOK_UP
|
|
12
|
-
payload: RecursivePartial<LookUp>
|
|
13
|
-
}
|
|
14
|
-
|
|
15
|
-
export type LookUpAction = SetLookUpAction
|
|
16
|
-
|
|
17
|
-
export function setLookUp(lookUp: RecursivePartial<LookUp> = defaultLookUp): LookUpAction {
|
|
18
|
-
return {
|
|
19
|
-
type: LookUpActions.SET_LOOK_UP,
|
|
20
|
-
payload: lookUp
|
|
21
|
-
}
|
|
22
|
-
}
|
|
23
|
-
|
|
24
|
-
export const defaultLookUp: LookUp = {
|
|
25
|
-
idToNode: defaultIdToNode,
|
|
26
|
-
idToBuilding: defaultIdToBuilding
|
|
27
|
-
}
|
|
@@ -1,10 +0,0 @@
|
|
|
1
|
-
import { idToNode } from "./idToNode/idToNode.reducer"
|
|
2
|
-
import { idToBuilding } from "./idToBuilding/idToBuilding.reducer"
|
|
3
|
-
import { combineReducers } from "redux"
|
|
4
|
-
|
|
5
|
-
const lookUp = combineReducers({
|
|
6
|
-
idToNode,
|
|
7
|
-
idToBuilding
|
|
8
|
-
})
|
|
9
|
-
|
|
10
|
-
export default lookUp
|
|
@@ -1,19 +0,0 @@
|
|
|
1
|
-
import { RecursivePartial, CCAction, LookUp, CodeMapNode } from "../../../codeCharta.model"
|
|
2
|
-
|
|
3
|
-
import { splitIdToNodeAction } from "./idToNode/idToNode.splitter"
|
|
4
|
-
import { splitIdToBuildingAction } from "./idToBuilding/idToBuilding.splitter"
|
|
5
|
-
import { CodeMapBuilding } from "../../../ui/codeMap/rendering/codeMapBuilding"
|
|
6
|
-
|
|
7
|
-
export function splitLookUpActions(payload: RecursivePartial<LookUp>) {
|
|
8
|
-
const actions: CCAction[] = []
|
|
9
|
-
|
|
10
|
-
if (payload.idToNode !== undefined) {
|
|
11
|
-
actions.push(splitIdToNodeAction(payload.idToNode as Map<number, CodeMapNode>))
|
|
12
|
-
}
|
|
13
|
-
|
|
14
|
-
if (payload.idToBuilding !== undefined) {
|
|
15
|
-
actions.push(splitIdToBuildingAction(payload.idToBuilding as Map<number, CodeMapBuilding>))
|
|
16
|
-
}
|
|
17
|
-
|
|
18
|
-
return actions
|
|
19
|
-
}
|
|
@@ -1,41 +0,0 @@
|
|
|
1
|
-
remove-file-button-component {
|
|
2
|
-
.small-action-button {
|
|
3
|
-
margin: 0px 5px 0px 5px;
|
|
4
|
-
position: absolute;
|
|
5
|
-
right: 0;
|
|
6
|
-
|
|
7
|
-
display: inline-block;
|
|
8
|
-
height: 24px;
|
|
9
|
-
width: 24px;
|
|
10
|
-
vertical-align: top;
|
|
11
|
-
|
|
12
|
-
.md-fab {
|
|
13
|
-
min-height: 0;
|
|
14
|
-
width: 100%;
|
|
15
|
-
height: 100%;
|
|
16
|
-
margin: 0;
|
|
17
|
-
text-transform: unset;
|
|
18
|
-
|
|
19
|
-
.symbol {
|
|
20
|
-
position: relative;
|
|
21
|
-
left: 0px;
|
|
22
|
-
bottom: 16px;
|
|
23
|
-
}
|
|
24
|
-
}
|
|
25
|
-
|
|
26
|
-
.delete-symbol {
|
|
27
|
-
color: black;
|
|
28
|
-
position: relative;
|
|
29
|
-
right: 1px;
|
|
30
|
-
}
|
|
31
|
-
|
|
32
|
-
&.transparent .md-fab {
|
|
33
|
-
background-color: rgba(230, 230, 230, 0.96);
|
|
34
|
-
box-shadow: none;
|
|
35
|
-
|
|
36
|
-
&:hover {
|
|
37
|
-
background-color: rgb(200, 200, 200);
|
|
38
|
-
}
|
|
39
|
-
}
|
|
40
|
-
}
|
|
41
|
-
}
|
|
@@ -1,18 +0,0 @@
|
|
|
1
|
-
import "./removeFileButton.component.scss"
|
|
2
|
-
|
|
3
|
-
export class RemoveFileButtonController {
|
|
4
|
-
private filename: string
|
|
5
|
-
private state: string
|
|
6
|
-
private onRemoveFile
|
|
7
|
-
|
|
8
|
-
onRemoveFileCall($event): void {
|
|
9
|
-
this.onRemoveFile({ filename: this.filename, state: this.state, event: $event })
|
|
10
|
-
}
|
|
11
|
-
}
|
|
12
|
-
|
|
13
|
-
export const removeFileButtonComponent = {
|
|
14
|
-
selector: "removeFileButtonComponent",
|
|
15
|
-
template: require("./removeFileButton.component.html"),
|
|
16
|
-
controller: RemoveFileButtonController,
|
|
17
|
-
bindings: { filename: "@", state: "@", onRemoveFile: "&" }
|
|
18
|
-
}
|
|
@@ -1,7 +0,0 @@
|
|
|
1
|
-
import "../../state/state.module"
|
|
2
|
-
import angular from "angular"
|
|
3
|
-
import { removeFileButtonComponent } from "./removeFileButton.component"
|
|
4
|
-
|
|
5
|
-
angular
|
|
6
|
-
.module("app.codeCharta.ui.removeFileButton", ["app.codeCharta.state"])
|
|
7
|
-
.component(removeFileButtonComponent.selector, removeFileButtonComponent)
|
|
@@ -1,73 +0,0 @@
|
|
|
1
|
-
import { CodeChartaFileStorageEngine, CodeChartaStorage } from "./codeChartaStorage"
|
|
2
|
-
import fs from "fs"
|
|
3
|
-
import * as EnvironmentDetector from "./envDetector"
|
|
4
|
-
|
|
5
|
-
describe("CodeChartaFileStorage", () => {
|
|
6
|
-
beforeAll(() => {
|
|
7
|
-
jest.mock("fs")
|
|
8
|
-
})
|
|
9
|
-
|
|
10
|
-
afterEach(() => {
|
|
11
|
-
jest.clearAllMocks()
|
|
12
|
-
})
|
|
13
|
-
|
|
14
|
-
describe("test fileStorage", () => {
|
|
15
|
-
jest.spyOn(EnvironmentDetector, "isStandalone").mockReturnValue(true)
|
|
16
|
-
jest.spyOn(fs, "realpathSync").mockReturnValueOnce("mockedRelativeFileStoragePath")
|
|
17
|
-
const codeChartaStorage = new CodeChartaStorage()
|
|
18
|
-
|
|
19
|
-
it("should call matching file-system methods", () => {
|
|
20
|
-
jest.spyOn(fs, "writeFileSync").mockImplementation()
|
|
21
|
-
codeChartaStorage.setItem("unit/testing", "successful")
|
|
22
|
-
expect(fs.writeFileSync).toHaveBeenCalledWith(expect.stringContaining("unit/testing"), "successful", expect.any(Object))
|
|
23
|
-
|
|
24
|
-
jest.spyOn(fs, "readFileSync").mockReturnValueOnce("")
|
|
25
|
-
codeChartaStorage.getItem("unit/testing")
|
|
26
|
-
expect(fs.readFileSync).toHaveBeenCalledWith(expect.stringContaining("unit/testing"))
|
|
27
|
-
|
|
28
|
-
jest.spyOn(fs, "unlinkSync").mockImplementation()
|
|
29
|
-
codeChartaStorage.removeItem("unit/testing")
|
|
30
|
-
expect(fs.unlinkSync).toHaveBeenNthCalledWith(1, expect.stringContaining("unit/testing"))
|
|
31
|
-
|
|
32
|
-
// @ts-ignore
|
|
33
|
-
jest.spyOn(fs, "readdirSync").mockReturnValue(["file1", "file2"])
|
|
34
|
-
jest.spyOn(fs, "unlinkSync").mockImplementation()
|
|
35
|
-
expect(codeChartaStorage.key(0)).toBe("file1")
|
|
36
|
-
expect(codeChartaStorage.key(1)).toBe("file2")
|
|
37
|
-
expect(codeChartaStorage.key(99)).toBeNull()
|
|
38
|
-
expect(fs.readdirSync).toHaveBeenCalledTimes(3)
|
|
39
|
-
|
|
40
|
-
jest.spyOn(fs, "unlinkSync").mockImplementation()
|
|
41
|
-
codeChartaStorage.clear()
|
|
42
|
-
expect(fs.unlinkSync).toHaveBeenCalledTimes(3)
|
|
43
|
-
expect(fs.unlinkSync).toHaveBeenNthCalledWith(2, expect.stringContaining("file1"))
|
|
44
|
-
expect(fs.unlinkSync).toHaveBeenNthCalledWith(3, expect.stringContaining("file2"))
|
|
45
|
-
})
|
|
46
|
-
})
|
|
47
|
-
})
|
|
48
|
-
|
|
49
|
-
describe("CodeChartaStorage", () => {
|
|
50
|
-
afterEach(() => {
|
|
51
|
-
jest.clearAllMocks()
|
|
52
|
-
})
|
|
53
|
-
|
|
54
|
-
describe("test initialization of file storage engines", () => {
|
|
55
|
-
it("should set fileStorageEngine for CodeCharta standalone version", () => {
|
|
56
|
-
jest.spyOn(EnvironmentDetector, "isStandalone").mockReturnValue(true)
|
|
57
|
-
jest.spyOn(CodeChartaFileStorageEngine.prototype, "clear").mockImplementation()
|
|
58
|
-
|
|
59
|
-
const storage = new CodeChartaStorage()
|
|
60
|
-
storage.clear()
|
|
61
|
-
expect(CodeChartaFileStorageEngine.prototype.clear).toHaveBeenCalledTimes(1)
|
|
62
|
-
})
|
|
63
|
-
|
|
64
|
-
it("should set localStorage as storageEngine for CodeCharta web version", () => {
|
|
65
|
-
jest.spyOn(EnvironmentDetector, "isStandalone").mockReturnValue(false)
|
|
66
|
-
jest.spyOn(CodeChartaFileStorageEngine.prototype, "clear").mockImplementation()
|
|
67
|
-
|
|
68
|
-
const storage = new CodeChartaStorage()
|
|
69
|
-
storage.clear()
|
|
70
|
-
expect(CodeChartaFileStorageEngine.prototype.clear).not.toHaveBeenCalled()
|
|
71
|
-
})
|
|
72
|
-
})
|
|
73
|
-
})
|