codecharta-visualization 1.86.0 → 1.89.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (217) hide show
  1. package/Dockerfile +1 -1
  2. package/app/app.module.ts +30 -6
  3. package/app/codeCharta/codeCharta.component.html +0 -2
  4. package/app/codeCharta/codeCharta.component.ts +2 -0
  5. package/app/codeCharta/codeCharta.model.ts +8 -5
  6. package/app/codeCharta/codeCharta.service.spec.ts +41 -50
  7. package/app/codeCharta/codeCharta.service.ts +33 -32
  8. package/app/codeCharta/e2e/url.e2e.ts +1 -1
  9. package/app/codeCharta/services/ajs-upgraded-providers.ts +13 -0
  10. package/app/codeCharta/state/angular-redux/effects/createEffect.spec.ts +37 -0
  11. package/app/codeCharta/state/angular-redux/effects/createEffect.ts +25 -0
  12. package/app/codeCharta/state/angular-redux/effects/effects.module.ts +36 -0
  13. package/app/codeCharta/state/angular-redux/ofType.ts +11 -0
  14. package/app/codeCharta/state/angular-redux/state.ts +12 -0
  15. package/app/codeCharta/state/angular-redux/store.ts +1 -1
  16. package/app/codeCharta/state/effects/addBlacklistItemsIfNotResultsInEmptyMap/addBlacklistItemsIfNotResultsInEmptyMap.effect.spec.ts +60 -0
  17. package/app/codeCharta/state/effects/addBlacklistItemsIfNotResultsInEmptyMap/addBlacklistItemsIfNotResultsInEmptyMap.effect.ts +56 -0
  18. package/app/codeCharta/state/effects/addBlacklistItemsIfNotResultsInEmptyMap/resultsInEmptyMap.ts +22 -0
  19. package/app/codeCharta/state/effects/nodeContextMenu/excludeButton/excludeButton.component.html +3 -0
  20. package/app/codeCharta/state/effects/nodeContextMenu/excludeButton/excludeButton.component.ts +26 -0
  21. package/app/codeCharta/state/effects/nodeContextMenu/flattenButtons/flattenButtons.component.html +13 -0
  22. package/app/codeCharta/state/effects/nodeContextMenu/flattenButtons/flattenButtons.component.spec.ts +55 -0
  23. package/app/codeCharta/state/effects/nodeContextMenu/flattenButtons/flattenButtons.component.ts +34 -0
  24. package/app/codeCharta/state/effects/nodeContextMenu/flattenButtons/flattenButtons.module.ts +11 -0
  25. package/app/codeCharta/state/effects/nodeContextMenu/focusButtons/focusButtons.component.html +24 -0
  26. package/app/codeCharta/state/effects/nodeContextMenu/focusButtons/focusButtons.component.spec.ts +55 -0
  27. package/app/codeCharta/state/effects/nodeContextMenu/focusButtons/focusButtons.component.ts +38 -0
  28. package/app/codeCharta/state/effects/nodeContextMenu/focusButtons/focusButtons.module.ts +13 -0
  29. package/app/codeCharta/state/effects/nodeContextMenu/focusButtons/isNodeFocused.pipe.spec.ts +31 -0
  30. package/app/codeCharta/state/effects/nodeContextMenu/focusButtons/isNodeFocused.pipe.ts +25 -0
  31. package/app/codeCharta/state/effects/nodeContextMenu/highlightButtons/highlightButtons.component.html +6 -0
  32. package/app/codeCharta/state/effects/nodeContextMenu/highlightButtons/highlightButtons.component.spec.ts +64 -0
  33. package/app/codeCharta/state/effects/nodeContextMenu/highlightButtons/highlightButtons.component.ts +39 -0
  34. package/app/codeCharta/state/effects/nodeContextMenu/highlightButtons/highlightButtons.module.ts +11 -0
  35. package/app/codeCharta/state/effects/nodeContextMenu/markFolderRow/markFolderRow.component.html +22 -0
  36. package/app/codeCharta/state/effects/nodeContextMenu/markFolderRow/markFolderRow.component.scss +31 -0
  37. package/app/codeCharta/state/effects/nodeContextMenu/markFolderRow/markFolderRow.component.spec.ts +35 -0
  38. package/app/codeCharta/state/effects/nodeContextMenu/markFolderRow/markFolderRow.component.ts +30 -0
  39. package/app/codeCharta/state/effects/nodeContextMenu/markFolderRow/markFolderRow.module.ts +11 -0
  40. package/app/codeCharta/state/effects/nodeContextMenu/markFolderRow/selectors/markFolderItems.selector.spec.ts +17 -0
  41. package/app/codeCharta/state/effects/nodeContextMenu/markFolderRow/selectors/markFolderItems.selector.ts +29 -0
  42. package/app/codeCharta/{ui → state/effects}/nodeContextMenu/nodeContextMenu.e2e.ts +4 -16
  43. package/app/codeCharta/{ui → state/effects}/nodeContextMenu/nodeContextMenu.po.ts +1 -1
  44. package/app/codeCharta/state/effects/nodeContextMenu/nodeContextMenu.service.spec.ts +78 -0
  45. package/app/codeCharta/state/effects/nodeContextMenu/nodeContextMenu.service.ts +72 -0
  46. package/app/codeCharta/state/effects/nodeContextMenu/nodeContextMenuCard/lastPartOfNodePath.pipe.spec.ts +11 -0
  47. package/app/codeCharta/state/effects/nodeContextMenu/nodeContextMenuCard/lastPartOfNodePath.pipe.ts +8 -0
  48. package/app/codeCharta/state/effects/nodeContextMenu/nodeContextMenuCard/nodeContextMenuCard.component.html +17 -0
  49. package/app/codeCharta/state/effects/nodeContextMenu/nodeContextMenuCard/nodeContextMenuCard.component.scss +34 -0
  50. package/app/codeCharta/state/effects/nodeContextMenu/nodeContextMenuCard/nodeContextMenuCard.component.spec.ts +49 -0
  51. package/app/codeCharta/state/effects/nodeContextMenu/nodeContextMenuCard/nodeContextMenuCard.component.ts +19 -0
  52. package/app/codeCharta/state/effects/nodeContextMenu/nodeContextMenuCard/nodeContextMenuCard.module.ts +18 -0
  53. package/app/codeCharta/state/effects/nodeContextMenu/openNodeContextMenu.effect.spec.ts +32 -0
  54. package/app/codeCharta/state/effects/nodeContextMenu/openNodeContextMenu.effect.ts +33 -0
  55. package/app/codeCharta/state/effects/nodeContextMenu/rightClickedCodeMapNode.selector.ts +8 -0
  56. package/app/codeCharta/state/effects/unfocusNodesOnLoadingMap.effect.spec.ts +47 -0
  57. package/app/codeCharta/state/effects/unfocusNodesOnLoadingMap.effect.ts +18 -0
  58. package/app/codeCharta/state/selectors/allNecessaryRenderDataAvailable/areAllNecessaryRenderDataAvailable.selector.ts +30 -0
  59. package/app/codeCharta/state/selectors/allNecessaryRenderDataAvailable/utils/areDynamicSettingsAvailable.spec.ts +36 -0
  60. package/app/codeCharta/state/selectors/allNecessaryRenderDataAvailable/utils/areDynamicSettingsAvailable.ts +10 -0
  61. package/app/codeCharta/state/selectors/allNecessaryRenderDataAvailable/utils/areMetricsAvailable.spec.ts +13 -0
  62. package/app/codeCharta/state/selectors/allNecessaryRenderDataAvailable/utils/areMetricsAvailable.ts +8 -0
  63. package/app/codeCharta/state/store/appSettings/appSettings.actions.ts +2 -0
  64. package/app/codeCharta/state/store/appSettings/appSettings.reducer.ts +2 -0
  65. package/app/codeCharta/state/store/appSettings/invertArea/invertArea.actions.ts +32 -0
  66. package/app/codeCharta/state/store/appSettings/invertArea/invertArea.reducer.spec.ts +26 -0
  67. package/app/codeCharta/state/store/appSettings/invertArea/invertArea.reducer.ts +12 -0
  68. package/app/codeCharta/state/store/appSettings/invertArea/invertArea.selector.ts +3 -0
  69. package/app/codeCharta/state/store/appSettings/isLoadingMap/isLoadingMap.reducer.spec.ts +14 -3
  70. package/app/codeCharta/state/store/appSettings/isLoadingMap/isLoadingMap.reducer.ts +41 -6
  71. package/app/codeCharta/state/store/appStatus/appStatus.reducer.ts +3 -1
  72. package/app/codeCharta/state/store/appStatus/appStatus.selector.ts +3 -0
  73. package/app/codeCharta/state/store/appStatus/rightClickedNodeData/rightClickedNodeData.actions.ts +23 -0
  74. package/app/codeCharta/state/store/appStatus/rightClickedNodeData/rightClickedNodeData.reducer.ts +15 -0
  75. package/app/codeCharta/state/store/appStatus/rightClickedNodeData/rightClickedNodeData.selector.ts +4 -0
  76. package/app/codeCharta/state/store/dynamicSettings/dynamicSettings.splitter.ts +2 -2
  77. package/app/codeCharta/state/store/dynamicSettings/focusedNodePath/currentFocused.selector.ts +8 -0
  78. package/app/codeCharta/state/store/dynamicSettings/focusedNodePath/focusedNodePath.actions.ts +27 -7
  79. package/app/codeCharta/state/store/dynamicSettings/focusedNodePath/focusedNodePath.reducer.spec.ts +27 -11
  80. package/app/codeCharta/state/store/dynamicSettings/focusedNodePath/focusedNodePath.reducer.ts +11 -5
  81. package/app/codeCharta/state/store/dynamicSettings/focusedNodePath/focusedNodePath.selector.ts +4 -0
  82. package/app/codeCharta/state/store/dynamicSettings/focusedNodePath/focusedNodePath.service.spec.ts +2 -2
  83. package/app/codeCharta/state/store/dynamicSettings/focusedNodePath/focusedNodePath.service.ts +1 -1
  84. package/app/codeCharta/state/store/fileSettings/blacklist/blacklist.actions.ts +33 -2
  85. package/app/codeCharta/state/store/fileSettings/blacklist/blacklist.reducer.spec.ts +17 -1
  86. package/app/codeCharta/state/store/fileSettings/blacklist/blacklist.reducer.ts +3 -1
  87. package/app/codeCharta/state/store/fileSettings/blacklist/blacklist.service.spec.ts +1 -19
  88. package/app/codeCharta/state/store/fileSettings/blacklist/blacklist.service.ts +5 -28
  89. package/app/codeCharta/state/store/fileSettings/markedPackages/markedPackages.actions.ts +9 -10
  90. package/app/codeCharta/state/store/fileSettings/markedPackages/markedPackages.reducer.spec.ts +37 -7
  91. package/app/codeCharta/state/store/fileSettings/markedPackages/markedPackages.reducer.ts +7 -3
  92. package/app/codeCharta/state/store/fileSettings/markedPackages/util/findIndexOfMarkedPackageOrParent.spec.ts +39 -0
  93. package/app/codeCharta/state/store/fileSettings/markedPackages/util/findIndexOfMarkedPackageOrParent.ts +19 -0
  94. package/app/codeCharta/state/store/lookUp/idToNode/idToNode.selector.ts +4 -0
  95. package/app/codeCharta/state/store/lookUp/lookUp.selector.ts +3 -0
  96. package/app/codeCharta/state/store/metricData/nodeMetricData/nodeMetricData.service.ts +0 -4
  97. package/app/codeCharta/state/store/state.actions.ts +3 -1
  98. package/app/codeCharta/state/store/state.splitter.spec.ts +4 -4
  99. package/app/codeCharta/state/store/store.ts +5 -1
  100. package/app/codeCharta/state/store.service.spec.ts +21 -8
  101. package/app/codeCharta/state/store.service.ts +3 -31
  102. package/app/codeCharta/ui/areaSettingsPanel/areaSettingsPanel.component.html +3 -1
  103. package/app/codeCharta/ui/areaSettingsPanel/areaSettingsPanel.component.scss +6 -2
  104. package/app/codeCharta/ui/areaSettingsPanel/areaSettingsPanel.component.ts +1 -1
  105. package/app/codeCharta/ui/areaSettingsPanel/areaSettingsPanel.module.ts +3 -0
  106. package/app/codeCharta/ui/areaSettingsPanel/areaSettingsPanel.po.ts +4 -4
  107. package/app/codeCharta/ui/areaSettingsPanel/invertAreaOption/invertAreaOption.component.html +1 -0
  108. package/app/codeCharta/ui/areaSettingsPanel/invertAreaOption/invertAreaOption.component.scss +26 -0
  109. package/app/codeCharta/ui/areaSettingsPanel/invertAreaOption/invertAreaOption.component.spec.ts +29 -0
  110. package/app/codeCharta/ui/areaSettingsPanel/invertAreaOption/invertAreaOption.component.ts +24 -0
  111. package/app/codeCharta/ui/artificialIntelligence/__snapshots__/artificialIntelligence.component.spec.ts.snap +13 -16
  112. package/app/codeCharta/ui/artificialIntelligence/artificialIntelligence.component.html +4 -4
  113. package/app/codeCharta/ui/artificialIntelligence/artificialIntelligence.component.scss +0 -4
  114. package/app/codeCharta/ui/artificialIntelligence/artificialIntelligence.component.spec.ts +82 -52
  115. package/app/codeCharta/ui/artificialIntelligence/artificialIntelligence.component.ts +41 -101
  116. package/app/codeCharta/ui/attributeSideBar/attributeTypeSelector/aggregationType.pipe.spec.ts +19 -0
  117. package/app/codeCharta/ui/attributeSideBar/attributeTypeSelector/{aggregationSymbol.pipe.ts → aggregationType.pipe.ts} +4 -4
  118. package/app/codeCharta/ui/attributeSideBar/attributeTypeSelector/attributeTypeSelector.component.html +4 -12
  119. package/app/codeCharta/ui/attributeSideBar/attributeTypeSelector/attributeTypeSelector.component.scss +11 -20
  120. package/app/codeCharta/ui/attributeSideBar/attributeTypeSelector/attributeTypeSelector.component.spec.ts +8 -15
  121. package/app/codeCharta/ui/attributeSideBar/attributeTypeSelector/attributeTypeSelector.module.ts +2 -2
  122. package/app/codeCharta/ui/codeMap/__snapshots__/codeMap.arrow.service.spec.ts.snap +2 -2
  123. package/app/codeCharta/ui/codeMap/codeMap.actions.service.ts +1 -40
  124. package/app/codeCharta/ui/codeMap/codeMap.mouseEvent.service.ts +8 -16
  125. package/app/codeCharta/ui/codeMap/codeMap.preRender.service.spec.ts +1 -9
  126. package/app/codeCharta/ui/codeMap/codeMap.preRender.service.ts +9 -32
  127. package/app/codeCharta/ui/codeMap/rendering/codeMapMesh.ts +1 -0
  128. package/app/codeCharta/ui/colorPicker/colorPicker.component.html +16 -7
  129. package/app/codeCharta/ui/colorPicker/colorPicker.component.spec.ts +55 -16
  130. package/app/codeCharta/ui/colorPicker/colorPicker.component.ts +32 -1
  131. package/app/codeCharta/ui/colorPicker/colorPicker.module.ts +3 -1
  132. package/app/codeCharta/ui/customConfigs/customConfigs.component.html +29 -11
  133. package/app/codeCharta/ui/customConfigs/customConfigs.component.scss +1 -0
  134. package/app/codeCharta/ui/customConfigs/customConfigs.component.spec.ts +123 -2
  135. package/app/codeCharta/ui/customConfigs/customConfigs.component.ts +56 -2
  136. package/app/codeCharta/ui/dialog/dialog.addCustomConfigSettings.component.html +2 -2
  137. package/app/codeCharta/ui/dialog/dialog.changelog.component.html +1 -1
  138. package/app/codeCharta/ui/dialog/dialog.changelog.component.scss +15 -0
  139. package/app/codeCharta/ui/dialog/dialog.changelog.component.spec.ts +15 -15
  140. package/app/codeCharta/ui/dialog/dialog.changelog.component.ts +2 -1
  141. package/app/codeCharta/ui/dialog/dialog.globalSettings.e2e.ts +1 -1
  142. package/app/codeCharta/ui/dialog/dialog.globalSettings.po.ts +1 -1
  143. package/app/codeCharta/ui/dialog/dialog.service.spec.ts +68 -0
  144. package/app/codeCharta/ui/dialog/dialog.service.ts +38 -17
  145. package/app/codeCharta/ui/dialogs/dialogs.ts +3 -0
  146. package/app/codeCharta/ui/dialogs/errorDialog/errorDialog.component.html +7 -0
  147. package/app/codeCharta/ui/dialogs/errorDialog/errorDialog.component.ts +9 -0
  148. package/app/codeCharta/ui/edgeChooser/edgeChooser.e2e.ts +3 -2
  149. package/app/codeCharta/ui/fileChooser/fileChooser.e2e.ts +5 -6
  150. package/app/codeCharta/ui/filePanel/filePanel.component.html +24 -106
  151. package/app/codeCharta/ui/filePanel/filePanel.component.scss +12 -57
  152. package/app/codeCharta/ui/filePanel/filePanel.component.spec.ts +40 -72
  153. package/app/codeCharta/ui/filePanel/filePanel.component.ts +29 -81
  154. package/app/codeCharta/ui/filePanel/filePanel.module.ts +13 -1
  155. package/app/codeCharta/ui/filePanel/filePanel.po.ts +6 -24
  156. package/app/codeCharta/ui/filePanel/filePanelDeltaSelector/filePanelDeltaSelector.component.html +23 -0
  157. package/app/codeCharta/ui/filePanel/filePanelDeltaSelector/filePanelDeltaSelector.component.ts +18 -0
  158. package/app/codeCharta/ui/filePanel/filePanelFileSelector/filePanelFileSelector.component.html +18 -0
  159. package/app/codeCharta/ui/filePanel/filePanelFileSelector/filePanelFileSelector.component.ts +16 -0
  160. package/app/codeCharta/ui/filePanel/filePanelStateButtons/filePanelStateButtons.component.html +18 -0
  161. package/app/codeCharta/ui/filePanel/filePanelStateButtons/filePanelStateButtons.component.ts +11 -0
  162. package/app/codeCharta/ui/labelledColorPicker/labelledColorPicker.component.html +21 -13
  163. package/app/codeCharta/ui/labelledColorPicker/labelledColorPicker.component.spec.ts +11 -24
  164. package/app/codeCharta/ui/labelledColorPicker/labelledColorPicker.component.ts +1 -40
  165. package/app/codeCharta/ui/labelledColorPicker/labelledColorPicker.module.ts +1 -2
  166. package/app/codeCharta/ui/legendPanel/legendMarkedPackages/legendMarkedPackages.component.ts +2 -2
  167. package/app/codeCharta/ui/mapTreeView/mapTreeView.level.e2e.ts +8 -6
  168. package/app/codeCharta/ui/mapTreeView/mapTreeView.level.po.ts +1 -1
  169. package/app/codeCharta/ui/mapTreeView/mapTreeViewLevel/mapTreeViewLevel.component.html +1 -1
  170. package/app/codeCharta/ui/mapTreeView/mapTreeViewLevel/mapTreeViewLevel.component.spec.ts +6 -16
  171. package/app/codeCharta/ui/mapTreeView/mapTreeViewLevel/mapTreeViewLevel.component.ts +15 -11
  172. package/app/codeCharta/ui/ribbonBar/ribbonBar.component.html +3 -3
  173. package/app/codeCharta/ui/ribbonBar/ribbonBar.e2e.ts +3 -3
  174. package/app/codeCharta/ui/searchBar/searchBar.component.html +5 -0
  175. package/app/codeCharta/ui/searchBar/searchBar.component.scss +11 -0
  176. package/app/codeCharta/ui/searchBar/searchBar.component.spec.ts +10 -0
  177. package/app/codeCharta/ui/searchBar/searchBar.component.ts +1 -1
  178. package/app/codeCharta/ui/sortingOption/sortingOption.component.spec.ts +1 -1
  179. package/app/codeCharta/ui/toolBar/toolBar.component.html +1 -1
  180. package/app/codeCharta/ui/toolBar/toolBar.component.scss +1 -1
  181. package/app/codeCharta/ui/ui.ts +2 -6
  182. package/app/codeCharta/util/algorithm/streetLayout/strip/strip.ts +2 -2
  183. package/app/codeCharta/util/algorithm/streetLayout/treeMap.ts +1 -1
  184. package/app/codeCharta/util/algorithm/treeMapLayout/treeMapGenerator.spec.ts +2 -2
  185. package/app/codeCharta/util/algorithm/treeMapLayout/treeMapGenerator.ts +14 -7
  186. package/app/codeCharta/util/algorithm/treeMapLayout/treeMapHelper.spec.ts +2 -2
  187. package/app/codeCharta/util/algorithm/treeMapLayout/treeMapHelper.ts +1 -1
  188. package/app/codeCharta/util/customConfigBuilder.ts +2 -1
  189. package/app/codeCharta/util/customConfigHelper.spec.ts +155 -60
  190. package/app/codeCharta/util/customConfigHelper.ts +33 -3
  191. package/app/codeCharta/util/dataMocks.ts +8 -4
  192. package/app/codeCharta/util/fileExtensionCalculator.ts +1 -1
  193. package/app/codeCharta/util/fileValidator.spec.ts +69 -182
  194. package/app/codeCharta/util/fileValidator.ts +61 -37
  195. package/app/codeCharta/util/reduxHelper.ts +11 -0
  196. package/app/material/material.module.ts +17 -1
  197. package/conf/webpack.loaders.js +4 -1
  198. package/dist/webpack/bundle.js +5925 -1896
  199. package/dist/webpack/bundle.js.map +1 -1
  200. package/package.json +7 -6
  201. package/app/codeCharta/state/store/dynamicSettings/focusedNodePath/focusedNodePath.splitter.ts +0 -8
  202. package/app/codeCharta/ui/attributeSideBar/attributeTypeSelector/aggregationSymbol.pipe.spec.ts +0 -19
  203. package/app/codeCharta/ui/codeMap/codeMap.actions.service.spec.ts +0 -147
  204. package/app/codeCharta/ui/nodeContextMenu/markFolderColorPicker/markFolderColorPicker.component.html +0 -5
  205. package/app/codeCharta/ui/nodeContextMenu/markFolderColorPicker/markFolderColorPicker.component.scss +0 -13
  206. package/app/codeCharta/ui/nodeContextMenu/markFolderColorPicker/markFolderColorPicker.component.ts +0 -30
  207. package/app/codeCharta/ui/nodeContextMenu/markFolderColorPicker/markFolderColorPicker.module.ts +0 -13
  208. package/app/codeCharta/ui/nodeContextMenu/nodeContextMenu.component.html +0 -68
  209. package/app/codeCharta/ui/nodeContextMenu/nodeContextMenu.component.scss +0 -52
  210. package/app/codeCharta/ui/nodeContextMenu/nodeContextMenu.component.spec.ts +0 -571
  211. package/app/codeCharta/ui/nodeContextMenu/nodeContextMenu.component.ts +0 -318
  212. package/app/codeCharta/ui/nodeContextMenu/nodeContextMenu.module.ts +0 -13
  213. package/app/codeCharta/ui/unfocusButton/unfocusButton.component.html +0 -15
  214. package/app/codeCharta/ui/unfocusButton/unfocusButton.component.scss +0 -5
  215. package/app/codeCharta/ui/unfocusButton/unfocusButton.component.spec.ts +0 -106
  216. package/app/codeCharta/ui/unfocusButton/unfocusButton.component.ts +0 -62
  217. package/app/codeCharta/ui/unfocusButton/unfocusButton.module.ts +0 -7
