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.
Files changed (104) hide show
  1. package/app/app.module.ts +16 -2
  2. package/app/codeCharta/assets/gameObjectsFile.json +75 -0
  3. package/app/codeCharta/codeCharta.model.ts +1 -10
  4. package/app/codeCharta/services/idToBuilding/idToBuilding.service.ts +17 -0
  5. package/app/codeCharta/state/effects/nodeContextMenu/highlightButtons/highlightButtons.component.spec.ts +14 -23
  6. package/app/codeCharta/state/effects/nodeContextMenu/highlightButtons/highlightButtons.component.ts +7 -5
  7. package/app/codeCharta/state/effects/nodeContextMenu/nodeContextMenuCard/nodeContextMenuCard.component.spec.ts +3 -1
  8. package/app/codeCharta/state/effects/nodeContextMenu/rightClickedCodeMapNode.selector.ts +1 -1
  9. package/app/codeCharta/state/effects/trackEventUsageData/trackEventUsageData.effect.spec.ts +56 -0
  10. package/app/codeCharta/state/effects/trackEventUsageData/trackEventUsageData.effect.ts +49 -0
  11. package/app/codeCharta/state/effects/unfocusNodesOnLoadingMap.effect.ts +2 -1
  12. package/app/codeCharta/state/injector.service.ts +0 -4
  13. package/app/codeCharta/state/selectors/accumulatedData/idToNode.selector.spec.ts +15 -0
  14. package/app/codeCharta/state/selectors/accumulatedData/idToNode.selector.ts +16 -0
  15. package/app/codeCharta/state/selectors/selectedNode.selector.ts +5 -2
  16. package/app/codeCharta/state/state.module.ts +0 -4
  17. package/app/codeCharta/state/store/appSettings/isLoadingMap/isLoadingMap.reducer.ts +1 -5
  18. package/app/codeCharta/state/store/state.actions.ts +0 -2
  19. package/app/codeCharta/state/store/state.reducer.ts +0 -2
  20. package/app/codeCharta/state/store/state.splitter.ts +0 -10
  21. package/app/codeCharta/state/store.service.ts +0 -16
  22. package/app/codeCharta/ui/attributeSideBar/attributeSideBar.component.spec.ts +5 -1
  23. package/app/codeCharta/ui/attributeSideBar/attributeSideBar.component.ts +2 -2
  24. package/app/codeCharta/ui/attributeSideBar/attributeSideBarHeaderSection/attributeSideBarHeaderSection.component.html +0 -1
  25. package/app/codeCharta/ui/attributeSideBar/attributeSideBarHeaderSection/attributeSideBarHeaderSection.component.spec.ts +3 -45
  26. package/app/codeCharta/ui/attributeSideBar/attributeSideBarHeaderSection/attributeSideBarHeaderSection.component.ts +2 -8
  27. package/app/codeCharta/ui/attributeSideBar/attributeSideBarHeaderSection/nodePath/nodePath.component.html +1 -1
  28. package/app/codeCharta/ui/attributeSideBar/attributeSideBarHeaderSection/nodePath/nodePath.component.spec.ts +3 -2
  29. package/app/codeCharta/ui/attributeSideBar/attributeSideBarHeaderSection/nodePath/nodePath.component.ts +2 -2
  30. package/app/codeCharta/ui/attributeSideBar/attributeSideBarSecondaryMetrics/secondaryMetrics.selector.ts +2 -2
  31. package/app/codeCharta/ui/attributeSideBar/metricDeltaSelected/metricDeltaSelected.component.spec.ts +26 -23
  32. package/app/codeCharta/ui/attributeSideBar/metricDeltaSelected/metricDeltaSelected.component.ts +2 -2
  33. package/app/codeCharta/ui/attributeSideBar/util/showAttributeTypeSelector.selector.spec.ts +2 -2
  34. package/app/codeCharta/ui/attributeSideBar/util/showAttributeTypeSelector.selector.ts +2 -2
  35. package/app/codeCharta/ui/codeMap/codeMap.mouseEvent.service.spec.ts +28 -45
  36. package/app/codeCharta/ui/codeMap/codeMap.mouseEvent.service.ts +7 -11
  37. package/app/codeCharta/ui/codeMap/codeMap.preRender.service.ts +4 -46
  38. package/app/codeCharta/ui/codeMap/threeViewer/threeSceneService.spec.ts +26 -19
  39. package/app/codeCharta/ui/codeMap/threeViewer/threeSceneService.ts +13 -25
  40. package/app/codeCharta/ui/codeMap/threeViewer/threeViewer.module.ts +3 -0
  41. package/app/codeCharta/ui/dialog/dialog.globalSettings.component.ts +3 -5
  42. package/app/codeCharta/ui/dialog/dialog.globalSettings.e2e.ts +1 -1
  43. package/app/codeCharta/ui/fileChooser/fileChooser.component.spec.ts +1 -0
  44. package/app/codeCharta/ui/fileChooser/fileChooser.component.ts +6 -1
  45. package/app/codeCharta/ui/fileChooser/fileChooser.e2e.ts +5 -0
  46. package/app/codeCharta/ui/filePanel/filePanel.component.html +1 -0
  47. package/app/codeCharta/ui/filePanel/filePanel.component.spec.ts +7 -0
  48. package/app/codeCharta/ui/filePanel/filePanel.component.ts +1 -2
  49. package/app/codeCharta/ui/filePanel/filePanel.module.ts +2 -0
  50. package/app/codeCharta/ui/filePanel/filePanelFileSelector/filePanelFileSelector.component.html +7 -1
  51. package/app/codeCharta/ui/filePanel/filePanelFileSelector/filePanelFileSelector.component.scss +6 -0
  52. package/app/codeCharta/ui/filePanel/filePanelFileSelector/filePanelFileSelector.component.ts +2 -1
  53. package/app/codeCharta/ui/filePanel/filePanelFileSelector/removeFileButton/removeFileButton.component.html +3 -0
  54. package/app/codeCharta/ui/filePanel/filePanelFileSelector/removeFileButton/removeFileButton.component.scss +9 -0
  55. package/app/codeCharta/ui/filePanel/filePanelFileSelector/removeFileButton/removeFileButton.component.ts +11 -0
  56. package/app/codeCharta/ui/rangeSlider/rangeSlider.component.ts +9 -33
  57. package/app/codeCharta/util/__snapshots__/usageDataTracker.spec.ts.snap +1 -16
  58. package/app/codeCharta/util/codeMapHelper.ts +3 -2
  59. package/app/codeCharta/util/customConfigHelper.ts +4 -16
  60. package/app/codeCharta/util/dataMocks.ts +0 -8
  61. package/app/codeCharta/util/envDetector.ts +0 -4
  62. package/app/codeCharta/util/gameObjectsParser/__snapshots__/gameObjectsImporter.spec.ts.snap +121 -0
  63. package/app/codeCharta/util/gameObjectsParser/gameObjectsImporter.spec.ts +11 -0
  64. package/app/codeCharta/util/gameObjectsParser/gameObjectsImporter.ts +170 -0
  65. package/app/codeCharta/util/gameObjectsParser/gameObjectsMocks.ts +75 -0
  66. package/app/codeCharta/util/gameObjectsParser/gameObjectsSchema.json +271 -0
  67. package/app/codeCharta/util/gameObjectsParser/gameObjectsValidator.spec.ts +18 -0
  68. package/app/codeCharta/util/gameObjectsParser/gameObjectsValidator.ts +7 -0
  69. package/app/codeCharta/util/nodeDecorator.ts +1 -0
  70. package/app/codeCharta/util/usageDataTracker.spec.ts +36 -76
  71. package/app/codeCharta/util/usageDataTracker.ts +20 -31
  72. package/conf/webpack.config.js +7 -7
  73. package/dist/webpack/bundle.js +871 -1260
  74. package/dist/webpack/bundle.js.map +1 -1
  75. package/package.json +10 -11
  76. package/app/codeCharta/state/selectors/selectedBuilding.selector.ts +0 -8
  77. package/app/codeCharta/state/store/lookUp/idToBuilding/idToBuilding.actions.ts +0 -22
  78. package/app/codeCharta/state/store/lookUp/idToBuilding/idToBuilding.reducer.spec.ts +0 -33
  79. package/app/codeCharta/state/store/lookUp/idToBuilding/idToBuilding.reducer.ts +0 -14
  80. package/app/codeCharta/state/store/lookUp/idToBuilding/idToBuilding.selector.ts +0 -3
  81. package/app/codeCharta/state/store/lookUp/idToBuilding/idToBuilding.service.spec.ts +0 -40
  82. package/app/codeCharta/state/store/lookUp/idToBuilding/idToBuilding.service.ts +0 -23
  83. package/app/codeCharta/state/store/lookUp/idToBuilding/idToBuilding.splitter.ts +0 -6
  84. package/app/codeCharta/state/store/lookUp/idToNode/idToNode.actions.ts +0 -22
  85. package/app/codeCharta/state/store/lookUp/idToNode/idToNode.reducer.spec.ts +0 -39
  86. package/app/codeCharta/state/store/lookUp/idToNode/idToNode.reducer.ts +0 -11
  87. package/app/codeCharta/state/store/lookUp/idToNode/idToNode.selector.ts +0 -4
  88. package/app/codeCharta/state/store/lookUp/idToNode/idToNode.service.spec.ts +0 -57
  89. package/app/codeCharta/state/store/lookUp/idToNode/idToNode.service.ts +0 -23
  90. package/app/codeCharta/state/store/lookUp/idToNode/idToNode.splitter.ts +0 -6
  91. package/app/codeCharta/state/store/lookUp/lookUp.actions.ts +0 -27
  92. package/app/codeCharta/state/store/lookUp/lookUp.reducer.ts +0 -10
  93. package/app/codeCharta/state/store/lookUp/lookUp.selector.ts +0 -3
  94. package/app/codeCharta/state/store/lookUp/lookUp.splitter.ts +0 -19
  95. package/app/codeCharta/ui/removeFileButton/removeFileButton.component.html +0 -5
  96. package/app/codeCharta/ui/removeFileButton/removeFileButton.component.scss +0 -41
  97. package/app/codeCharta/ui/removeFileButton/removeFileButton.component.ts +0 -18
  98. package/app/codeCharta/ui/removeFileButton/removeFileButton.module.ts +0 -7
  99. package/app/codeCharta/util/codeChartaFileStorage.spec.ts +0 -73
  100. package/app/codeCharta/util/codeChartaStorage.ts +0 -62
  101. package/app/codeCharta/util/lazyLoader.spec.ts +0 -33
  102. package/app/codeCharta/util/lazyLoader.ts +0 -50
  103. package/dist/webpack/vendors-node_modules_open_index_js.bundle.js +0 -1036
  104. package/dist/webpack/vendors-node_modules_open_index_js.bundle.js.map +0 -1
