-
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.
refactor: simplify extraction of attribute type
- Loading branch information
Torsten Knauf
authored and
Torsten Knauf
committed
Mar 22, 2022
1 parent
499a1e0
commit 010bddd
Showing
8 changed files
with
10 additions
and
65 deletions.
There are no files selected for viewing
8 changes: 0 additions & 8 deletions
8
visualization/app/codeCharta/pipes/aggregationType/aggregationType.module.ts
This file was deleted.
Oops, something went wrong.
23 changes: 0 additions & 23 deletions
23
visualization/app/codeCharta/pipes/aggregationType/aggregationType.pipe.spec.ts
This file was deleted.
Oops, something went wrong.
10 changes: 0 additions & 10 deletions
10
visualization/app/codeCharta/pipes/aggregationType/aggregationType.pipe.ts
This file was deleted.
Oops, something went wrong.
11 changes: 0 additions & 11 deletions
11
visualization/app/codeCharta/state/selectors/getAttributeTypeOfNodesByMetric.selector.ts
This file was deleted.
Oops, something went wrong.
2 changes: 1 addition & 1 deletion
2
...codeCharta/ui/attributeSideBar/attributeTypeSelector/attributeTypeSelector.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,4 +1,4 @@ | ||
<mat-button-toggle-group [value]="getAttributeType$ | async | aggregationType: metricType:metricName"> | ||
<mat-button-toggle-group [value]="(attributeTypes$ | async)[metricType][metricName] ?? 'absolute'"> | ||
<mat-button-toggle title="Select Sum" (click)="setToAbsolute()" value="absolute">Σ</mat-button-toggle> | ||
<mat-button-toggle title="Select Median" (click)="setToRelative()" value="relative">x͂</mat-button-toggle> | ||
</mat-button-toggle-group> |
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
9 changes: 5 additions & 4 deletions
9
...zation/app/codeCharta/ui/metricChooser/metricType/createAttributeTypeSelector.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,9 +1,10 @@ | ||
import { AttributeTypes, PrimaryMetrics } from "../../../codeCharta.model" | ||
import { createSelector } from "../../../state/angular-redux/createSelector" | ||
import { getAttributeTypeSelector } from "../../../state/selectors/getAttributeTypeOfNodesByMetric.selector" | ||
import { attributeTypesSelector } from "../../../state/store/fileSettings/attributeTypes/attributeTypes.selector" | ||
import { primaryMetricNamesSelector } from "../../attributeSideBar/attributeSideBarPrimaryMetrics/primaryMetricNames.selector" | ||
|
||
export const createAttributeTypeSelector = (metricType: keyof AttributeTypes, metricFor: keyof PrimaryMetrics) => | ||
createSelector([primaryMetricNamesSelector, getAttributeTypeSelector], (primaryMetricNames, getAttributeType) => | ||
getAttributeType(metricType, primaryMetricNames[metricFor]) === "relative" ? "x͂" : "Σ" | ||
) | ||
createSelector([primaryMetricNamesSelector, attributeTypesSelector], (primaryMetricNames, attributeTypes) => { | ||
const metricName = primaryMetricNames[metricFor] | ||
return attributeTypes[metricType][metricName] === "relative" ? "x͂" : "Σ" | ||
}) |