-
Notifications
You must be signed in to change notification settings - Fork 30
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Feature/1066/display tooltip description in frontend (#3162)
* chore(deps): update dependency @types/node to v18 * chore(deps): update dependency @types/node to v18 * Migrate to nodev18 * Add: attributeDescriptor TEST to multiple Files (Still one compile error) #1066 * Add: missing reducer statement - no compile error anymore#1066 * Refactor: rename "Size" metric in legendPanel to "Area"#1066 the word "Size" is quite unusual at this position because in the code and in the ribbonbar the word "Area" is used * Refactor: some consoleprints and delete unused variables and methods"#1066 * Refactor: delete "test" node in attributeDescriptors layout#1066 * Add: entry for download feature #1066 * Refactor: move getDescription function to legendMetrics #1066 * Add: implementation for merged attributeDescriptors.merger #1066 * Add: attributeDescriptor to attributeDescriptors settings #1066 * Add: if condition to show description in legend block for every metric type #1066 * Refactor: methods and settings layout to fit new cc.json format #1066 * Fix: test errors #1066 * Add: title for legend blocks in legend #1066 * Fix: remove title from color picker #1066 * Add: case for existing title and missing description #1066 * Refactor: text in legendBlock to be uniform #1066 * Refactor: metricTitles cases to fit to new attribute descriptors #1066 * Fix: failing tests #1066 * Fix: format tests #1066 * Fix: test coverage #1066 * Fix: test coverage error #1066 * Update webpack and tapable * Fix: test coverage error second try #1066 * Refactor: metric name to key #1066 * Fix: refactoring erros #1066 * Chore: Merge main * Chore: Update puppeteer to see if that fixes the pipeline * Chore: remove now unused method from puppeteer helper * Test: change jest testTimeout to 80s #1066 * Fix: PR comments #1066 * Revert "Test: change jest testTimeout to 80s #1066" This reverts commit 48f45f8. I reverted this commit, because it's not the suitable branch for it. * Fix: test error #1066 * TEST Refactor: change "testTimeout": 800000 #2326 * TEST Refactor: waitForFileChooser({ timeout: 800_000 #2326 * TEST Refactor: don't runInBand #2326 * fix: downgrade puppeteer 19 -> 16 again * Revert "TEST Refactor: waitForFileChooser({ timeout: 800_000 #2326" This reverts commit 8ce820e. * Revert "TEST Refactor: don't runInBand #2326" This reverts commit baf77cf. * Revert "TEST Refactor: change "testTimeout": 800000 #2326" This reverts commit 0f5e5d5. * fix: upgrade puppeteer one last time 16 -> 17 * Add: Test for attributeDescriptors.reducer #2326 * Add changelog entry #2326 Co-authored-by: renovate[bot] <29139614+renovate[bot]@users.noreply.github.com> Co-authored-by: luig59 <luig59@mi.fu-berlin.de> Co-authored-by: MW-Friedrich <108457762+MW-Friedrich@users.noreply.github.com>
- Loading branch information
1 parent
c3c2268
commit 9740b92
Showing
41 changed files
with
483 additions
and
88 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
70 changes: 70 additions & 0 deletions
70
...app/codeCharta/state/effects/updateFileSettings/utils/attributeDescriptors.merger.spec.ts
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,70 @@ | ||
import { AttributeDescriptors } from "../../../../codeCharta.model" | ||
import { getMergedAttributeDescriptors } from "./attributeDescriptors.merger" | ||
|
||
describe("AttributeDescriptorsMerger", () => { | ||
describe("getMergedAttributeDescriptors", () => { | ||
let attributes1: AttributeDescriptors | ||
let attributes2: AttributeDescriptors | ||
let attributes3: AttributeDescriptors | ||
|
||
beforeEach(() => { | ||
attributes1 = {} | ||
|
||
attributes2 = { | ||
rloc: { | ||
title: "rloc2", | ||
description: "", | ||
hintLowValue: "", | ||
hintHighValue: "", | ||
link: "https://www.npmjs.com/package/metric-gardener" | ||
} | ||
} | ||
|
||
attributes3 = { | ||
rloc: { | ||
title: "rloc3", | ||
description: "DescriptionRloc3", | ||
hintLowValue: "", | ||
hintHighValue: "", | ||
link: "https://www.npmjs.com/package/metric-gardener" | ||
}, | ||
comment_lines: { | ||
title: "Comment Lines", | ||
description: "Number of lines containing either comment or commented-out code", | ||
hintLowValue: "", | ||
hintHighValue: "", | ||
link: "https://www.npmjs.com/package/metric-gardener" | ||
} | ||
} | ||
}) | ||
|
||
it("should merge attributeDescriptors if one file does not contain any attributeDescriptors", () => { | ||
const attributeDescriptors = getMergedAttributeDescriptors([attributes1, attributes2]) | ||
|
||
expect(attributeDescriptors).toEqual(attributes2) | ||
}) | ||
|
||
it("should merge attributeDescriptors. If they share the same key, simply take the first attributeDescriptor", () => { | ||
const attributeDescriptors = getMergedAttributeDescriptors([attributes2, attributes3]) | ||
|
||
const expected = { | ||
rloc: { | ||
title: "rloc2", | ||
description: "", | ||
hintLowValue: "", | ||
hintHighValue: "", | ||
link: "https://www.npmjs.com/package/metric-gardener" | ||
}, | ||
comment_lines: { | ||
title: "Comment Lines", | ||
description: "Number of lines containing either comment or commented-out code", | ||
hintLowValue: "", | ||
hintHighValue: "", | ||
link: "https://www.npmjs.com/package/metric-gardener" | ||
} | ||
} | ||
|
||
expect(attributeDescriptors).toEqual(expected) | ||
}) | ||
}) | ||
}) |
15 changes: 15 additions & 0 deletions
15
...tion/app/codeCharta/state/effects/updateFileSettings/utils/attributeDescriptors.merger.ts
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,15 @@ | ||
import { AttributeDescriptors } from "../../../../codeCharta.model" | ||
|
||
export function getMergedAttributeDescriptors(allAttributeDescriptors: AttributeDescriptors[]): AttributeDescriptors { | ||
const uniqueAttributeDescriptors = {} | ||
|
||
for (const attributeDescriptors of allAttributeDescriptors) { | ||
for (const attributeDescriptorKey of Object.keys(attributeDescriptors)) { | ||
if (!uniqueAttributeDescriptors[attributeDescriptorKey]) { | ||
uniqueAttributeDescriptors[attributeDescriptorKey] = attributeDescriptors[attributeDescriptorKey] | ||
} | ||
} | ||
} | ||
|
||
return uniqueAttributeDescriptors | ||
} |
23 changes: 23 additions & 0 deletions
23
...p/codeCharta/state/store/fileSettings/attributeDescriptors/attributeDescriptors.action.ts
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,23 @@ | ||
import { AttributeDescriptors, CCAction } from "../../../../codeCharta.model" | ||
|
||
export enum AttributeDescriptorsActions { | ||
SET_ATTRIBUTE_DESCRIPTORS = "SET_ATTRIBUTE_DESCRIPTORS" | ||
} | ||
|
||
export interface SetAttributeDescriptorsAction extends CCAction { | ||
type: AttributeDescriptorsActions.SET_ATTRIBUTE_DESCRIPTORS | ||
payload: AttributeDescriptors | ||
} | ||
|
||
export type AttributeDescriptorsAction = SetAttributeDescriptorsAction | ||
|
||
export function setAttributeDescriptors( | ||
attributeDescriptors: AttributeDescriptors = defaultAttributeDescriptors | ||
): SetAttributeDescriptorsAction { | ||
return { | ||
type: AttributeDescriptorsActions.SET_ATTRIBUTE_DESCRIPTORS, | ||
payload: attributeDescriptors | ||
} | ||
} | ||
|
||
export const defaultAttributeDescriptors: AttributeDescriptors = {} |
30 changes: 30 additions & 0 deletions
30
...Charta/state/store/fileSettings/attributeDescriptors/attributeDescriptors.reducer.spec.ts
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,30 @@ | ||
import { attributeDescriptors } from "./attributeDescriptors.reducer" | ||
import { STATE } from "../../../../util/dataMocks" | ||
import { AttributeDescriptors } from "../../../../codeCharta.model" | ||
import { AttributeDescriptorsAction, setAttributeDescriptors } from "./attributeDescriptors.action" | ||
|
||
describe("attributeDescriptors", () => { | ||
const defaultValue: AttributeDescriptors = {} | ||
|
||
describe("Default State", () => { | ||
it("should initialize the default state", () => { | ||
const result = attributeDescriptors(undefined, {} as AttributeDescriptorsAction) | ||
|
||
expect(result).toEqual(defaultValue) | ||
}) | ||
}) | ||
|
||
describe("Action: SET_ATTRIBUTE_DESCRIPTORS", () => { | ||
it("should set new attributeDescriptors", () => { | ||
const result = attributeDescriptors(defaultValue, setAttributeDescriptors(STATE.fileSettings.attributeDescriptors)) | ||
|
||
expect(result).toEqual(STATE.fileSettings.attributeDescriptors) | ||
}) | ||
|
||
it("should set default attributeDescriptors", () => { | ||
const result = attributeDescriptors(STATE.fileSettings.attributeDescriptors, setAttributeDescriptors()) | ||
|
||
expect(result).toEqual(defaultValue) | ||
}) | ||
}) | ||
}) |
8 changes: 8 additions & 0 deletions
8
.../codeCharta/state/store/fileSettings/attributeDescriptors/attributeDescriptors.reducer.ts
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,8 @@ | ||
import { AttributeDescriptorsAction, AttributeDescriptorsActions, setAttributeDescriptors } from "./attributeDescriptors.action" | ||
|
||
export function attributeDescriptors(state = setAttributeDescriptors().payload, action: AttributeDescriptorsAction) { | ||
if (action.type === AttributeDescriptorsActions.SET_ATTRIBUTE_DESCRIPTORS) { | ||
return action.payload | ||
} | ||
return state | ||
} |
3 changes: 3 additions & 0 deletions
3
...odeCharta/state/store/fileSettings/attributeDescriptors/attributesDescriptors.selector.ts
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,3 @@ | ||
import { CcState } from "../../store" | ||
|
||
export const attributeDescriptorsSelector = (state: CcState) => state.fileSettings.attributeDescriptors |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
27 changes: 20 additions & 7 deletions
27
visualization/app/codeCharta/ui/legendPanel/legendBlock/legendBlock.component.html
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,7 +1,20 @@ | ||
<div *ngIf="legendMetric.description" class="legend-block"> | ||
{{ metricFor }} metric (<span class="bold">{{ legendMetric.metricName }}</span | ||
>: {{ legendMetric.description }}) | ||
</div> | ||
<div *ngIf="!legendMetric.description" class="legend-block"> | ||
{{ metricFor }} metric: <span class="bold">{{ legendMetric.metricName }}</span> | ||
</div> | ||
<ng-container *ngIf="legendMetric.title; then titleExists; else onlyShowName" class="legend-block"></ng-container> | ||
<ng-template #titleExists> | ||
<ng-container *ngIf="legendMetric.description; then showTitleAndDescription; else showTitle"></ng-container> | ||
</ng-template> | ||
|
||
<ng-template #showTitleAndDescription> | ||
<div title="{{ legendMetric.key + ': ' + legendMetric.description }}"> | ||
{{ metricFor }} metric: <span class="bold">{{ legendMetric.title }}</span> ({{ legendMetric.key }}) | ||
</div> | ||
</ng-template> | ||
<ng-template #showTitle> | ||
<div title="{{ legendMetric.key }}"> | ||
{{ metricFor }} metric: <span class="bold">{{ legendMetric.title }}</span> ({{ legendMetric.key }}) | ||
</div> | ||
</ng-template> | ||
<ng-template #onlyShowName> | ||
<div title="{{ legendMetric.key }}"> | ||
{{ metricFor }} metric: <span class="bold">{{ legendMetric.key }}</span> | ||
</div> | ||
</ng-template> |
3 changes: 1 addition & 2 deletions
3
visualization/app/codeCharta/ui/legendPanel/legendPanel.component.html
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
12 changes: 6 additions & 6 deletions
12
visualization/app/codeCharta/ui/legendPanel/selectors/legendAreaMetric.selector.ts
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,10 +1,10 @@ | ||
import { createSelector } from "../../../state/angular-redux/createSelector" | ||
import { areaMetricSelector } from "../../../state/store/dynamicSettings/areaMetric/areaMetric.selector" | ||
import { attributeDescriptorsSelector } from "../../../state/store/fileSettings/attributeDescriptors/attributesDescriptors.selector" | ||
import { CcState } from "../../../state/store/store" | ||
import { metricDescriptions } from "../../../util/metric/metricDescriptions" | ||
import { LegendMetric } from "./legendMetric" | ||
import { getLegendMetric, LegendMetric } from "./legendMetric" | ||
|
||
export const legendAreaMetricSelector: (state: CcState) => LegendMetric = createSelector([areaMetricSelector], areaMetric => ({ | ||
metricName: areaMetric, | ||
description: metricDescriptions.get(areaMetric) | ||
})) | ||
export const legendAreaMetricSelector: (state: CcState) => LegendMetric = createSelector( | ||
[areaMetricSelector, attributeDescriptorsSelector], | ||
(areaMetric, attributeDescriptors) => getLegendMetric(areaMetric, attributeDescriptors) | ||
) |
12 changes: 6 additions & 6 deletions
12
visualization/app/codeCharta/ui/legendPanel/selectors/legendColorMetric.selector.ts
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,10 +1,10 @@ | ||
import { createSelector } from "../../../state/angular-redux/createSelector" | ||
import { colorMetricSelector } from "../../../state/store/dynamicSettings/colorMetric/colorMetric.selector" | ||
import { CcState } from "../../../state/store/store" | ||
import { metricDescriptions } from "../../../util/metric/metricDescriptions" | ||
import { LegendMetric } from "./legendMetric" | ||
import { getLegendMetric, LegendMetric } from "./legendMetric" | ||
import { attributeDescriptorsSelector } from "../../../state/store/fileSettings/attributeDescriptors/attributesDescriptors.selector" | ||
|
||
export const legendColorMetricSelector: (state: CcState) => LegendMetric = createSelector([colorMetricSelector], colorMetric => ({ | ||
metricName: colorMetric, | ||
description: metricDescriptions.get(colorMetric) | ||
})) | ||
export const legendColorMetricSelector: (state: CcState) => LegendMetric = createSelector( | ||
[colorMetricSelector, attributeDescriptorsSelector], | ||
(colorMetric, attributeDescriptors) => getLegendMetric(colorMetric, attributeDescriptors) | ||
) |
Oops, something went wrong.