package/app/app.module.ts CHANGED
@@ -24,18 +24,28 @@ import { FilePanelStateButtonsComponent } from "./codeCharta/ui/filePanel/filePa
24
24
  import { FilePanelDeltaSelectorComponent } from "./codeCharta/ui/filePanel/filePanelDeltaSelector/filePanelDeltaSelector.component"
25
25
  import { EffectsModule } from "./codeCharta/state/angular-redux/effects/effects.module"
26
26
  import { UnfocusNodesOnLoadingMapEffect } from "./codeCharta/state/effects/unfocusNodesOnLoadingMap.effect"
27
+ import { TrackEventUsageDataEffect } from "./codeCharta/state/effects/trackEventUsageData/trackEventUsageData.effect"
27
28
  import { AddBlacklistItemsIfNotResultsInEmptyMapEffect } from "./codeCharta/state/effects/addBlacklistItemsIfNotResultsInEmptyMap/addBlacklistItemsIfNotResultsInEmptyMap.effect"
28
29
  import { dialogs } from "./codeCharta/ui/dialogs/dialogs"
29
30
  import { threeSceneServiceProvider } from "./codeCharta/services/ajs-upgraded-providers"
30
31
  import { NodeContextMenuCardModule } from "./codeCharta/state/effects/nodeContextMenu/nodeContextMenuCard/nodeContextMenuCard.module"
