codecharta-visualization 1.87.1 → 1.88.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/app/app.module.ts +18 -8
- package/app/codeCharta/codeCharta.component.ts +2 -0
- package/app/codeCharta/codeCharta.model.ts +2 -0
- package/app/codeCharta/codeCharta.service.spec.ts +41 -50
- package/app/codeCharta/codeCharta.service.ts +33 -32
- package/app/codeCharta/e2e/url.e2e.ts +1 -1
- package/app/codeCharta/state/store/appStatus/appStatus.reducer.ts +3 -1
- package/app/codeCharta/state/store/appStatus/appStatus.selector.ts +3 -0
- package/app/codeCharta/state/store/appStatus/rightClickedNodeData/rightClickedNodeData.actions.ts +23 -0
- package/app/codeCharta/state/store/appStatus/rightClickedNodeData/rightClickedNodeData.reducer.ts +15 -0
- package/app/codeCharta/state/store/appStatus/rightClickedNodeData/rightClickedNodeData.selector.ts +4 -0
- package/app/codeCharta/state/store/state.actions.ts +3 -1
- package/app/codeCharta/ui/codeMap/codeMap.mouseEvent.service.ts +6 -8
- package/app/codeCharta/ui/customConfigs/customConfigs.component.html +9 -9
- package/app/codeCharta/ui/dialog/dialog.addCustomConfigSettings.component.html +2 -2
- package/app/codeCharta/ui/dialog/dialog.changelog.component.scss +15 -0
- package/app/codeCharta/ui/dialog/dialog.changelog.component.spec.ts +15 -15
- package/app/codeCharta/ui/dialog/dialog.changelog.component.ts +2 -1
- package/app/codeCharta/ui/dialog/dialog.service.spec.ts +68 -0
- package/app/codeCharta/ui/dialog/dialog.service.ts +38 -17
- package/app/codeCharta/ui/edgeChooser/edgeChooser.e2e.ts +3 -2
- package/app/codeCharta/ui/fileChooser/fileChooser.e2e.ts +5 -6
- package/app/codeCharta/ui/filePanel/filePanel.component.html +24 -106
- package/app/codeCharta/ui/filePanel/filePanel.component.scss +12 -57
- package/app/codeCharta/ui/filePanel/filePanel.component.spec.ts +40 -72
- package/app/codeCharta/ui/filePanel/filePanel.component.ts +29 -81
- package/app/codeCharta/ui/filePanel/filePanel.module.ts +13 -1
- package/app/codeCharta/ui/filePanel/filePanel.po.ts +6 -24
- package/app/codeCharta/ui/filePanel/filePanelDeltaSelector/filePanelDeltaSelector.component.html +23 -0
- package/app/codeCharta/ui/filePanel/filePanelDeltaSelector/filePanelDeltaSelector.component.ts +18 -0
- package/app/codeCharta/ui/filePanel/filePanelFileSelector/filePanelFileSelector.component.html +18 -0
- package/app/codeCharta/ui/filePanel/filePanelFileSelector/filePanelFileSelector.component.ts +16 -0
- package/app/codeCharta/ui/filePanel/filePanelStateButtons/filePanelStateButtons.component.html +18 -0
- package/app/codeCharta/ui/filePanel/filePanelStateButtons/filePanelStateButtons.component.ts +11 -0
- package/app/codeCharta/ui/mapTreeView/mapTreeView.level.e2e.ts +7 -5
- package/app/codeCharta/ui/mapTreeView/mapTreeViewLevel/mapTreeViewLevel.component.html +1 -1
- package/app/codeCharta/ui/mapTreeView/mapTreeViewLevel/mapTreeViewLevel.component.spec.ts +6 -16
- package/app/codeCharta/ui/mapTreeView/mapTreeViewLevel/mapTreeViewLevel.component.ts +15 -11
- package/app/codeCharta/ui/nodeContextMenu/markFolderRow/markFolderRow.component.html +22 -0
- package/app/codeCharta/ui/nodeContextMenu/markFolderRow/markFolderRow.component.scss +31 -0
- package/app/codeCharta/ui/nodeContextMenu/markFolderRow/markFolderRow.component.spec.ts +35 -0
- package/app/codeCharta/ui/nodeContextMenu/markFolderRow/markFolderRow.component.ts +30 -0
- package/app/codeCharta/ui/nodeContextMenu/{markFolderColorPicker/markFolderColorPicker.module.ts → markFolderRow/markFolderRow.module.ts} +4 -5
- package/app/codeCharta/ui/nodeContextMenu/markFolderRow/selectors/markFolderItems.selector.spec.ts +17 -0
- package/app/codeCharta/ui/nodeContextMenu/markFolderRow/selectors/markFolderItems.selector.ts +29 -0
- package/app/codeCharta/ui/nodeContextMenu/markFolderRow/selectors/rightClickedNode.selector.spec.ts +15 -0
- package/app/codeCharta/ui/nodeContextMenu/markFolderRow/selectors/rightClickedNode.selector.ts +9 -0
- package/app/codeCharta/ui/nodeContextMenu/nodeContextMenu.component.html +2 -15
- package/app/codeCharta/ui/nodeContextMenu/nodeContextMenu.component.scss +0 -15
- package/app/codeCharta/ui/nodeContextMenu/nodeContextMenu.component.spec.ts +10 -119
- package/app/codeCharta/ui/nodeContextMenu/nodeContextMenu.component.ts +40 -134
- package/app/codeCharta/ui/nodeContextMenu/nodeContextMenu.module.ts +2 -2
- package/app/codeCharta/ui/ribbonBar/ribbonBar.component.html +1 -1
- package/app/codeCharta/ui/toolBar/toolBar.component.html +1 -1
- package/app/codeCharta/ui/toolBar/toolBar.component.scss +1 -1
- package/app/codeCharta/ui/ui.ts +2 -2
- package/app/codeCharta/util/customConfigHelper.spec.ts +155 -60
- package/app/codeCharta/util/customConfigHelper.ts +33 -3
- package/app/codeCharta/util/dataMocks.ts +4 -2
- package/app/codeCharta/util/fileValidator.spec.ts +69 -182
- package/app/codeCharta/util/fileValidator.ts +61 -37
- package/dist/webpack/bundle.js +852 -485
- package/dist/webpack/bundle.js.map +1 -1
- package/package.json +1 -1
- package/app/codeCharta/ui/nodeContextMenu/markFolderColorPicker/markFolderColorPicker.component.html +0 -9
- package/app/codeCharta/ui/nodeContextMenu/markFolderColorPicker/markFolderColorPicker.component.scss +0 -13
- package/app/codeCharta/ui/nodeContextMenu/markFolderColorPicker/markFolderColorPicker.component.ts +0 -10
|
@@ -1,5 +1,6 @@
|
|
|
1
1
|
import markdownFile from "../../../../../CHANGELOG.md"
|
|
2
2
|
import packageJson from "../../../../package.json"
|
|
3
|
+
import "./dialog.changelog.component.scss"
|
|
3
4
|
|
|
4
5
|
export class DialogChangelogController {
|
|
5
6
|
private _viewModel: {
|
|
@@ -35,7 +36,7 @@ export class DialogChangelogController {
|
|
|
35
36
|
const start = lineIndex + 2
|
|
36
37
|
const end = this.findEndChangesLine(changelogLines, lineIndex)
|
|
37
38
|
for (const changeLine of changelogLines.slice(start, end)) {
|
|
38
|
-
changelogTypes.push(changeLine)
|
|
39
|
+
changelogTypes.push(`${changeLine}<br>`)
|
|
39
40
|
}
|
|
40
41
|
}
|
|
41
42
|
if (changelogTypes.length > 0) changes[title] = changelogTypes.join("\n")
|
|
@@ -0,0 +1,68 @@
|
|
|
1
|
+
import "./dialog.module.ts"
|
|
2
|
+
import { getService, instantiateModule } from "../../../../mocks/ng.mockhelper"
|
|
3
|
+
import { DialogService } from "./dialog.service"
|
|
4
|
+
import { CCFileValidationResult } from "../../util/fileValidator"
|
|
5
|
+
|
|
6
|
+
describe("DialogService", () => {
|
|
7
|
+
let dialogService: DialogService
|
|
8
|
+
let $mdDialog
|
|
9
|
+
|
|
10
|
+
beforeEach(() => {
|
|
11
|
+
restartSystem()
|
|
12
|
+
rebuildController()
|
|
13
|
+
dialogService.showCustomDialog = jest.fn()
|
|
14
|
+
dialogService.showErrorDialog = jest.fn()
|
|
15
|
+
})
|
|
16
|
+
|
|
17
|
+
function restartSystem() {
|
|
18
|
+
instantiateModule("app.codeCharta.ui.dialog")
|
|
19
|
+
$mdDialog = getService("$mdDialog")
|
|
20
|
+
}
|
|
21
|
+
|
|
22
|
+
function rebuildController() {
|
|
23
|
+
dialogService = new DialogService($mdDialog)
|
|
24
|
+
}
|
|
25
|
+
|
|
26
|
+
it("should show AddCustomConfigSettings", function () {
|
|
27
|
+
dialogService.showAddCustomConfigSettings()
|
|
28
|
+
|
|
29
|
+
expect(dialogService.showCustomDialog).toHaveBeenCalled()
|
|
30
|
+
})
|
|
31
|
+
|
|
32
|
+
it("should show DownloadDialog", function () {
|
|
33
|
+
dialogService.showDownloadDialog()
|
|
34
|
+
|
|
35
|
+
expect(dialogService.showCustomDialog).toHaveBeenCalled()
|
|
36
|
+
})
|
|
37
|
+
|
|
38
|
+
it("should show AddScenarioSettings", function () {
|
|
39
|
+
dialogService.showAddScenarioSettings()
|
|
40
|
+
|
|
41
|
+
expect(dialogService.showCustomDialog).toHaveBeenCalled()
|
|
42
|
+
})
|
|
43
|
+
|
|
44
|
+
it("should show GlobalSettingsDialog", function () {
|
|
45
|
+
dialogService.showGlobalSettingsDialog()
|
|
46
|
+
|
|
47
|
+
expect(dialogService.showCustomDialog).toHaveBeenCalled()
|
|
48
|
+
})
|
|
49
|
+
|
|
50
|
+
it("should show ChangelogDialog", function () {
|
|
51
|
+
dialogService.showChangelogDialog()
|
|
52
|
+
|
|
53
|
+
expect(dialogService.showCustomDialog).toHaveBeenCalled()
|
|
54
|
+
})
|
|
55
|
+
|
|
56
|
+
it("should show ValidationDialog", function () {
|
|
57
|
+
const fileValidationResults: CCFileValidationResult[] = [
|
|
58
|
+
{ fileName: "file_1", errors: ["Error"], warnings: [] },
|
|
59
|
+
{ fileName: "file_2", errors: [], warnings: ["Warning"] }
|
|
60
|
+
]
|
|
61
|
+
dialogService.showValidationDialog(fileValidationResults)
|
|
62
|
+
|
|
63
|
+
expect(dialogService.showErrorDialog).toHaveBeenCalledWith(
|
|
64
|
+
`<h2>Errors</h2><p><strong>file_1:</strong> <p><i class="fa fa-exclamation-circle"></i> Error</p></p><h2>Warnings</h2><p><strong>file_2:</strong> <p><i class="fa fa-exclamation-triangle"></i> Warning</p></p>`,
|
|
65
|
+
"Something is wrong with the uploaded file(s)"
|
|
66
|
+
)
|
|
67
|
+
})
|
|
68
|
+
})
|
|
@@ -2,7 +2,7 @@ import { dialogDownloadComponent } from "./dialog.download.component"
|
|
|
2
2
|
import { dialogGlobalSettingsComponent } from "./dialog.globalSettings.component"
|
|
3
3
|
import { addScenarioSettingsComponent } from "./dialog.addScenarioSettings.component"
|
|
4
4
|
import { addCustomConfigSettingsComponent } from "./dialog.addCustomConfigSettings.component"
|
|
5
|
-
import {
|
|
5
|
+
import { CCFileValidationResult } from "../../util/fileValidator"
|
|
6
6
|
import { dialogChangelogComponent } from "./dialog.changelog.component"
|
|
7
7
|
|
|
8
8
|
export class DialogService {
|
|
@@ -38,26 +38,47 @@ export class DialogService {
|
|
|
38
38
|
await this.$mdDialog.show(this.$mdDialog.alert().clickOutsideToClose(true).title(title).htmlContent(message).ok(button))
|
|
39
39
|
}
|
|
40
40
|
|
|
41
|
-
async
|
|
42
|
-
const
|
|
43
|
-
|
|
44
|
-
|
|
41
|
+
async showValidationDialog(fileValidationResults: CCFileValidationResult[]) {
|
|
42
|
+
const htmlMessages = []
|
|
43
|
+
|
|
44
|
+
const filesWithErrors = fileValidationResults.filter(validationResult => {
|
|
45
|
+
return validationResult.errors.length > 0
|
|
46
|
+
})
|
|
47
|
+
if (filesWithErrors.length > 0) {
|
|
48
|
+
htmlMessages.push("<h2>Errors</h2>")
|
|
49
|
+
for (const fileWithErrors of filesWithErrors) {
|
|
50
|
+
const fileErrorMessage = this.buildFileErrorMessage(fileWithErrors)
|
|
51
|
+
htmlMessages.push(fileErrorMessage)
|
|
52
|
+
}
|
|
53
|
+
}
|
|
54
|
+
|
|
55
|
+
const filesWithWarnings = fileValidationResults.filter(validationResult => {
|
|
56
|
+
return validationResult.warnings.length > 0
|
|
57
|
+
})
|
|
58
|
+
if (filesWithWarnings.length > 0) {
|
|
59
|
+
htmlMessages.push("<h2>Warnings</h2>")
|
|
60
|
+
for (const fileWithWarnings of filesWithWarnings) {
|
|
61
|
+
const fileWarningMessage = this.buildFileWarningMessage(fileWithWarnings)
|
|
62
|
+
htmlMessages.push(fileWarningMessage)
|
|
63
|
+
}
|
|
64
|
+
}
|
|
65
|
+
await this.showErrorDialog(htmlMessages.join(""), "Something is wrong with the uploaded file(s)")
|
|
45
66
|
}
|
|
46
67
|
|
|
47
|
-
|
|
48
|
-
const warningSymbol = '<i class="fa fa-exclamation-triangle"></i> '
|
|
49
|
-
|
|
50
|
-
const htmlMessage = this.buildHtmlMessage(warningSymbol, validationResult.warning)
|
|
51
|
-
|
|
52
|
-
await this.showErrorDialog(htmlMessage, "Validation Warning")
|
|
53
|
-
}
|
|
54
|
-
|
|
55
|
-
async showValidationErrorDialog(validationResult: CCValidationResult) {
|
|
68
|
+
private buildFileErrorMessage(fileValidationResult) {
|
|
56
69
|
const errorSymbol = '<i class="fa fa-exclamation-circle"></i> '
|
|
70
|
+
return `<p><strong>${fileValidationResult.fileName}:</strong> ${this.buildHtmlMessage(
|
|
71
|
+
errorSymbol,
|
|
72
|
+
fileValidationResult.errors
|
|
73
|
+
)}</p>`
|
|
74
|
+
}
|
|
57
75
|
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
76
|
+
private buildFileWarningMessage(fileValidationResult) {
|
|
77
|
+
const warningSymbol = '<i class="fa fa-exclamation-triangle"></i> '
|
|
78
|
+
return `<p><strong>${fileValidationResult.fileName}:</strong> ${this.buildHtmlMessage(
|
|
79
|
+
warningSymbol,
|
|
80
|
+
fileValidationResult.warnings
|
|
81
|
+
)}</p>`
|
|
61
82
|
}
|
|
62
83
|
|
|
63
84
|
private buildHtmlMessage(symbol: string, validationResult: string[]) {
|
|
@@ -43,8 +43,9 @@ describe("MapTreeViewLevel", () => {
|
|
|
43
43
|
|
|
44
44
|
it("should not display the amount of incoming and outgoing edges of buildings for the none metric", async () => {
|
|
45
45
|
await searchPanel.toggle()
|
|
46
|
-
await mapTreeViewLevel.openFolder("/root/
|
|
47
|
-
await mapTreeViewLevel.
|
|
46
|
+
await mapTreeViewLevel.openFolder("/root/sample1.cc.json")
|
|
47
|
+
await mapTreeViewLevel.openFolder("/root/sample1.cc.json/ParentLeaf")
|
|
48
|
+
await mapTreeViewLevel.hoverNode("/root/sample1.cc.json/ParentLeaf/smallLeaf.html")
|
|
48
49
|
|
|
49
50
|
expect(await edgeChooser.isEdgeCountAvailable()).toBeFalsy()
|
|
50
51
|
})
|
|
@@ -50,7 +50,7 @@ describe("FileChooser", () => {
|
|
|
50
50
|
|
|
51
51
|
it("should open an invalid file, close the dialog and open a valid file", async () => {
|
|
52
52
|
await fileChooser.openFiles(["./app/codeCharta/assets/empty.png"])
|
|
53
|
-
expect(await dialogError.getMessage()).
|
|
53
|
+
expect(await dialogError.getMessage()).toContain(` ${ERROR_MESSAGES.fileIsInvalid}`)
|
|
54
54
|
|
|
55
55
|
await dialogError.clickOk()
|
|
56
56
|
|
|
@@ -61,7 +61,7 @@ describe("FileChooser", () => {
|
|
|
61
61
|
|
|
62
62
|
it("should open an valid and an invalid file, close the dialog and open a valid file", async () => {
|
|
63
63
|
await fileChooser.openFiles(["./app/codeCharta/assets/empty.png", "./app/codeCharta/assets/sample3.cc.json"])
|
|
64
|
-
expect(await dialogError.getMessage()).
|
|
64
|
+
expect(await dialogError.getMessage()).toContain(` ${ERROR_MESSAGES.fileIsInvalid}`)
|
|
65
65
|
|
|
66
66
|
await dialogError.clickOk()
|
|
67
67
|
|
|
@@ -73,10 +73,9 @@ describe("FileChooser", () => {
|
|
|
73
73
|
it("should not load a map and show error, when loading a map with warning and a map with error", async () => {
|
|
74
74
|
await fileChooser.openFiles(["./app/codeCharta/resources/sample1_with_api_warning.cc.json", "./app/codeCharta/assets/empty.png"])
|
|
75
75
|
|
|
76
|
-
|
|
77
|
-
|
|
78
|
-
|
|
79
|
-
expect(await dialogError.getMessage()).toEqual(` ${ERROR_MESSAGES.fileIsInvalid}`)
|
|
76
|
+
const dialogMessage = await dialogError.getMessage()
|
|
77
|
+
expect(dialogMessage).toContain(` ${ERROR_MESSAGES.minorApiVersionOutdated} Found: 1.5`)
|
|
78
|
+
expect(dialogMessage).toContain(` ${ERROR_MESSAGES.fileIsInvalid}`)
|
|
80
79
|
await dialogError.clickOk()
|
|
81
80
|
|
|
82
81
|
await fileChooser.openFiles(["./app/codeCharta/assets/sample3.cc.json"])
|
|
@@ -1,108 +1,26 @@
|
|
|
1
|
-
<
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
><span class="text">Single</span></md-button
|
|
7
|
-
>
|
|
8
|
-
<md-button
|
|
9
|
-
class="state-selector-button mode-selector middle"
|
|
10
|
-
ng-class="{ current: $ctrl._viewModel.isPartialState }"
|
|
11
|
-
ng-click="$ctrl.onPartialStateSelected()"
|
|
12
|
-
><span class="text">Multiple</span></md-button
|
|
13
|
-
>
|
|
14
|
-
<md-button
|
|
15
|
-
class="state-selector-button mode-selector right"
|
|
16
|
-
ng-class="{ current: $ctrl._viewModel.isDeltaState }"
|
|
17
|
-
ng-click="$ctrl.onDeltaStateSelected()"
|
|
18
|
-
><span class="text">Delta</span></md-button
|
|
19
|
-
>
|
|
20
|
-
</section>
|
|
1
|
+
<cc-file-panel-state-buttons
|
|
2
|
+
[is-delta-state]="$ctrl._viewModel.isDeltaState"
|
|
3
|
+
[handle-standard-button-clicked]="$ctrl.selectRecentPartialFiles"
|
|
4
|
+
[handle-delta-button-clicked]="$ctrl.onDeltaStateSelected"
|
|
5
|
+
></cc-file-panel-state-buttons>
|
|
21
6
|
|
|
22
|
-
<
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
<remove-file-button-component
|
|
34
|
-
on-remove-file="$ctrl.onRemoveFile(filename, state, event)"
|
|
35
|
-
ng-if="$ctrl._viewModel.files.length > 1"
|
|
36
|
-
filename="{{::fileState.file.fileMeta.fileName}}"
|
|
37
|
-
state="Single"
|
|
38
|
-
>
|
|
39
|
-
</remove-file-button-component>
|
|
40
|
-
</md-option>
|
|
41
|
-
</md-select>
|
|
42
|
-
</md-input-container>
|
|
7
|
+
<cc-file-panel-file-selector
|
|
8
|
+
style="display: inline-block; width: 200px"
|
|
9
|
+
ng-show="!$ctrl._viewModel.isDeltaState"
|
|
10
|
+
[selected-file-names]="$ctrl._viewModel.selectedFileNames.partial"
|
|
11
|
+
[handle-selected-files-changed]="$ctrl.onPartialFilesChange"
|
|
12
|
+
[handle-select-all-partial-files]="$ctrl.selectAllPartialFiles"
|
|
13
|
+
[handle-select-zero-partial-files]="$ctrl.selectZeroPartialFiles"
|
|
14
|
+
[handle-invert-selected-partial-files]="$ctrl.invertPartialFileSelection"
|
|
15
|
+
[handle-on-selection-closed]="$ctrl.onPartialSelectionClosed"
|
|
16
|
+
[files]="$ctrl._viewModel.files"
|
|
17
|
+
></cc-file-panel-file-selector>
|
|
43
18
|
|
|
44
|
-
<
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
<md-button ng-click="$ctrl.selectAllPartialFiles()">All</md-button>
|
|
53
|
-
<md-button ng-click="$ctrl.selectZeroPartialFiles()">None</md-button>
|
|
54
|
-
<md-button ng-click="$ctrl.invertPartialFileSelection()">Invert</md-button>
|
|
55
|
-
|
|
56
|
-
<md-option
|
|
57
|
-
ng-repeat="fileState in $ctrl._viewModel.files track by fileState.file.fileMeta.fileName"
|
|
58
|
-
value="{{::fileState.file.fileMeta.fileName}}"
|
|
59
|
-
>
|
|
60
|
-
<md-truncate>{{::fileState.file.fileMeta.fileName}}</md-truncate>
|
|
61
|
-
<remove-file-button-component
|
|
62
|
-
on-remove-file="$ctrl.onRemoveFile(filename, state, event)"
|
|
63
|
-
ng-if="$ctrl._viewModel.files.length > 1"
|
|
64
|
-
filename="{{::fileState.file.fileMeta.fileName}}"
|
|
65
|
-
state="Partial"
|
|
66
|
-
>
|
|
67
|
-
</remove-file-button-component>
|
|
68
|
-
</md-option>
|
|
69
|
-
</md-select>
|
|
70
|
-
</md-input-container>
|
|
71
|
-
|
|
72
|
-
<div class="input-container delta-chooser" ng-show="$ctrl._viewModel.isDeltaState">
|
|
73
|
-
<div class="pictogram" ng-style="{ background: $ctrl._viewModel.pictogramFirstFileColor }"></div>
|
|
74
|
-
<md-input-container class="delta-select input-container" title="Select reference file">
|
|
75
|
-
<md-select
|
|
76
|
-
ng-model="$ctrl._viewModel.selectedFileNames.delta.reference"
|
|
77
|
-
ng-change="$ctrl.onDeltaReferenceFileChange($ctrl._viewModel.selectedFileNames.delta.reference)"
|
|
78
|
-
>
|
|
79
|
-
<md-option
|
|
80
|
-
ng-repeat="fileState in $ctrl._viewModel.files track by fileState.file.fileMeta.fileName"
|
|
81
|
-
value="{{::fileState.file.fileMeta.fileName}}"
|
|
82
|
-
>
|
|
83
|
-
<md-truncate>{{::fileState.file.fileMeta.fileName}}</md-truncate>
|
|
84
|
-
</md-option>
|
|
85
|
-
</md-select>
|
|
86
|
-
</md-input-container>
|
|
87
|
-
|
|
88
|
-
<div
|
|
89
|
-
class="pictogram"
|
|
90
|
-
ng-style="{
|
|
91
|
-
background:
|
|
92
|
-
'linear-gradient(' + $ctrl._viewModel.pictogramUpperColor + ' 50%, ' + $ctrl._viewModel.pictogramLowerColor + ' 50%)'
|
|
93
|
-
}"
|
|
94
|
-
></div>
|
|
95
|
-
<md-input-container class="input-container delta-select" title="Select comparison file">
|
|
96
|
-
<md-select
|
|
97
|
-
ng-model="$ctrl._viewModel.selectedFileNames.delta.comparison"
|
|
98
|
-
ng-change="$ctrl.onDeltaComparisonFileChange($ctrl._viewModel.selectedFileNames.delta.comparison)"
|
|
99
|
-
>
|
|
100
|
-
<md-option
|
|
101
|
-
ng-repeat="fileState in $ctrl._viewModel.files track by fileState.file.fileMeta.fileName"
|
|
102
|
-
value="{{::fileState.file.fileMeta.fileName}}"
|
|
103
|
-
>
|
|
104
|
-
<md-truncate>{{::fileState.file.fileMeta.fileName}}</md-truncate>
|
|
105
|
-
</md-option>
|
|
106
|
-
</md-select>
|
|
107
|
-
</md-input-container>
|
|
108
|
-
</div>
|
|
19
|
+
<cc-file-panel-delta-selector
|
|
20
|
+
ng-show="$ctrl._viewModel.isDeltaState"
|
|
21
|
+
[pictogram-upper-color]="$ctrl._viewModel.pictogramUpperColor"
|
|
22
|
+
[pictogram-lower-color]="$ctrl._viewModel.pictogramLowerColor"
|
|
23
|
+
[handle-delta-reference-file-change]="$ctrl.onDeltaReferenceFileChange"
|
|
24
|
+
[handle-delta-comparison-file-change]="$ctrl.onDeltaComparisonFileChange"
|
|
25
|
+
[files]="$ctrl._viewModel.files"
|
|
26
|
+
></cc-file-panel-delta-selector>
|
|
@@ -1,12 +1,10 @@
|
|
|
1
|
-
file-panel
|
|
1
|
+
cc-file-panel {
|
|
2
2
|
width: calc(100% - 150px);
|
|
3
3
|
min-width: 400px;
|
|
4
4
|
display: inline-block;
|
|
5
5
|
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
display: inline-flex;
|
|
9
|
-
min-width: 70%;
|
|
6
|
+
&.hidden {
|
|
7
|
+
display: none;
|
|
10
8
|
}
|
|
11
9
|
|
|
12
10
|
.mode-chooser {
|
|
@@ -15,18 +13,10 @@ file-panel-component {
|
|
|
15
13
|
margin-left: 10px;
|
|
16
14
|
}
|
|
17
15
|
|
|
18
|
-
.small-action-button.transparent {
|
|
19
|
-
.md-fab.md-button.md-ink-ripple {
|
|
20
|
-
&:hover {
|
|
21
|
-
background-color: transparent !important;
|
|
22
|
-
}
|
|
23
|
-
}
|
|
24
|
-
}
|
|
25
|
-
|
|
26
16
|
.state-selector-button {
|
|
27
17
|
&.mode-selector {
|
|
28
18
|
height: 24px;
|
|
29
|
-
width:
|
|
19
|
+
width: 66px;
|
|
30
20
|
background-color: #ffffff;
|
|
31
21
|
|
|
32
22
|
&.middle {
|
|
@@ -62,51 +52,16 @@ file-panel-component {
|
|
|
62
52
|
height: 22px;
|
|
63
53
|
border-radius: 2px;
|
|
64
54
|
align-self: center;
|
|
55
|
+
vertical-align: bottom;
|
|
65
56
|
}
|
|
66
57
|
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
max-width: 300px;
|
|
73
|
-
min-width: 150px;
|
|
74
|
-
|
|
75
|
-
&.delta-select {
|
|
76
|
-
width: calc((100% - 300px) / 2);
|
|
77
|
-
}
|
|
78
|
-
|
|
79
|
-
md-select {
|
|
80
|
-
display: block;
|
|
81
|
-
|
|
82
|
-
.md-select-value {
|
|
83
|
-
background: white;
|
|
84
|
-
margin-right: 5px;
|
|
85
|
-
border-radius: 5px;
|
|
86
|
-
padding-left: 5px;
|
|
87
|
-
min-height: 22px;
|
|
88
|
-
|
|
89
|
-
span {
|
|
90
|
-
margin-top: -3px;
|
|
91
|
-
}
|
|
92
|
-
}
|
|
93
|
-
}
|
|
94
|
-
|
|
95
|
-
> * {
|
|
96
|
-
display: inline-block;
|
|
97
|
-
}
|
|
98
|
-
|
|
99
|
-
i.fa {
|
|
100
|
-
color: rgb(0, 150, 136);
|
|
101
|
-
margin-top: 4px;
|
|
102
|
-
margin-left: 5px;
|
|
103
|
-
margin-right: 3px;
|
|
104
|
-
min-width: 16px;
|
|
58
|
+
.delta-select {
|
|
59
|
+
width: 200px;
|
|
60
|
+
margin: 0 10px 0 10px;
|
|
61
|
+
vertical-align: bottom;
|
|
62
|
+
}
|
|
105
63
|
|
|
106
|
-
|
|
107
|
-
|
|
108
|
-
cursor: pointer;
|
|
109
|
-
}
|
|
110
|
-
}
|
|
64
|
+
.standard-select {
|
|
65
|
+
margin: 0 10px 0 10px;
|
|
111
66
|
}
|
|
112
67
|
}
|
|
@@ -6,9 +6,10 @@ import { TEST_DELTA_MAP_A, TEST_DELTA_MAP_B, TEST_DELTA_MAP_C, TEST_DELTA_MAP_D
|
|
|
6
6
|
import { StoreService } from "../../state/store.service"
|
|
7
7
|
import { addFile, resetFiles, resetSelection, setDelta, setMultiple, setSingle } from "../../state/store/files/files.actions"
|
|
8
8
|
import { FilesService } from "../../state/store/files/files.service"
|
|
9
|
-
import { getVisibleFileStates, isDeltaState, isPartialState
|
|
9
|
+
import { getVisibleFileStates, isDeltaState, isPartialState } from "../../model/files/files.helper"
|
|
10
10
|
import { FileSelectionState } from "../../model/files/files"
|
|
11
11
|
import { CodeChartaService } from "../../codeCharta.service"
|
|
12
|
+
import { MapColorsService } from "../../state/store/appSettings/mapColors/mapColors.service"
|
|
12
13
|
|
|
13
14
|
describe("filePanelController", () => {
|
|
14
15
|
let filePanelController: FilePanelController
|
|
@@ -38,7 +39,6 @@ describe("filePanelController", () => {
|
|
|
38
39
|
storeService.dispatch(addFile(TEST_DELTA_MAP_B))
|
|
39
40
|
storeService.dispatch(addFile(TEST_DELTA_MAP_C))
|
|
40
41
|
storeService.dispatch(addFile(TEST_DELTA_MAP_D))
|
|
41
|
-
storeService.dispatch(setSingle(TEST_DELTA_MAP_A))
|
|
42
42
|
}
|
|
43
43
|
|
|
44
44
|
describe("constructor", () => {
|
|
@@ -49,6 +49,14 @@ describe("filePanelController", () => {
|
|
|
49
49
|
|
|
50
50
|
expect(FilesService.subscribe).toHaveBeenCalledWith($rootScope, filePanelController)
|
|
51
51
|
})
|
|
52
|
+
|
|
53
|
+
it("should subscribe to MapColorService", () => {
|
|
54
|
+
MapColorsService.subscribe = jest.fn()
|
|
55
|
+
|
|
56
|
+
buildController()
|
|
57
|
+
|
|
58
|
+
expect(MapColorsService.subscribe).toHaveBeenCalledWith($rootScope, filePanelController)
|
|
59
|
+
})
|
|
52
60
|
})
|
|
53
61
|
|
|
54
62
|
describe("onFilesSelectionChanged", () => {
|
|
@@ -63,19 +71,18 @@ describe("filePanelController", () => {
|
|
|
63
71
|
|
|
64
72
|
filePanelController.onFilesSelectionChanged(storeService.getState().files)
|
|
65
73
|
|
|
66
|
-
expect(filePanelController["_viewModel"].isSingleState).toBeFalsy()
|
|
67
74
|
expect(filePanelController["_viewModel"].isPartialState).toBeFalsy()
|
|
68
75
|
expect(filePanelController["_viewModel"].isDeltaState).toBeTruthy()
|
|
69
76
|
expect(filePanelController["lastRenderState"]).toEqual(filePanelController["_viewModel"].renderState)
|
|
70
77
|
})
|
|
71
78
|
|
|
72
|
-
it("should update selected filenames in viewModel correctly if
|
|
73
|
-
storeService.dispatch(
|
|
79
|
+
it("should update selected filenames in viewModel correctly if multiple mode is active", () => {
|
|
80
|
+
storeService.dispatch(setMultiple([TEST_DELTA_MAP_A]))
|
|
74
81
|
|
|
75
82
|
filePanelController.onFilesSelectionChanged(storeService.getState().files)
|
|
76
83
|
|
|
77
|
-
expect(filePanelController["_viewModel"].renderState).toEqual(FileSelectionState.
|
|
78
|
-
expect(filePanelController["_viewModel"].selectedFileNames.
|
|
84
|
+
expect(filePanelController["_viewModel"].renderState).toEqual(FileSelectionState.Partial)
|
|
85
|
+
expect(filePanelController["_viewModel"].selectedFileNames.partial).toEqual([TEST_DELTA_MAP_A.fileMeta.fileName])
|
|
79
86
|
})
|
|
80
87
|
|
|
81
88
|
it("should update selected filenames in viewModel correctly if partial mode is active", () => {
|
|
@@ -121,16 +128,27 @@ describe("filePanelController", () => {
|
|
|
121
128
|
expect(filePanelController["_viewModel"].selectedFileNames.delta.reference).toBeNull()
|
|
122
129
|
expect(filePanelController["_viewModel"].selectedFileNames.delta.comparison).toBeNull()
|
|
123
130
|
expect(filePanelController["_viewModel"].selectedFileNames.partial).toEqual([])
|
|
124
|
-
expect(filePanelController["_viewModel"].selectedFileNames.single).toBeNull()
|
|
125
131
|
})
|
|
132
|
+
})
|
|
126
133
|
|
|
127
|
-
|
|
128
|
-
|
|
134
|
+
describe("onMapColorsChanged", () => {
|
|
135
|
+
it("should set default colors of delta mode in view model for pictogram", () => {
|
|
136
|
+
filePanelController.onMapColorsChanged(storeService.getState().appSettings.mapColors)
|
|
129
137
|
|
|
130
|
-
expect(filePanelController["_viewModel"].pictogramFirstFileColor).toBe("#808080")
|
|
131
138
|
expect(filePanelController["_viewModel"].pictogramLowerColor).toBe(storeService.getState().appSettings.mapColors.negativeDelta)
|
|
132
139
|
expect(filePanelController["_viewModel"].pictogramUpperColor).toBe(storeService.getState().appSettings.mapColors.positiveDelta)
|
|
133
140
|
})
|
|
141
|
+
|
|
142
|
+
it("should update colors of delta mode in view model for pictogram when colors had changed", () => {
|
|
143
|
+
filePanelController["_viewModel"].pictogramLowerColor = storeService.getState().appSettings.mapColors.negativeDelta
|
|
144
|
+
filePanelController["_viewModel"].pictogramUpperColor = storeService.getState().appSettings.mapColors.positiveDelta
|
|
145
|
+
const testMapColors = { ...storeService.getState().appSettings.mapColors, negativeDelta: "#FFFFFF", positiveDelta: "#000000" }
|
|
146
|
+
|
|
147
|
+
filePanelController.onMapColorsChanged(testMapColors)
|
|
148
|
+
|
|
149
|
+
expect(filePanelController["_viewModel"].pictogramLowerColor).toBe(testMapColors.negativeDelta)
|
|
150
|
+
expect(filePanelController["_viewModel"].pictogramUpperColor).toBe(testMapColors.positiveDelta)
|
|
151
|
+
})
|
|
134
152
|
})
|
|
135
153
|
|
|
136
154
|
describe("onPartialSelectionClosed", () => {
|
|
@@ -148,28 +166,6 @@ describe("filePanelController", () => {
|
|
|
148
166
|
})
|
|
149
167
|
})
|
|
150
168
|
|
|
151
|
-
describe("onSingleFileChange", () => {
|
|
152
|
-
it("should set a single file in state und update root data", () => {
|
|
153
|
-
filePanelController["_viewModel"].files = [
|
|
154
|
-
{
|
|
155
|
-
file: TEST_DELTA_MAP_A,
|
|
156
|
-
selectedAs: FileSelectionState.None
|
|
157
|
-
},
|
|
158
|
-
{
|
|
159
|
-
file: TEST_DELTA_MAP_B,
|
|
160
|
-
selectedAs: FileSelectionState.Single
|
|
161
|
-
}
|
|
162
|
-
]
|
|
163
|
-
filePanelController.onSingleFileChange(TEST_DELTA_MAP_B.fileMeta.fileName)
|
|
164
|
-
|
|
165
|
-
expect(isSingleState(storeService.getState().files)).toBeTruthy()
|
|
166
|
-
expect(getVisibleFileStates(storeService.getState().files)[0].selectedAs).toEqual(FileSelectionState.Single)
|
|
167
|
-
|
|
168
|
-
expect(CodeChartaService.ROOT_NAME).toEqual(TEST_DELTA_MAP_B.map.name)
|
|
169
|
-
expect(CodeChartaService.ROOT_PATH).toEqual(`/${TEST_DELTA_MAP_B.map.name}`)
|
|
170
|
-
})
|
|
171
|
-
})
|
|
172
|
-
|
|
173
169
|
describe("onDeltaReferenceFileChange", () => {
|
|
174
170
|
it("should set referenceFile in delta mode and update root data", () => {
|
|
175
171
|
filePanelController["_viewModel"].files = [
|
|
@@ -229,26 +225,6 @@ describe("filePanelController", () => {
|
|
|
229
225
|
})
|
|
230
226
|
|
|
231
227
|
describe("onRenderStateChange", () => {
|
|
232
|
-
it("should update the viewModel with the last visible filename and call onSingleFileChange if single mode is active", () => {
|
|
233
|
-
filePanelController.onSingleFileChange = jest.fn()
|
|
234
|
-
|
|
235
|
-
filePanelController["lastRenderState"] = FileSelectionState.Single
|
|
236
|
-
filePanelController["_viewModel"].selectedFileNames.single = "fileA"
|
|
237
|
-
|
|
238
|
-
filePanelController.onSingleStateSelected()
|
|
239
|
-
|
|
240
|
-
expect(filePanelController["_viewModel"].selectedFileNames.single).toEqual("fileA")
|
|
241
|
-
expect(filePanelController.onSingleFileChange).toHaveBeenCalledWith("fileA")
|
|
242
|
-
})
|
|
243
|
-
|
|
244
|
-
it("should update the viewModel with the first recently loaded filename and call Files if partial mode is active", () => {
|
|
245
|
-
filePanelController.selectRecentPartialFiles = jest.fn()
|
|
246
|
-
|
|
247
|
-
filePanelController.onPartialStateSelected()
|
|
248
|
-
|
|
249
|
-
expect(filePanelController.selectRecentPartialFiles).toHaveBeenCalled()
|
|
250
|
-
})
|
|
251
|
-
|
|
252
228
|
it("should update the viewModel with the last visible filename and call onDeltaComparisonFileChange with null if comparison mode is active", () => {
|
|
253
229
|
filePanelController.onDeltaComparisonFileChange = jest.fn()
|
|
254
230
|
|
|
@@ -284,40 +260,32 @@ describe("filePanelController", () => {
|
|
|
284
260
|
]
|
|
285
261
|
})
|
|
286
262
|
|
|
287
|
-
it("should call
|
|
288
|
-
filePanelController.singleStateFileRemove = jest.fn()
|
|
289
|
-
|
|
290
|
-
filePanelController.onRemoveFile("fileA", FileSelectionState.Single, new Event("mouseEvent"))
|
|
291
|
-
|
|
292
|
-
expect(filePanelController.singleStateFileRemove).toHaveBeenCalled()
|
|
293
|
-
})
|
|
294
|
-
|
|
295
|
-
it("should call onPartialFilesChange when not in single state", () => {
|
|
263
|
+
it("should call onPartialFilesChange when partial state", () => {
|
|
296
264
|
filePanelController.onPartialFilesChange = jest.fn()
|
|
297
265
|
|
|
298
|
-
filePanelController.onRemoveFile("fileA",
|
|
266
|
+
filePanelController.onRemoveFile("fileA", new Event("mouseEvent"))
|
|
299
267
|
|
|
300
268
|
expect(filePanelController.onPartialFilesChange).toHaveBeenCalled()
|
|
301
269
|
})
|
|
302
270
|
|
|
303
271
|
it("should keep selection when a non-selected file is removed", () => {
|
|
304
|
-
storeService.dispatch(
|
|
305
|
-
filePanelController.onRemoveFile("fileA",
|
|
272
|
+
storeService.dispatch(setMultiple([TEST_DELTA_MAP_B]))
|
|
273
|
+
filePanelController.onRemoveFile("fileA", new Event("mouseEvent"))
|
|
306
274
|
|
|
307
275
|
const remainingFiles = storeService.getState().files
|
|
308
|
-
expect(remainingFiles[0].selectedAs).toEqual(FileSelectionState.
|
|
276
|
+
expect(remainingFiles[0].selectedAs).toEqual(FileSelectionState.Partial)
|
|
309
277
|
expect(remainingFiles[1].selectedAs).toEqual(FileSelectionState.None)
|
|
310
278
|
})
|
|
311
279
|
|
|
312
280
|
it("should select most recent file when a selected file is removed", () => {
|
|
313
281
|
storeService.dispatch(setSingle(TEST_DELTA_MAP_B))
|
|
314
|
-
filePanelController.onRemoveFile("fileB",
|
|
282
|
+
filePanelController.onRemoveFile("fileB", new Event("mouseEvent"))
|
|
315
283
|
|
|
316
284
|
const remainingFiles = storeService.getState().files
|
|
317
285
|
const fileA = remainingFiles[0]
|
|
318
286
|
const fileD = remainingFiles[2]
|
|
319
287
|
expect(fileA.selectedAs).toEqual(FileSelectionState.None)
|
|
320
|
-
expect(fileD.selectedAs).toEqual(FileSelectionState.
|
|
288
|
+
expect(fileD.selectedAs).toEqual(FileSelectionState.Partial)
|
|
321
289
|
})
|
|
322
290
|
})
|
|
323
291
|
|
|
@@ -346,7 +314,7 @@ describe("filePanelController", () => {
|
|
|
346
314
|
it("should not change selection when partially selected files still exist", () => {
|
|
347
315
|
storeService.dispatch(setMultiple([TEST_DELTA_MAP_B, TEST_DELTA_MAP_C]))
|
|
348
316
|
|
|
349
|
-
filePanelController.onRemoveFile("fileB",
|
|
317
|
+
filePanelController.onRemoveFile("fileB", new Event("mouseEvent"))
|
|
350
318
|
|
|
351
319
|
const remainingFiles = storeService.getState().files
|
|
352
320
|
const fileA = remainingFiles[0]
|
|
@@ -360,8 +328,8 @@ describe("filePanelController", () => {
|
|
|
360
328
|
it("should select most recent file when no partially selected file exists", () => {
|
|
361
329
|
storeService.dispatch(setMultiple([TEST_DELTA_MAP_B, TEST_DELTA_MAP_C]))
|
|
362
330
|
|
|
363
|
-
filePanelController.onRemoveFile("fileB",
|
|
364
|
-
filePanelController.onRemoveFile("fileC",
|
|
331
|
+
filePanelController.onRemoveFile("fileB", new Event("mouseEvent"))
|
|
332
|
+
filePanelController.onRemoveFile("fileC", new Event("mouseEvent"))
|
|
365
333
|
|
|
366
334
|
const remainingFiles = storeService.getState().files
|
|
367
335
|
const fileA = remainingFiles[0]
|
|
@@ -373,7 +341,7 @@ describe("filePanelController", () => {
|
|
|
373
341
|
it("should not change selection when non-selected file is removed", () => {
|
|
374
342
|
storeService.dispatch(setMultiple([TEST_DELTA_MAP_B, TEST_DELTA_MAP_C]))
|
|
375
343
|
|
|
376
|
-
filePanelController.onRemoveFile("fileA",
|
|
344
|
+
filePanelController.onRemoveFile("fileA", new Event("mouseEvent"))
|
|
377
345
|
|
|
378
346
|
const remainingFiles = storeService.getState().files
|
|
379
347
|
const fileB = remainingFiles[0]
|