-
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.
- set initial primary edges metric correctly - dispatch secondary metric type correctly ref #2731 ref #2630
- Loading branch information
Torsten Knauf
authored and
Torsten Knauf
committed
Mar 21, 2022
1 parent
80c9cf3
commit 499a1e0
Showing
10 changed files
with
47 additions
and
34 deletions.
There are no files selected for viewing
8 changes: 8 additions & 0 deletions
8
visualization/app/codeCharta/pipes/aggregationType/aggregationType.module.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 { NgModule } from "@angular/core" | ||
import { AggregationTypePipe } from "./aggregationType.pipe" | ||
|
||
@NgModule({ | ||
declarations: [AggregationTypePipe], | ||
exports: [AggregationTypePipe] | ||
}) | ||
export class AggregationTypeModule {} |
23 changes: 23 additions & 0 deletions
23
visualization/app/codeCharta/pipes/aggregationType/aggregationType.pipe.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,23 @@ | ||
import { GetAttributeType } from "../../state/selectors/getAttributeTypeOfNodesByMetric.selector" | ||
import { AggregationTypePipe } from "./aggregationType.pipe" | ||
|
||
describe("AggregationType", () => { | ||
const aggregationTypePipe = new AggregationTypePipe() | ||
const aggregationTypes = { | ||
nodes: { rloc: "absolute" }, | ||
edges: { mcc: "relative" } | ||
} | ||
const getAttributeType: GetAttributeType = (metricType, metricName) => aggregationTypes[metricType][metricName] | ||
|
||
it("should default to 'absolute", () => { | ||
expect(aggregationTypePipe.transform(getAttributeType, "nodes", "non-existing")).toBe("absolute") | ||
}) | ||
|
||
it("should get nodes value", () => { | ||
expect(aggregationTypePipe.transform(getAttributeType, "nodes", "rloc")).toBe("absolute") | ||
}) | ||
|
||
it("should get edges value", () => { | ||
expect(aggregationTypePipe.transform(getAttributeType, "edges", "mcc")).toBe("relative") | ||
}) | ||
}) |
10 changes: 10 additions & 0 deletions
10
visualization/app/codeCharta/pipes/aggregationType/aggregationType.pipe.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,10 @@ | ||
import { Pipe, PipeTransform } from "@angular/core" | ||
import { AttributeTypes } from "../../codeCharta.model" | ||
import { GetAttributeType } from "../../state/selectors/getAttributeTypeOfNodesByMetric.selector" | ||
|
||
@Pipe({ name: "aggregationType" }) | ||
export class AggregationTypePipe implements PipeTransform { | ||
transform(getAttributeType: GetAttributeType, metricType: keyof AttributeTypes, metricName: string): string { | ||
return getAttributeType(metricType, metricName) ?? "absolute" | ||
} | ||
} |
8 changes: 0 additions & 8 deletions
8
...zation/app/codeCharta/pipes/nodeMetricAggregationType/nodeMetricAggregationType.module.ts
This file was deleted.
Oops, something went wrong.
11 changes: 0 additions & 11 deletions
11
...ion/app/codeCharta/pipes/nodeMetricAggregationType/nodeMetricAggregationType.pipe.spec.ts
This file was deleted.
Oops, something went wrong.
10 changes: 0 additions & 10 deletions
10
...lization/app/codeCharta/pipes/nodeMetricAggregationType/nodeMetricAggregationType.pipe.ts
This file was deleted.
Oops, something went wrong.
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
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]="(metricName | nodeMetricAggregationType: (getAttributeTypeOfNodesByMetric$ | async)) || 'absolute'"> | ||
<mat-button-toggle-group [value]="getAttributeType$ | async | aggregationType: metricType:metricName"> | ||
<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