31
32
  import { OpenNodeContextMenuEffect } from "./codeCharta/state/effects/nodeContextMenu/openNodeContextMenu.effect"
32
33
  import { InvertAreaOptionComponent } from "./codeCharta/ui/areaSettingsPanel/invertAreaOption/invertAreaOption.component"
34
+ import { RemoveFileButtonComponent } from "./codeCharta/ui/filePanel/filePanelFileSelector/removeFileButton/removeFileButton.component"
35
+ import { FocusButtonsComponent } from "./codeCharta/state/effects/nodeContextMenu/focusButtons/focusButtons.component"
36
+ import { MarkFolderRowComponent } from "./codeCharta/state/effects/nodeContextMenu/markFolderRow/markFolderRow.component"
37
+ import { IdToBuildingService } from "./codeCharta/services/idToBuilding/idToBuilding.service"
33
38
 
34
39
  @NgModule({
35
40
  imports: [
36
41
  BrowserModule,
37
42
  UpgradeModule,
38
- EffectsModule.forRoot([UnfocusNodesOnLoadingMapEffect, AddBlacklistItemsIfNotResultsInEmptyMapEffect, OpenNodeContextMenuEffect]),
43
+ EffectsModule.forRoot([
44
+ UnfocusNodesOnLoadingMapEffect,
45
+ AddBlacklistItemsIfNotResultsInEmptyMapEffect,
46
+ OpenNodeContextMenuEffect,
47
+ TrackEventUsageDataEffect
48
+ ]),
39
49
  MapTreeViewModule,
40
50
  MatchingFilesCounterModule,
41
51
  AttributeSideBarModule,
@@ -46,12 +56,13 @@ import { InvertAreaOptionComponent } from "./codeCharta/ui/areaSettingsPanel/inv
46
56
  ColorPickerForMapColorModule,
47
57
  NodeContextMenuCardModule
48
58
  ],
49
- providers: [threeSceneServiceProvider],
59
+ providers: [threeSceneServiceProvider, IdToBuildingService],
50
60
  declarations: [
51
61
  FilePanelFileSelectorComponent,
52
62
  FilePanelStateButtonsComponent,
53
63
  FilePanelDeltaSelectorComponent,
54
64
  InvertAreaOptionComponent,
65
+ RemoveFileButtonComponent,
55
66
  ...dialogs
56
67
  ],
57
68
  entryComponents: [
@@ -66,6 +77,9 @@ import { InvertAreaOptionComponent } from "./codeCharta/ui/areaSettingsPanel/inv
66
77
  FilePanelStateButtonsComponent,
67
78
  FilePanelDeltaSelectorComponent,
68
79
  InvertAreaOptionComponent,
80
+ FocusButtonsComponent,
81
+ MarkFolderRowComponent,
82
+ RemoveFileButtonComponent,
69
83
  ...dialogs
70
84
  ]
71
85
  })
@@ -0,0 +1,75 @@
1
+ {
2
+ "gameObjectPositions": [
3
+ {
4
+ "name": "root.visualization.ui",
5
+ "position": {
6
+ "x": 159.5,
7
+ "y": 3.5,
8
+ "z": 8.5
9
+ },
10
+ "scale": {
11
+ "x": 5.0,
12
+ "y": 1.0,
13
+ "z": 5.0
14
+ }
15
+ },
16
+ {
17
+ "name": "root.visualization.packageLock",
18
+ "position": {
19
+ "x": 82.0,
20
+ "y": 5.0,
21
+ "z": 89.0
22
+ },
23
+ "scale": {
24
+ "x": 2.0,
25
+ "y": 4.0,
26
+ "z": 2.0
27
+ }
28
+ },
29
+ {
30
+ "name": "root.visualization",
31
+ "position": {
32
+ "x": 84.0,
33
+ "y": 2.5,
34
+ "z": 48.0
35
+ },
36
+ "scale": {
37
+ "x": 160.0,
38
+ "y": 1.0,
39
+ "z": 88.0
40
+ }
41
+ },
42
+ {
43
+ "name": "root.CHANGELOG",
44
+ "position": {
45
+ "x": 84.0,
46
+ "y": 2.5,
47
+ "z": 552.5
48
+ },
49
+ "scale": {
50
+ "x": 5.0,
51
+ "y": 1.0,
52
+ "z": 5.0
53
+ }
54
+ },
55
+ {
56
+ "name": "root",
57
+ "position": {
58
+ "x": 84.0,
59
+ "y": 0.5,
60
+ "z": 279.5
61
+ },
62
+ "scale": {
63
+ "x": 168.0,
64
+ "y": 1.0,
65
+ "z": 559.0
66
+ }
67
+ }
68
+ ],
69
+ "cycles": [
70
+ {
71
+ "from": "root.CHANGELOG",
72
+ "to": "root.visualization.packageLock"
73
+ }
74
+ ]
75
+ }
@@ -1,7 +1,6 @@
1
1
  import { Vector3 } from "three"