@@ -1,10 +1,12 @@
1
1
  import { BlacklistAction, BlacklistActions, setBlacklist } from "./blacklist.actions"
2
- import { addItemToArray, removeItemFromArray } from "../../../../util/reduxHelper"
2
+ import { addItemsToArray, addItemToArray, removeItemFromArray } from "../../../../util/reduxHelper"
3
3
 
4
4
  export function blacklist(state = setBlacklist().payload, action: BlacklistAction) {
5
5
  switch (action.type) {
6
6
  case BlacklistActions.ADD_BLACKLIST_ITEM:
7
7
  return addItemToArray(state, action.payload)
8
+ case BlacklistActions.ADD_BLACKLIST_ITEMS:
9
+ return addItemsToArray(state, action.payload)
8
10
  case BlacklistActions.REMOVE_BLACKLIST_ITEM:
9
11
  return removeItemFromArray(state, action.payload)
10
12
  case BlacklistActions.SET_BLACKLIST:
@@ -2,12 +2,11 @@ import "../../../state.module"
2
2
  import { IRootScopeService } from "angular"
3
3
  import { StoreService } from "../../../store.service"
4
4
  import { getService, instantiateModule } from "../../../../../../mocks/ng.mockhelper"
5
- import * as FilesHelper from "../../../../model/files/files.helper"
6
5
  import { BlacklistService } from "./blacklist.service"
7
6
  import { BlacklistAction, BlacklistActions } from "./blacklist.actions"
8
7
  import { BlacklistItem, BlacklistType } from "../../../../codeCharta.model"
9
8
  import { PresentationModeActions } from "../../appSettings/isPresentationMode/isPresentationMode.actions"
10
- import { FILE_STATES, withMockedEventMethods } from "../../../../util/dataMocks"
9
+ import { withMockedEventMethods } from "../../../../util/dataMocks"
11
10
  import { FilesService } from "../../files/files.service"
12
11
 
13
12
  describe("BlacklistService", () => {
@@ -67,21 +66,4 @@ describe("BlacklistService", () => {
67
66
  expect($rootScope.$broadcast).not.toHaveBeenCalled()
68
67
  })
69
68
  })
70
-
71
- describe("resultsInEmptyMap", () => {
72
- it("should return true when all files are empty", () => {
73
- jest.spyOn(FilesHelper, "getVisibleFileStates").mockReturnValue(FILE_STATES)
74
- const blacklistItem: BlacklistItem[] = [{ path: "/root", type: BlacklistType.exclude }]
75
-
76
- expect(blacklistService.resultsInEmptyMap(blacklistItem)).toBe(true)
77
- })
78
-
79
- it("should return false when files are left", () => {
80
- blacklistService.isIncludedNode = jest.fn(() => true)
81
- jest.spyOn(FilesHelper, "getVisibleFileStates").mockReturnValue(FILE_STATES)
82
- const blacklistItem: BlacklistItem[] = [{ path: "/root/Parent Leaf", type: BlacklistType.exclude }]
83
-
84
- expect(blacklistService.resultsInEmptyMap(blacklistItem)).toBe(false)
85
- })
86
- })
87
69
  })