2
2
  import { Action } from "redux"
3
3
  import { ExportCCFile } from "./codeCharta.api.model"
4
- import { CodeMapBuilding } from "./ui/codeMap/rendering/codeMapBuilding"
5
4
  import { FileState } from "./model/files/files"
6
5
  import { CustomConfig } from "./model/customConfig/customConfig.api.model"
7
6
  import Rectangle from "./util/algorithm/streetLayout/rectangle"
@@ -349,7 +348,6 @@ export interface State {
349
348
  appSettings: AppSettings
350
349
  treeMap: TreeMapSettings
351
350
  files: FileState[]
352
- lookUp: LookUp
353
351
  appStatus: AppStatus
354
352
  }
355
353
 
@@ -385,9 +383,8 @@ export interface CCAction extends Action {
385
383
  //
386
384
  // As a starting point:
387
385
  //
388
- // RecursivePartial<MetricData & DynamicSettings & LookUp & FileSettings & AppSettings & TreeMapSettings & FileState> & {
386
+ // RecursivePartial<MetricData & DynamicSettings & FileSettings & AppSettings & TreeMapSettings & FileState> & {
389
387
  // metricData: MetricData
390
- // lookUp: LookUp
391
388
  // dynamicSettings: DynamicSettings
392
389
  // fileSettings: FileSettings
393
390
  // appSettings: AppSettings
@@ -397,12 +394,6 @@ export interface CCAction extends Action {
397
394
  payload?: any
398
395
  }
399
396
 
400
- export interface LookUp {
401
- idToNode: Map<number, CodeMapNode>
402
- // note that key is id of node and NOT id of building
403
- idToBuilding: Map<number, CodeMapBuilding>
404
- }
405
-
406
397
  export interface AppStatus {
407
398
  hoveredBuildingPath: string | null
408
399
  selectedBuildingId: number | null
@@ -0,0 +1,17 @@
1
+ import { Injectable } from "@angular/core"
2
+ import { CodeMapBuilding } from "../../ui/codeMap/rendering/codeMapBuilding"
3
+
4
+ @Injectable()
5
+ export class IdToBuildingService {
6
+ private idToBuilding = new Map<number, CodeMapBuilding>()
7
+
8
+ setIdToBuilding(buildings: CodeMapBuilding[]) {
9
+ this.idToBuilding = new Map<number, CodeMapBuilding>()
10
+ for (const building of buildings) this.idToBuilding.set(building.node.id, building)
11
+ }
12
+
13
+ /** id is buildings' node.id */
14
+ get(id: number) {
15
+ return this.idToBuilding.get(id)
16
+ }
17
+ }
@@ -4,45 +4,41 @@ import userEvent from "@testing-library/user-event"
4
4
  import { HighlightButtonsModule } from "./highlightButtons.module"
5
5
  import { ThreeSceneServiceToken } from "../../../../services/ajs-upgraded-providers"
6
6
  import { HighlightButtonsComponent } from "./highlightButtons.component"
7
- import { VALID_FILE_NODE_WITH_ID as codeMapNode } from "../../../../util/dataMocks"
8
- import { State } from "../../../angular-redux/state"
9
7
  import { CodeMapNode } from "../../../../codeCharta.model"
8
+ import { IdToBuildingService } from "../../../../services/idToBuilding/idToBuilding.service"
9
+ import { CodeMapBuilding } from "../../../../ui/codeMap/rendering/codeMapBuilding"
10
10
 
11
11
  describe("flattenButtonsComponent", () => {
12
- let threeSceneService
13
- let state
14
-
15
12
  beforeEach(() => {
16
- threeSceneService = createMockedThreeSceneService()
17
- state = createMockedState()
18
13
  TestBed.configureTestingModule({
19
- imports: [HighlightButtonsModule],
20
- providers: [
21
- { provide: ThreeSceneServiceToken, useValue: threeSceneService },
22
- { provide: State, useValue: state }
23
- ]
14
+ imports: [HighlightButtonsModule]
24
15
  })
25
16
  })
26
17
 
27
18
  it("should let a user permanently highlight and remove permanently highlight of a node", async () => {
28
- state.getValue().lookUp.idToBuilding.set(codeMapNode.id, { id: codeMapNode.id, node: codeMapNode })
19
+ const idToBuilding = new IdToBuildingService()
20
+ idToBuilding.setIdToBuilding([{ id: 0, node: { id: 0 } } as unknown as CodeMapBuilding])
29
21
 
30
22
  const { rerender } = await render(HighlightButtonsComponent, {
31
23
  excludeComponentDeclaration: true,
32
- componentProperties: { codeMapNode }
24
+ componentProperties: { codeMapNode: { id: 0 } },
25
+ providers: [
26
+ { provide: IdToBuildingService, useValue: idToBuilding },
27
+ { provide: ThreeSceneServiceToken, useValue: createMockedThreeSceneService() }
28
+ ]
33
29
  })
34
30
 
35
31
  expect(screen.queryByText("REMOVE HIGHLIGHT")).toBe(null)
36
32
  userEvent.click(screen.getByText("KEEP HIGHLIGHT"))
37
33
 
38
- rerender({ codeMapNode: null })
39
- rerender({ codeMapNode })
34
+ rerender({ codeMapNode: undefined })
35
+ rerender({ codeMapNode: { id: 0 } })
40
36
 
41
37
  expect(screen.queryByText("KEEP HIGHLIGHT")).toBe(null)
42
38
  userEvent.click(screen.getByText("REMOVE HIGHLIGHT"))
43
39
 
44
- rerender({ codeMapNode: null })
45
- rerender({ codeMapNode })
40
+ rerender({ codeMapNode: undefined })
41
+ rerender({ codeMapNode: { id: 0 } })
46
42
 
47
43
  expect(screen.queryByText("REMOVE HIGHLIGHT")).toBe(null)
48
44
  expect(screen.queryByText("KEEP HIGHLIGHT")).not.toBe(null)
@@ -56,9 +52,4 @@ describe("flattenButtonsComponent", () => {
56
52
  getConstantHighlight: () => highlighted
57
53
  }
58
54
  }
59
-
60
- function createMockedState() {
61
- const idToBuilding = new Map()
62
- return { getValue: () => ({ lookUp: { idToBuilding } }) }
63
- }
64
55
  })
@@ -1,7 +1,7 @@
1
1
  import { Component, Inject, Input, OnChanges, SimpleChanges } from "@angular/core"
2
2
  import { CodeMapNode } from "../../../../codeCharta.model"
3
3
  import { ThreeSceneServiceToken } from "../../../../services/ajs-upgraded-providers"
4
- import { State } from "../../../angular-redux/state"
4
+ import { IdToBuildingService } from "../../../../services/idToBuilding/idToBuilding.service"
5
5
  import { ThreeSceneService } from "../../../../ui/codeMap/threeViewer/threeSceneService"
6
6
 
7
7
  @Component({
@@ -9,11 +9,14 @@ import { ThreeSceneService } from "../../../../ui/codeMap/threeViewer/threeScene
9
9
  template: require("./highlightButtons.component.html")
10
10
  })
11
11
  export class HighlightButtonsComponent implements OnChanges {
12
- @Input() codeMapNode: CodeMapNode
12
+ @Input() codeMapNode: Pick<CodeMapNode, "id">
13
13
 
14
14
  isHighlighted: boolean
15
15
 
16
- constructor(@Inject(ThreeSceneServiceToken) private threeSceneService: ThreeSceneService, @Inject(State) private state: State) {}
16
+ constructor(
17
+ @Inject(ThreeSceneServiceToken) private threeSceneService: ThreeSceneService,
18
+ @Inject(IdToBuildingService) private idToBuilding: IdToBuildingService
19
+ ) {}
17
20
 
18
21
  ngOnChanges(changes: SimpleChanges): void {
19
22
  if (changes.codeMapNode) this.isHighlighted = this.calculateIsHighlighted()
@@ -30,8 +33,7 @@ export class HighlightButtonsComponent implements OnChanges {
30
33
  private calculateIsHighlighted() {
31
34
  if (!this.codeMapNode) return false
32
35
 
33
- const { lookUp } = this.state.getValue()
34
- const codeMapBuilding = lookUp.idToBuilding.get(this.codeMapNode.id)
36
+ const codeMapBuilding = this.idToBuilding.get(this.codeMapNode.id)
35
37
  if (!codeMapBuilding) return false
36
38
 
37
39
  return this.threeSceneService.getConstantHighlight().has(codeMapBuilding.id)
@@ -2,6 +2,7 @@ import { TestBed } from "@angular/core/testing"
2
2
  import { render, screen } from "@testing-library/angular"
3
3
  import { mocked } from "ts-jest/utils"
4
4
  import { ThreeSceneServiceToken } from "../../../../services/ajs-upgraded-providers"
5
+ import { IdToBuildingService } from "../../../../services/idToBuilding/idToBuilding.service"
5
6
  import { VALID_FILE_NODE_WITH_ID, VALID_NODE_WITH_PATH } from "../../../../util/dataMocks"
6
7
  import { rightClickedCodeMapNodeSelector } from "../rightClickedCodeMapNode.selector"
7
8
  import { NodeContextMenuCardComponent } from "./nodeContextMenuCard.component"
@@ -24,7 +25,8 @@ describe("NodeContextMenuCardComponent", () => {
24
25
  removeNodeAndChildrenFromConstantHighlight: jest.fn(),
25
26
  getConstantHighlight: jest.fn()
26
27
  }
27
- }
28
+ },
29
+ IdToBuildingService
28
30
  ]
29
31
  })
30
32
  })
@@ -1,6 +1,6 @@
1
1
  import { createSelector } from "../../angular-redux/createSelector"
2
+ import { idToNodeSelector } from "../../selectors/accumulatedData/idToNode.selector"
2
3
  import { rightClickedNodeDataSelector } from "../../store/appStatus/rightClickedNodeData/rightClickedNodeData.selector"
3
- import { idToNodeSelector } from "../../store/lookUp/idToNode/idToNode.selector"
4
4
 
5
5
  export const rightClickedCodeMapNodeSelector = createSelector(
6
6
  [rightClickedNodeDataSelector, idToNodeSelector],
@@ -0,0 +1,56 @@
1
+ import { ApplicationInitStatus } from "@angular/core"
2
+ import { TestBed } from "@angular/core/testing"
3
+ import { Action } from "redux"
4
+ import { Subject } from "rxjs"
5
+ import { mocked } from "ts-jest/utils"
6
+ import { trackEventUsageData } from "../../../util/usageDataTracker"
7
+ import { EffectsModule } from "../../angular-redux/effects/effects.module"
8
+ import { areAllNecessaryRenderDataAvailableSelector } from "../../selectors/allNecessaryRenderDataAvailable/areAllNecessaryRenderDataAvailable.selector"
9
+ import { FocusedNodePathActions, focusNode } from "../../store/dynamicSettings/focusedNodePath/focusedNodePath.actions"
10
+ import { TrackEventUsageDataEffect } from "./trackEventUsageData.effect"
11
+
12
+ jest.mock("../../selectors/allNecessaryRenderDataAvailable/areAllNecessaryRenderDataAvailable.selector", () => ({
13
+ areAllNecessaryRenderDataAvailableSelector: jest.fn()
14
+ }))
15
+ const mockedAreAllNecessaryRenderDataAvailableSelector = mocked(areAllNecessaryRenderDataAvailableSelector)
16
+ jest.mock("../../../util/usageDataTracker", () => ({
17
+ trackEventUsageData: jest.fn()
18
+ }))
19
+ const mockedTrackEventUsageData = mocked(trackEventUsageData)
20
+
21
+ describe("TrackEventUsageDataEffect", () => {
22
+ afterEach(() => {
23
+ EffectsModule.actions$.complete()
24
+ mockedTrackEventUsageData.mockClear()
25
+ })
26
+
27
+ it("should ignore an action, when all necessary render data aren't available", async () => {
28
+ mockedAreAllNecessaryRenderDataAvailableSelector.mockImplementation(() => false)
29
+ await initEffects()
30
+ EffectsModule.actions$.next(focusNode("root/leaf.ts"))
31
+ expect(trackEventUsageData).not.toHaveBeenCalled()
32
+ })
33
+
34
+ it("should track an action, when all necessary render data are available", async () => {
35
+ mockedAreAllNecessaryRenderDataAvailableSelector.mockImplementation(() => true)
36
+ await initEffects()
37
+ EffectsModule.actions$.next(focusNode("root/leaf.ts"))
38
+ expect(trackEventUsageData).toHaveBeenCalledTimes(1)
39
+ expect(trackEventUsageData).toHaveBeenCalledWith(FocusedNodePathActions.FOCUS_NODE, [], "root/leaf.ts")
40
+ })
41
+
42
+ it("should ignore an action, which is not listed internally", async () => {
43
+ mockedAreAllNecessaryRenderDataAvailableSelector.mockImplementation(() => true)
44
+ await initEffects()
45
+ EffectsModule.actions$.next({ type: "I do not exist" })
46
+ expect(trackEventUsageData).not.toHaveBeenCalled()
47
+ })
48
+
49
+ async function initEffects() {
50
+ EffectsModule.actions$ = new Subject<Action>()
51
+ TestBed.configureTestingModule({
52
+ imports: [EffectsModule.forRoot([TrackEventUsageDataEffect])]
53
+ })
54
+ return TestBed.inject(ApplicationInitStatus).donePromise
55
+ }
56
+ })
@@ -0,0 +1,49 @@
1
+ import { Inject, Injectable } from "@angular/core"
2
+ import { combineLatest, filter, map, tap, withLatestFrom } from "rxjs"
3
+ import { isActionOfType } from "../../../util/reduxHelper"
4
+ import { trackEventUsageData } from "../../../util/usageDataTracker"
5
+ import { createEffect } from "../../angular-redux/effects/createEffect"
6
+ import { Actions, ActionsToken } from "../../angular-redux/effects/effects.module"
7
+ import { Store } from "../../angular-redux/store"
8
+ import { areAllNecessaryRenderDataAvailableSelector } from "../../selectors/allNecessaryRenderDataAvailable/areAllNecessaryRenderDataAvailable.selector"
9
+ import { AreaMetricActions } from "../../store/dynamicSettings/areaMetric/areaMetric.actions"
10
+ import { ColorMetricActions } from "../../store/dynamicSettings/colorMetric/colorMetric.actions"
11
+ import { ColorRangeActions } from "../../store/dynamicSettings/colorRange/colorRange.actions"
12
+ import { FocusedNodePathActions } from "../../store/dynamicSettings/focusedNodePath/focusedNodePath.actions"
13
+ import { HeightMetricActions } from "../../store/dynamicSettings/heightMetric/heightMetric.actions"
14
+ import { filesSelector } from "../../store/files/files.selector"
15
+ import { BlacklistActions } from "../../store/fileSettings/blacklist/blacklist.actions"
16
+
17
+ const actionsToTrackWithPayload = [
18
+ AreaMetricActions,
19
+ HeightMetricActions,
20
+ ColorMetricActions,
21
+ ColorRangeActions,
22
+ BlacklistActions,
23
+ FocusedNodePathActions
24
+ ]
25
+
26
+ @Injectable()
27
+ export class TrackEventUsageDataEffect {
28
+ private areAllNecessaryRenderDataAvailable$ = this.store.select(areAllNecessaryRenderDataAvailableSelector)
29
+ private files$ = this.store.select(filesSelector)
30
+
31
+ constructor(@Inject(ActionsToken) private actions$: Actions, @Inject(Store) private store: Store) {}
32
+
33
+ trackActionsWithPayload$ = createEffect(
34
+ () =>
35
+ combineLatest([this.actions$, this.areAllNecessaryRenderDataAvailable$]).pipe(
36
+ filter(
37
+ ([action, areAllNecessaryRenderDataAvailable]) =>
38
+ areAllNecessaryRenderDataAvailable &&
39
+ actionsToTrackWithPayload.some(actionToTrack => isActionOfType(action.type, actionToTrack))
40
+ ),
41
+ map(([action]) => action),
42
+ withLatestFrom(this.files$),
43
+ tap(([action, files]) => {
44
+ trackEventUsageData(action.type, files, action["payload"])
45
+ })
46
+ ),
47
+ { dispatch: false }
48
+ )
49
+ }
@@ -1,4 +1,4 @@
1
- import { Inject } from "@angular/core"
1
+ import { Inject, Injectable } from "@angular/core"
2
2
  import { filter, map } from "rxjs"
3
3
  import { isAction } from "../../util/reduxHelper"
4
4
  import { createEffect } from "../angular-redux/effects/createEffect"
@@ -6,6 +6,7 @@ import { Actions, ActionsToken } from "../angular-redux/effects/effects.module"
6
6
  import { IsLoadingFileActions, SetIsLoadingFileAction } from "../store/appSettings/isLoadingFile/isLoadingFile.actions"
7
7
  import { unfocusAllNodes } from "../store/dynamicSettings/focusedNodePath/focusedNodePath.actions"
8
8
 
9
+ @Injectable()
9
10
  export class UnfocusNodesOnLoadingMapEffect {
10
11
  constructor(@Inject(ActionsToken) private actions$: Actions) {}
11
12
 
@@ -9,8 +9,6 @@ import { PanelSelectionService } from "./store/appSettings/panelSelection/panelS
9
9
  import { EdgeMetricDataService } from "./store/metricData/edgeMetricData/edgeMetricData.service"
10
10
  import { NodeMetricDataService } from "./store/metricData/nodeMetricData/nodeMetricData.service"
11
11
  import { CameraTargetService } from "./store/appSettings/cameraTarget/cameraTarget.service"
12
- import { IdToNodeService } from "./store/lookUp/idToNode/idToNode.service"
13
- import { IdToBuildingService } from "./store/lookUp/idToBuilding/idToBuilding.service"
14
12
  import { IsAttributeSideBarVisibleService } from "./store/appSettings/isAttributeSideBarVisible/isAttributeSideBarVisible.service"
15
13
  import { FilesService } from "./store/files/files.service"
16
14
  import { SearchPanelModeService } from "./store/appSettings/searchPanelMode/searchPanelMode.service"
@@ -62,8 +60,6 @@ export class InjectorService {
62
60
  private edgeMetricDataService: EdgeMetricDataService,
63
61
  private nodeMetricDataService: NodeMetricDataService,
64
62
  private cameraTargetService: CameraTargetService,
65
- private idToNodeService: IdToNodeService,
66
- private idToBuildingService: IdToBuildingService,
67
63
  private isAttributeSideBarVisibleService: IsAttributeSideBarVisibleService,
68
64
  private searchPanelModeService: SearchPanelModeService,
69
65
  private isLoadingFileService: IsLoadingFileService,
@@ -0,0 +1,15 @@
1
+ import { VALID_NODES_WITH_ID } from "../../../util/dataMocks"
2
+ import { _calculateIdToNode } from "./idToNode.selector"
3
+
4
+ describe("idToNodeSelector", () => {
5
+ it("should return an empty Map if there is no unifiedMapNode", () => {
6
+ expect(_calculateIdToNode(undefined).size).toBe(0)
7
+ })
8
+
9
+ it("should include root node and its children", () => {
10
+ const idToNode = _calculateIdToNode(VALID_NODES_WITH_ID)
11
+ expect(idToNode.size).toBe(2)
12
+ expect(idToNode.get(0)).toEqual(VALID_NODES_WITH_ID)
13
+ expect(idToNode.get(1)).toEqual(VALID_NODES_WITH_ID.children[0])
14
+ })
15
+ })
@@ -0,0 +1,16 @@
1
+ import { hierarchy } from "d3-hierarchy"
2
+ import { CodeMapNode } from "../../../codeCharta.model"
3
+ import { createSelector } from "../../angular-redux/createSelector"
4
+ import { unifiedMapNodeSelector } from "./unifiedMapNode.selector"
5
+
6
+ export const _calculateIdToNode = (unifiedMapNode: CodeMapNode | undefined): Map<number, CodeMapNode> => {
7
+ if (!unifiedMapNode) return new Map()
8
+
9
+ const idToNode: Map<number, CodeMapNode> = new Map([[unifiedMapNode.id, unifiedMapNode]])
10
+ for (const { data } of hierarchy(unifiedMapNode)) {
11
+ idToNode.set(data.id, data)
12
+ }
13
+ return idToNode
14
+ }
15
+
16
+ export const idToNodeSelector = createSelector([unifiedMapNodeSelector], _calculateIdToNode)
@@ -1,4 +1,7 @@
1
1
  import { createSelector } from "../angular-redux/store"
2
- import { selectedBuildingSelector } from "./selectedBuilding.selector"
2
+ import { selectedBuildingIdSelector } from "../store/appStatus/selectedBuildingId/selectedBuildingId.selector"
3
+ import { idToNodeSelector } from "./accumulatedData/idToNode.selector"
3
4
 
4
- export const selectedNodeSelector = createSelector([selectedBuildingSelector], selectedBuilding => selectedBuilding?.node)
5
+ export const selectedNodeSelector = createSelector([selectedBuildingIdSelector, idToNodeSelector], (selectedBuildingId, idToNode) =>
6
+ idToNode?.get(selectedBuildingId)
7
+ )
@@ -7,8 +7,6 @@ import { LabelShowNodeNameService } from "./store/appSettings/showMetricLabelNam
7
7
  import { PanelSelectionService } from "./store/appSettings/panelSelection/panelSelection.service"
8
8
  import { NodeMetricDataService } from "./store/metricData/nodeMetricData/nodeMetricData.service"
9
9
  import { CameraTargetService } from "./store/appSettings/cameraTarget/cameraTarget.service"
10
- import { IdToNodeService } from "./store/lookUp/idToNode/idToNode.service"
11
- import { IdToBuildingService } from "./store/lookUp/idToBuilding/idToBuilding.service"
12
10
  import { IsAttributeSideBarVisibleService } from "./store/appSettings/isAttributeSideBarVisible/isAttributeSideBarVisible.service"
13
11
  import { SearchPanelModeService } from "./store/appSettings/searchPanelMode/searchPanelMode.service"
14
12
  import { IsLoadingFileService } from "./store/appSettings/isLoadingFile/isLoadingFile.service"
@@ -65,8 +63,6 @@ angular
65
63
  .service(camelCase(NodeMetricDataService.name), NodeMetricDataService)
66
64
  .service(camelCase(PanelSelectionService.name), PanelSelectionService)
67
65
  .service(camelCase(CameraTargetService.name), CameraTargetService)
68
- .service(camelCase(IdToNodeService.name), IdToNodeService)
69
- .service(camelCase(IdToBuildingService.name), IdToBuildingService)
70
66
  .service(camelCase(IsAttributeSideBarVisibleService.name), IsAttributeSideBarVisibleService)
71
67
  .service(camelCase(SearchPanelModeService.name), SearchPanelModeService)
72
68
  .service(camelCase(IsLoadingFileService.name), IsLoadingFileService)
@@ -13,8 +13,6 @@ import { PanelSelectionActions } from "../panelSelection/panelSelection.actions"
13
13
  import { SearchPanelModeActions } from "../searchPanelMode/searchPanelMode.actions"
14
14
  import { SortingOrderAscendingActions } from "../sortingOrderAscending/sortingOrderAscending.actions"
15
15
  import { IsLoadingMapAction, IsLoadingMapActions, setIsLoadingMap } from "./isLoadingMap.actions"
16
- import { IdToNodeActions } from "../../lookUp/idToNode/idToNode.actions"
17
- import { IdToBuildingActions } from "../../lookUp/idToBuilding/idToBuilding.actions"
18
16
 
19
17
  // Todo state actions explicit instead of excluding all others; refs #1547
20
18
  const actionsToExclude = [
@@ -31,9 +29,7 @@ const actionsToExclude = [
31
29
  HoveredBuildingPathActions,
32
30
  FocusedNodePathActions,
33
31
  CameraTargetActions,
34
- CameraActions,
35
- IdToNodeActions,
36
- IdToBuildingActions
32
+ CameraActions
37
33
  ]
38
34
 
39
35
  export function isLoadingMap(state = setIsLoadingMap().payload, action: IsLoadingMapAction) {
@@ -1,6 +1,5 @@
1
1
  import { CCAction, RecursivePartial, State } from "../../codeCharta.model"
2
2
 
3
- import { defaultLookUp } from "./lookUp/lookUp.actions"
4
3
  import { defaultAppSettings } from "./appSettings/appSettings.actions"
5
4
  import { defaultFileSettings } from "./fileSettings/fileSettings.actions"
6
5
  import { defaultDynamicSettings } from "./dynamicSettings/dynamicSettings.actions"
@@ -29,7 +28,6 @@ export function setState(state: RecursivePartial<State> = defaultState): StateAc
29
28
  }
30
29
 
31
30
  export const defaultState: State = {
32
- lookUp: defaultLookUp,
33
31
  appSettings: defaultAppSettings,
34
32
  fileSettings: defaultFileSettings,
35
33
  dynamicSettings: defaultDynamicSettings,
@@ -1,6 +1,5 @@
1
1
  import { combineReducers } from "redux"
2
2
 
3
- import lookUp from "./lookUp/lookUp.reducer"
4
3
  import appSettings from "./appSettings/appSettings.reducer"
5
4
  import fileSettings from "./fileSettings/fileSettings.reducer"
6
5
  import dynamicSettings from "./dynamicSettings/dynamicSettings.reducer"
@@ -9,7 +8,6 @@ import files from "./files/files.reducer"
9
8
  import appStatus from "./appStatus/appStatus.reducer"
10
9
 
11
10
  const rootReducer = combineReducers({
12
- lookUp,
13
11
  fileSettings,
14
12
  appSettings,
15
13
  dynamicSettings,
@@ -1,13 +1,11 @@
1
1
  import { CCAction } from "../../codeCharta.model"
2
2
  import { StateActions } from "./state.actions"
3
3
 
4
- import { LookUpActions } from "./lookUp/lookUp.actions"
5
4
  import { DynamicSettingsActions } from "./dynamicSettings/dynamicSettings.actions"
6
5
  import { FileSettingsActions } from "./fileSettings/fileSettings.actions"
7
6
  import { AppSettingsActions } from "./appSettings/appSettings.actions"
8
7
  import { TreeMapSettingsActions } from "./treeMap/treeMap.actions"
9
8
 
10
- import { splitLookUpActions } from "./lookUp/lookUp.splitter"
11
9
  import { splitDynamicSettingsActions } from "./dynamicSettings/dynamicSettings.splitter"
12
10
  import { splitFileSettingsActions } from "./fileSettings/fileSettings.splitter"
13
11
  import { splitAppSettingsActions } from "./appSettings/appSettings.splitter"
@@ -15,10 +13,6 @@ import { splitTreeMapSettingsActions } from "./treeMap/treeMap.splitter"
15
13
  import { splitFilesAction } from "./files/files.splitter"
16
14
 
17
15
  export function splitStateActions(action: CCAction) {
18
- if (LookUpActions[action.type] !== undefined) {
19
- return splitLookUpActions(action.payload)
20
- }
21
-
22
16
  if (DynamicSettingsActions[action.type] !== undefined) {
23
17
  return splitDynamicSettingsActions(action.payload)
24
18
  }
@@ -38,10 +32,6 @@ export function splitStateActions(action: CCAction) {
38
32
  if (StateActions[action.type] !== undefined) {
39
33
  const actions: CCAction[] = []
40
34
 
41
- if (action.payload.lookUp !== undefined) {
42
- actions.push(...splitLookUpActions(action.payload.lookUp))
43
- }
44
-
45
35
  if (action.payload.dynamicSettings !== undefined) {
46
36
  actions.push(...splitDynamicSettingsActions(action.payload.dynamicSettings))
47
37
  }