@@ -1,14 +1,13 @@
1
1
  import { StoreService, StoreSubscriber } from "../../../store.service"
2
2
  import { IRootScopeService } from "angular"
3
- import { BlacklistItem, BlacklistType } from "../../../../codeCharta.model"
3
+ import { BlacklistItem } from "../../../../codeCharta.model"
4
4
  import { BlacklistActions, setBlacklist } from "./blacklist.actions"
5
5
  import { getMergedBlacklist } from "./blacklist.merger"
6
6
  import { FilesService, FilesSelectionSubscriber } from "../../files/files.service"
7
7
  import { isActionOfType } from "../../../../util/reduxHelper"
8
8
  import { getVisibleFiles, getVisibleFileStates, isPartialState } from "../../../../model/files/files.helper"
9
9
  import { FileState } from "../../../../model/files/files"
10
- import { hierarchy } from "d3-hierarchy"
11
- import { isLeaf, isPathBlacklisted } from "../../../../util/codeMapHelper"
10
+ import { resultsInEmptyMap } from "../../../effects/addBlacklistItemsIfNotResultsInEmptyMap/resultsInEmptyMap"
12
11
 
13
12
  export interface BlacklistSubscriber {
14
13
  onBlacklistChanged(blacklist: BlacklistItem[])
@@ -34,31 +33,9 @@ export class BlacklistService implements StoreSubscriber, FilesSelectionSubscrib
34
33
  }
35
34
 
36
35
  resultsInEmptyMap(blacklistItems: BlacklistItem[]) {
37
- const fileStates = getVisibleFileStates(this.storeService.getState().files)
38
- for (const { file } of fileStates) {
39
- if (!this.isEmptyFile(file, blacklistItems)) {
40
- return false
41
- }
42
- }
43
- return true
44
- }
45
-
46
- isIncludedNode(node, blacklist: Array<BlacklistItem>) {
47
- return isLeaf(node) && node.data.path && !isPathBlacklisted(node.data.path, blacklist, BlacklistType.exclude)
48
- }
49
-
50
- private isEmptyFile(file, blacklistItems: BlacklistItem[]) {
51
- const blacklist = [...this.storeService.getState().fileSettings.blacklist]
52
- for (const blacklistItem of blacklistItems) {
53
- blacklist.push(blacklistItem)
54
- }
55
-
56
- for (const node of hierarchy(file.map)) {
57
- if (this.isIncludedNode(node, blacklist)) {
58
- return false
59
- }
60
- }
61
- return true
36
+ const visibleFiles = getVisibleFileStates(this.storeService.getState().files)
37
+ const blacklist = this.storeService.getState().fileSettings.blacklist
38
+ return resultsInEmptyMap(visibleFiles, blacklist, blacklistItems)
62
39
  }
63
40
 
64
41
  private merge(files: FileState[]) {
@@ -1,14 +1,13 @@
1
- import { CCAction, MarkedPackage } from "../../../../codeCharta.model"
1
+ import { CCAction, CodeMapNode, MarkedPackage } from "../../../../codeCharta.model"
2
2
 
3
3
  export enum MarkedPackagesActions {
4
4
  SET_MARKED_PACKAGES = "SET_MARKED_PACKAGES",
5
- CALCULATE_MARKED_PACKAGES_FOR_PATHS = "CALCULATE_MARKED_PACKAGES",
6
5
  MARK_PACKAGE = "MARK_PACKAGE",
7
6
  UNMARK_PACKAGE = "UNMARK_PACKAGE"
8
7
  }
9
8
 
10
- export interface CalculateMarkedPackagesAction extends CCAction {
11
- type: MarkedPackagesActions.CALCULATE_MARKED_PACKAGES_FOR_PATHS
9
+ export interface MarkPackagesAction extends CCAction {
10
+ type: MarkedPackagesActions.MARK_PACKAGE
12
11
  payload: MarkedPackage[]
13
12
  }
14
13
 
@@ -19,14 +18,14 @@ export interface SetMarkedPackagesAction extends CCAction {
19
18
 
20
19
  export interface UnmarkPackageAction extends CCAction {
21
20
  type: MarkedPackagesActions.UNMARK_PACKAGE
22
- payload: number
21
+ payload: CodeMapNode["path"]
23
22
  }
24
23
 
25
- export type MarkedPackagesAction = SetMarkedPackagesAction | UnmarkPackageAction | CalculateMarkedPackagesAction
24
+ export type MarkedPackagesAction = SetMarkedPackagesAction | UnmarkPackageAction | MarkPackagesAction
26
25
 
27
- export function calculateMarkedPackages(packagesToBeMarked: MarkedPackage[]): CalculateMarkedPackagesAction {
26
+ export function markPackages(packagesToBeMarked: MarkedPackage[]): MarkPackagesAction {
28
27
  return {
29
- type: MarkedPackagesActions.CALCULATE_MARKED_PACKAGES_FOR_PATHS,
28
+ type: MarkedPackagesActions.MARK_PACKAGE,
30
29
  payload: packagesToBeMarked
31
30
  }
32
31
  }
@@ -38,10 +37,10 @@ export function setMarkedPackages(markedPackages: MarkedPackage[] = defaultMarke
38
37
  }
39
38
  }
40
39
 
41
- export function unmarkPackage(index: number): UnmarkPackageAction {
40
+ export function unmarkPackage(node: Pick<CodeMapNode, "path">): UnmarkPackageAction {
42
41
  return {
43
42
  type: MarkedPackagesActions.UNMARK_PACKAGE,
44
- payload: index
43
+ payload: node.path
45
44
  }
46
45
  }
47
46
 
@@ -1,5 +1,5 @@
1
1
  import { markedPackages } from "./markedPackages.reducer"
2
- import { MarkedPackagesAction, setMarkedPackages, calculateMarkedPackages, unmarkPackage } from "./markedPackages.actions"
2
+ import { MarkedPackagesAction, setMarkedPackages, markPackages, unmarkPackage } from "./markedPackages.actions"
3
3
  import { MARKED_PACKAGES } from "../../../../util/dataMocks"
4
4
 
5
5
  describe("markedPackages", () => {
@@ -26,17 +26,47 @@ describe("markedPackages", () => {
26
26
  })
27
27
 
28
28
  describe("Action: UNMARK_PACKAGE", () => {
29
- it("should remove a marked package from array", () => {
30
- const result = markedPackages([MARKED_PACKAGES[0]], unmarkPackage(0))
31
-
29
+ it("should remove a marked package", () => {
30
+ const result = markedPackages([{ path: "/root", color: "#000000" }], unmarkPackage({ path: "/root" }))
32
31
  expect(result).toEqual([])
33
32
  })
33
+
34
+ it("should remove nothing, if a parent of a marked node is unmarked", () => {
35
+ const result = markedPackages([{ path: "/root/child", color: "#000000" }], unmarkPackage({ path: "/root" }))
36
+ expect(result).toEqual([{ path: "/root/child", color: "#000000" }])
37
+ })
34
38
  })
35
39
 
36
- describe("Action: CALCULATE_MARKED_PACKAGES", () => {
37
- it("should add all packages", () => {
38
- const result = markedPackages([MARKED_PACKAGES[0]], calculateMarkedPackages(MARKED_PACKAGES.slice(1)))
40
+ describe("Action: MARK_PACKAGES", () => {
41
+ it("should add a package", () => {
42
+ const result = markedPackages([MARKED_PACKAGES[0]], markPackages(MARKED_PACKAGES.slice(1)))
39
43
  expect(result).toEqual(MARKED_PACKAGES)
40
44
  })
45
+
46
+ it("should remove the children of a marked package if children marked color is the same", () => {
47
+ const result = markedPackages([{ path: "/root/child", color: "#000000" }], markPackages([{ path: "/root", color: "#000000" }]))
48
+ expect(result.length).toBe(1)
49
+ expect(result[0]).toEqual({ path: "/root", color: "#000000" })
50
+ })
51
+
52
+ it("should not remove the children of a marked package if color is different", () => {
53
+ const result = markedPackages([{ path: "/root/child", color: "#000000" }], markPackages([{ path: "/root", color: "#ffffff" }]))
54
+ expect(result.length).toBe(2)
55
+ expect(result[0]).toEqual({ path: "/root/child", color: "#000000" })
56
+ expect(result[1]).toEqual({ path: "/root", color: "#ffffff" })
57
+ })
58
+
59
+ it("should replace package if it was already marked", () => {
60
+ const result = markedPackages(
61
+ [
62
+ { path: "/root", color: "#ffffff" },
63
+ { path: "/root/child", color: "#000000" }
64
+ ],
65
+ markPackages([{ path: "/root", color: "#333333" }])
66
+ )
67
+ expect(result.length).toBe(2)
68
+ expect(result[0]).toEqual({ path: "/root", color: "#333333" })
69
+ expect(result[1]).toEqual({ path: "/root/child", color: "#000000" })
70
+ })
41
71
  })
42
72
  })
@@ -1,14 +1,18 @@
1
1
  import { MarkedPackagesAction, MarkedPackagesActions, setMarkedPackages } from "./markedPackages.actions"
2
2
  import { removeEntryAtIndexFromArray } from "../../../../util/reduxHelper"
3
3
  import { addMarkedPackage } from "./util/addMarkedPackage"
4
+ import { findIndexOfMarkedPackageOrParent } from "./util/findIndexOfMarkedPackageOrParent"
4
5
 
5
6
  export function markedPackages(state = setMarkedPackages().payload, action: MarkedPackagesAction) {
6
7
  switch (action.type) {
7
8
  case MarkedPackagesActions.SET_MARKED_PACKAGES:
8
9
  return action.payload
9
- case MarkedPackagesActions.UNMARK_PACKAGE:
10
- return removeEntryAtIndexFromArray(state, action.payload)
11
- case MarkedPackagesActions.CALCULATE_MARKED_PACKAGES_FOR_PATHS: {
10
+ case MarkedPackagesActions.UNMARK_PACKAGE: {
11
+ const indexOfPackageToBeUnmarked = findIndexOfMarkedPackageOrParent(state, action.payload)
12
+ if (indexOfPackageToBeUnmarked !== -1) return removeEntryAtIndexFromArray(state, indexOfPackageToBeUnmarked)
13
+ return state
14
+ }
15
+ case MarkedPackagesActions.MARK_PACKAGE: {
12
16
  const markedPackagesMap = new Map(state.map(entry => [entry.path, entry]))
13
17
 
14
18
  for (const markedPackage of action.payload) {
@@ -0,0 +1,39 @@
1
+ import { findIndexOfMarkedPackageOrParent } from "./findIndexOfMarkedPackageOrParent"
2
+
3
+ describe("findIndexOfMarkedPackageOrParent", () => {
4
+ it("should return -1 if given path is neither marked nor a child of a marked package", () => {
5
+ expect(
6
+ findIndexOfMarkedPackageOrParent(
7
+ [
8
+ { path: "/root/child/grandchild", color: "#ffffff" },
9
+ { path: "/root/child", color: "#000000" }
10
+ ],
11
+ "/root/wolf"
12
+ )
13
+ ).toBe(-1)
14
+ })
15
+
16
+ it("should find exact package even if a children was marked previously", () => {
17
+ expect(
18
+ findIndexOfMarkedPackageOrParent(
19
+ [
20
+ { path: "/root/child/grandchild", color: "#ffffff" },
21
+ { path: "/root/child", color: "#000000" }
22
+ ],
23
+ "/root/child"
24
+ )
25
+ ).toBe(1)
26
+ })
27
+
28
+ it("should find closest parent if given path is not marked", () => {
29
+ expect(
30
+ findIndexOfMarkedPackageOrParent(
31
+ [
32
+ { path: "/root/child", color: "#000000" },
33
+ { path: "/root/child/grandchild", color: "#ffffff" }
34
+ ],
35
+ "/root/child/grandchild/grandgrandchild"
36
+ )
37
+ ).toBe(1)
38
+ })
39
+ })
@@ -0,0 +1,19 @@
1
+ import { MarkedPackage } from "../../../../../codeCharta.model"
2
+
3
+ /** @return index of exact match if there is an exact match. Otherwise return index of parent or -1 */
4
+ export const findIndexOfMarkedPackageOrParent = (markedPackages: MarkedPackage[], nodePath: string) => {
5
+ const indexOfNodePath = markedPackages.findIndex(mp => mp.path === nodePath)
6
+ if (indexOfNodePath !== -1) return indexOfNodePath
7
+
8
+ let indexOfNearestParent = -1
9
+ for (let loopIndex = 0; loopIndex < markedPackages.length; loopIndex++) {
10
+ const markedPackage = markedPackages[loopIndex]
11
+ if (
12
+ nodePath.startsWith(markedPackage.path) &&
13
+ (indexOfNearestParent === -1 || markedPackages[indexOfNearestParent].path.length < markedPackage.path.length)
14
+ )
15
+ indexOfNearestParent = loopIndex
16
+ }
17
+
18
+ return indexOfNearestParent
19
+ }
@@ -0,0 +1,4 @@
1
+ import { createSelector } from "../../../angular-redux/createSelector"
2
+ import { lookUpSelector } from "../lookUp.selector"
3
+
4
+ export const idToNodeSelector = createSelector([lookUpSelector], lookUp => lookUp.idToNode)
@@ -0,0 +1,3 @@
1
+ import { CcState } from "../store"
2
+
3
+ export const lookUpSelector = (state: CcState) => state.lookUp
@@ -40,10 +40,6 @@ export class NodeMetricDataService implements FilesSelectionSubscriber, Blacklis
40
40
  return this.nodeMetricData.map(x => x.name)
41
41
  }
42
42
 
43
- isMetricAvailable(metricName: string) {
44
- return this.nodeMetricData.some(x => x.name === metricName)
45
- }
46
-
47
43
  getMaxValueOfMetric(metricName: string) {
48
44
  const metric = this.nodeMetricData.find(x => x.name === metricName)
49
45
  return metric?.maxValue
@@ -8,6 +8,7 @@ import { defaultTreeMapSettings } from "./treeMap/treeMap.actions"
8
8
  import { defaultFiles } from "./files/files.actions"
9
9
  import { defaultHoveredBuildingPath } from "./appStatus/hoveredBuildingPath/hoveredBuildingPath.actions"
10
10
  import { defaultSelectedBuildingId } from "./appStatus/selectedBuildingId/selectedBuildingId.actions"
11
+ import { defaultRightClickedNodeData } from "./appStatus/rightClickedNodeData/rightClickedNodeData.actions"
11
12
 
12
13
  export enum StateActions {
13
14
  SET_STATE = "SET_STATE"
@@ -36,6 +37,7 @@ export const defaultState: State = {
36
37
  files: defaultFiles,
37
38
  appStatus: {
38
39
  hoveredBuildingPath: defaultHoveredBuildingPath,
39
- selectedBuildingId: defaultSelectedBuildingId
40
+ selectedBuildingId: defaultSelectedBuildingId,
41
+ rightClickedNodeData: defaultRightClickedNodeData
40
42
  }
41
43
  }
@@ -40,7 +40,7 @@ describe("state.splitter", () => {
40
40
  it("should return 1 FOCUS_NODE action", () => {
41
41
  const partialState: RecursivePartial<State> = {
42
42
  dynamicSettings: {
43
- focusedNodePath: "/some/path"
43
+ focusedNodePath: ["/some/path"]
44
44
  }
45
45
  }
46
46
 
@@ -48,7 +48,7 @@ describe("state.splitter", () => {
48
48
 
49
49
  expect(result.length).toEqual(1)
50
50
 
51
- expect(result[0].type).toEqual(FocusedNodePathActions.FOCUS_NODE)
51
+ expect(result[0].type).toEqual(FocusedNodePathActions.SET_ALL_FOCUSED_NODES)
52
52
  })
53
53
 
54
54
  it("should return 3 atomic actions from different parts of the state", () => {
@@ -80,13 +80,13 @@ describe("state.splitter", () => {
80
80
  describe("setDynamicSettings", () => {
81
81
  it("should return 1 FOCUS_NODE action", () => {
82
82
  const partialDynamicSettings: RecursivePartial<DynamicSettings> = {
83
- focusedNodePath: "/some/path"
83
+ focusedNodePath: ["/some/path"]
84
84
  }
85
85
 
86
86
  const result: CCAction[] = splitStateActions(setDynamicSettings(partialDynamicSettings))
87
87
 
88
88
  expect(result.length).toEqual(1)
89
- expect(result[0].type).toEqual(FocusedNodePathActions.FOCUS_NODE)
89
+ expect(result[0].type).toEqual(FocusedNodePathActions.SET_ALL_FOCUSED_NODES)
90
90
  expect(result[0].payload).toEqual(partialDynamicSettings.focusedNodePath)
91
91
  })
92
92
  })
@@ -1,4 +1,4 @@
1
- import { createStore } from "redux"
1
+ import { Action, createStore } from "redux"
2
2
 
3
3
  import rootReducer from "./state.reducer"
4
4
 
@@ -20,4 +20,8 @@ export class Store {
20
20
  if (!Store._store) Store.initialize()
21
21
  return Store._store
22
22
  }
23
+
24
+ static dispatch(action: Action) {
25
+ Store.store.dispatch(action)
26
+ }
23
27
  }
@@ -10,7 +10,9 @@ import { setDynamicSettings } from "./store/dynamicSettings/dynamicSettings.acti
10
10
  import { setMargin } from "./store/dynamicSettings/margin/margin.actions"
11
11
  import { setCamera } from "./store/appSettings/camera/camera.actions"
12
12
  import { setIsLoadingMap } from "./store/appSettings/isLoadingMap/isLoadingMap.actions"
13
- import { setIsLoadingFile } from "./store/appSettings/isLoadingFile/isLoadingFile.actions"
13
+ import { toggleSortingOrderAscending } from "./store/appSettings/sortingOrderAscending/sortingOrderAscending.actions"
14
+ import { EffectsModule } from "./angular-redux/effects/effects.module"
15
+ import { Subject } from "rxjs"
14
16
 
15
17
  describe("StoreService", () => {
16
18
  let storeService: StoreService
@@ -110,19 +112,30 @@ describe("StoreService", () => {
110
112
  expect($rootScope.$broadcast).not.toHaveBeenCalled()
111
113
  })
112
114
 
113
- it("should dispatch an action silently and not show the loading-gif", () => {
115
+ it("should show not the loading-gif when an action is triggered, that doesn't change the loading-gif state", () => {
114
116
  storeService.dispatch(setIsLoadingMap(false))
115
-
116
- storeService.dispatch(setCamera(), { silent: true })
117
+ storeService.dispatch(toggleSortingOrderAscending())
117
118
 
118
119
  expect(storeService.getState().appSettings.isLoadingMap).toBeFalsy()
119
120
  })
120
121
 
121
- it("should show not the loading-gif when an action is triggered, that changes the loading-gif state", () => {
122
- storeService.dispatch(setIsLoadingMap(false))
123
- storeService.dispatch(setIsLoadingFile(false))
122
+ describe("connection to action subject", () => {
123
+ beforeEach(() => {
124
+ EffectsModule.actions$ = new Subject()
125
+ })
124
126
 
125
- expect(storeService.getState().appSettings.isLoadingMap).toBeFalsy()
127
+ afterEach(() => {
128
+ EffectsModule.actions$.complete()
129
+ })
130
+
131
+ it("should trigger a new action value on dispatch", () => {
132
+ const subscription = jest.fn()
133
+ EffectsModule.actions$.subscribe(subscription)
134
+
135
+ storeService.dispatch({ type: "something" })
136
+
137
+ expect(subscription).toHaveBeenCalledWith({ type: "something" })
138
+ })
126
139
  })
127
140
  })
128
141
  })
@@ -1,19 +1,8 @@
1
1
  import { IRootScopeService } from "angular"
2
2
  import { splitStateActions } from "./store/state.splitter"
3
- import { IsLoadingMapActions, setIsLoadingMap } from "./store/appSettings/isLoadingMap/isLoadingMap.actions"
4
- import { IsLoadingFileActions } from "./store/appSettings/isLoadingFile/isLoadingFile.actions"
5
3
  import { CCAction, State } from "../codeCharta.model"
6
- import { SearchPanelModeActions } from "./store/appSettings/searchPanelMode/searchPanelMode.actions"
7
- import { isActionOfType } from "../util/reduxHelper"
8
- import { SortingOrderAscendingActions } from "./store/appSettings/sortingOrderAscending/sortingOrderAscending.actions"
9
- import { SortingOptionActions } from "./store/dynamicSettings/sortingOption/sortingOption.actions"
10
- import { IsAttributeSideBarVisibleActions } from "./store/appSettings/isAttributeSideBarVisible/isAttributeSideBarVisible.actions"
11
- import { PanelSelectionActions } from "./store/appSettings/panelSelection/panelSelection.actions"
12
- import { PresentationModeActions } from "./store/appSettings/isPresentationMode/isPresentationMode.actions"
13
- import { ExperimentalFeaturesEnabledActions } from "./store/appSettings/enableExperimentalFeatures/experimentalFeaturesEnabled.actions"
14
4
  import { Store } from "./store/store"
15
- import { ScreenshotToClipboardEnabledActions } from "./store/appSettings/enableClipboard/screenshotToClipboardEnabled.actions"
16
- import { HoveredBuildingPathActions } from "./store/appStatus/hoveredBuildingPath/hoveredBuildingPath.actions"
5
+ import { EffectsModule } from "./angular-redux/effects/effects.module"
17
6
 
18
7
  export interface StoreSubscriber {
19
8
  onStoreChanged(actionType: string)
@@ -46,25 +35,6 @@ export class StoreService {
46
35
  }
47
36
 
48
37
  dispatch(action: CCAction, options: DispatchOptions = { silent: false }) {
49
- if (
50
- !(
51
- isActionOfType(action.type, IsLoadingMapActions) ||
52
- isActionOfType(action.type, IsLoadingFileActions) ||
53
- isActionOfType(action.type, SortingOrderAscendingActions) ||
54
- isActionOfType(action.type, SearchPanelModeActions) ||
55
- isActionOfType(action.type, SortingOptionActions) ||
56
- isActionOfType(action.type, IsAttributeSideBarVisibleActions) ||
57
- isActionOfType(action.type, PanelSelectionActions) ||
58
- isActionOfType(action.type, PresentationModeActions) ||
59
- isActionOfType(action.type, ExperimentalFeaturesEnabledActions) ||
60
- isActionOfType(action.type, ScreenshotToClipboardEnabledActions) ||
61
- isActionOfType(action.type, HoveredBuildingPathActions) ||
62
- options.silent
63
- )
64
- ) {
65
- this.dispatch(setIsLoadingMap(true))
66
- }
67
-
68
38
  for (const atomicAction of splitStateActions(action)) {
69
39
  this.originalDispatch(atomicAction)
70
40
  if (!options.silent) {
@@ -72,6 +42,8 @@ export class StoreService {
72
42
  this.notifyExtended(atomicAction.type, atomicAction.payload)
73
43
  }
74
44
  }
45
+
46
+ EffectsModule.actions$.next(action)
75
47
  }
76
48
 
77
49
  getState(): State {
@@ -33,7 +33,7 @@
33
33
  ng-change="$ctrl.applyDynamicMargin()"
34
34
  title="Set margin to default (50px)."
35
35
  >
36
- Default margin (50px)
36
+ <span class="default-margin-text">Default margin (50px)</span>
37
37
  </md-checkbox>
38
38
  </md-input-container>
39
39
 
@@ -42,3 +42,5 @@
42
42
  tooltip="Reset area metric settings to their defaults"
43
43
  ></reset-settings-button-component>
44
44
  </div>
45
+
46
+ <cc-invert-area-option></cc-invert-area-option>
@@ -1,4 +1,4 @@
1
- area-settings-panel-component {
1
+ cc-area-settings-panel {
2
2
  background: white;
3
3
  border: 1px solid #b5b5b5;
4
4
  box-shadow: 0px 1px 3px 0px rgba(0, 0, 0, 0.2), 0px 1px 1px 0px rgba(0, 0, 0, 0.14), 0px 2px 1px -1px rgba(0, 0, 0, 0.12);
@@ -16,6 +16,10 @@ area-settings-panel-component {
16
16
  top: 45px;
17
17
  right: 0;
18
18
 
19
+ .md-primary .md-label {
20
+ padding-top: 3px;
21
+ }
22
+
19
23
  md-slider-container {
20
24
  position: relative;
21
25
  .slider-title {
@@ -37,7 +41,7 @@ area-settings-panel-component {
37
41
  }
38
42
  }
39
43
 
40
- area-settings-panel-component.hidden {
44
+ cc-area-settings-panel.hidden {
41
45
  max-height: 0;
42
46
  opacity: 0;
43
47
  transition: max-height 200ms ease-in-out, opacity 0ms 200ms;
@@ -55,7 +55,7 @@ export class AreaSettingsPanelController implements FilesSelectionSubscriber, Dy
55
55
  }
56
56
 
57
57
  export const areaSettingsPanelComponent = {
58
- selector: "areaSettingsPanelComponent",
58
+ selector: "ccAreaSettingsPanel",
59
59
  template: require("./areaSettingsPanel.component.html"),
60
60
  controller: AreaSettingsPanelController
61
61
  }
@@ -1,7 +1,10 @@
1
1
  import "../../state/state.module"
2
2
  import angular from "angular"
3
3
  import { areaSettingsPanelComponent } from "./areaSettingsPanel.component"
4
+ import { downgradeComponent } from "@angular/upgrade/static"
5
+ import { InvertAreaOptionComponent } from "./invertAreaOption/invertAreaOption.component"
4
6
 
5
7
  angular
6
8
  .module("app.codeCharta.ui.areaSettingsPanel", ["app.codeCharta.state", "app.codeCharta.ui.codeMap"])
7
9
  .component(areaSettingsPanelComponent.selector, areaSettingsPanelComponent)
10
+ .directive("ccInvertAreaOption", downgradeComponent({ component: InvertAreaOptionComponent }))
@@ -2,21 +2,21 @@ import { clickButtonOnPageElement } from "../../../puppeteer.helper"
2
2
 
3
3
  export const AreaSettingsPanelPageObject = {
4
4
  async toggleDefaultMargin() {
5
- await clickButtonOnPageElement("area-settings-panel-component md-checkbox")
5
+ await clickButtonOnPageElement("cc-area-settings-panel md-checkbox")
6
6
  return this.isDefaultMarginEnabled()
7
7
  },
8
8
 
9
9
  async isDefaultMarginEnabled() {
10
- return page.$eval("area-settings-panel-component md-checkbox", element => element.className.includes("md-checked"))
10
+ return page.$eval("cc-area-settings-panel md-checkbox", element => element.className.includes("md-checked"))
11
11
  },
12
12
 
13
13
  async toggleMarginBoundingBox() {
14
- const marginToggleBoxHandle = await page.$("area-settings-panel-component md-checkbox .md-container")
14
+ const marginToggleBoxHandle = await page.$("cc-area-settings-panel md-checkbox .md-container")
15
15
  return marginToggleBoxHandle.boundingBox()
16
16
  },
17
17
 
18
18
  async resetButtonBoundingBox() {
19
- const resetBoxHandle = await page.$("area-settings-panel-component reset-settings-button-component")
19
+ const resetBoxHandle = await page.$("cc-area-settings-panel reset-settings-button-component")
20
20
  return resetBoxHandle.boundingBox()
21
21
  }
22
22
  }
@@ -0,0 +1 @@
1
+ <mat-checkbox class="invertAreaCheckbox" [checked]="isInvertedArea$ | async" (change)="toggleInvertingArea()">Invert Area</mat-checkbox>
@@ -0,0 +1,26 @@
1
+ cc-invert-area-option {
2
+ .mat-checkbox-layout {
3
+ padding-left: 4px;
4
+
5
+ .mat-checkbox-inner-container {
6
+ margin-right: 15px;
7
+ }
8
+ }
9
+
10
+ .mat-checkbox-indeterminate.mat-accent .mat-checkbox-background,
11
+ .mat-checkbox-checked.mat-accent .mat-checkbox-background,
12
+ .mat-checkbox-checked:not(.mat-checkbox-disabled).mat-accent .mat-ripple-element,
13
+ .mat-checkbox:active:not(.mat-checkbox-disabled).mat-accent .mat-ripple-element {
14
+ background-color: rgb(0, 150, 136);
15
+ }
16
+
17
+ .mat-checkbox-frame,
18
+ .mat-checkbox-background,
19
+ .mat-checkbox-anim-unchecked-checked .mat-checkbox-anim-checked-unchecked {
20
+ transform: scale(1.1);
21
+ }
22
+
23
+ mat-checkbox.invertAreaCheckbox .mat-checkbox-checkmark-path {
24
+ stroke: black !important;
25
+ }
26
+ }
@@ -0,0 +1,29 @@
1
+ import { Store } from "../../../state/store/store"
2
+ import { InvertAreaOptionComponent } from "./invertAreaOption.component"
3
+ import { fireEvent, render } from "@testing-library/angular"
4
+ import { TestBed } from "@angular/core/testing"
5
+ import { MaterialModule } from "../../../../material/material.module"
6
+ import { invertAreaSelector } from "../../../state/store/appSettings/invertArea/invertArea.selector"
7
+
8
+ describe("InvertAreaOptionComponent", () => {
9
+ beforeEach(() => {
10
+ Store["initialize"]()
11
+ TestBed.configureTestingModule({
12
+ imports: [MaterialModule]
13
+ })
14
+ })
15
+
16
+ it("should toggle inverting the area of buildings on click", async () => {
17
+ const { container } = await render(InvertAreaOptionComponent)
18
+ const isInvertedArea = invertAreaSelector(Store.store.getState())
19
+ const checkbox = container.querySelector("input")
20
+
21
+ expect(checkbox.checked).toBeFalsy()
22
+
23
+ fireEvent.click(checkbox)
24
+
25
+ expect(checkbox.checked).toBeTruthy()
26
+
27
+ expect(invertAreaSelector(Store.store.getState())).toBe(!isInvertedArea)
28
+ })
29
+ })