Skip to content

Commit c039beb

Browse files
feat: custom style for topology (#945)
1 parent f560538 commit c039beb

File tree

5 files changed

+59
-33
lines changed

5 files changed

+59
-33
lines changed

projects/observability/src/shared/components/topology/d3/interactions/topology-interaction-control.component.scss

Lines changed: 6 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,6 @@
11
@import 'color-palette';
22
@import 'font';
3+
@import 'layout';
34

45
.topology-control {
56
border-radius: 6px;
@@ -21,7 +22,7 @@
2122
flex-direction: row;
2223
align-items: center;
2324
position: relative;
24-
bottom: 24px;
25+
bottom: 20px;
2526
}
2627

2728
button {
@@ -38,7 +39,7 @@ button {
3839
align-items: center;
3940

4041
.zoom-percentage {
41-
@include body-1-medium($gray-7);
42+
@include body-2-medium($gray-7);
4243
width: 60px;
4344
text-align: center;
4445
color: $gray-7;
@@ -60,6 +61,7 @@ button {
6061
}
6162

6263
.topology-button {
63-
height: 36px;
64-
width: 36px;
64+
@include center-contents();
65+
height: 24px;
66+
width: 24px;
6567
}

projects/observability/src/shared/components/topology/d3/interactions/topology-interaction-control.component.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -73,7 +73,7 @@ export class TopologyInteractionControlComponent implements OnInit {
7373
public currentZoomPercentage: string = '100';
7474
public canIncrement: boolean = true;
7575
public canDecrement: boolean = true;
76-
public readonly iconSize: IconSize = IconSize.Medium;
76+
public readonly iconSize: IconSize = IconSize.Small;
7777
public readonly edgeDataSpecifiers: TopologyDataSpecifier[];
7878
public readonly nodeDataSpecifiers: TopologyDataSpecifier[];
7979
public get selectedEdgeDataSpecifier(): TopologyDataSpecifier | undefined {

projects/observability/src/shared/dashboard/widgets/topology/topology-widget-renderer.component.scss

Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,20 @@
11
@import 'color-palette';
22
@import 'font';
33

4+
.topology-container {
5+
width: 100%;
6+
height: 100%;
7+
8+
&.box-style {
9+
height: calc(100% - 8px);
10+
border-radius: 10px;
11+
box-shadow: 0px 1px 3px rgba(63, 71, 74, 0.16), 0px 2px 2px rgba(63, 71, 74, 0.12),
12+
0px 0px 2px rgba(63, 71, 74, 0.16);
13+
margin-top: 4px;
14+
padding: 0px 8px;
15+
}
16+
}
17+
418
.visualization {
519
width: 100%;
620
height: 100%;

projects/observability/src/shared/dashboard/widgets/topology/topology-widget-renderer.component.ts

Lines changed: 30 additions & 28 deletions
Original file line numberDiff line numberDiff line change
@@ -33,38 +33,40 @@ import { TopologyWidgetModel } from './topology-widget.model';
3333
providers: [TopologyNodeRendererService, TopologyEdgeRendererService, TopologyTooltipRendererService],
3434
changeDetection: ChangeDetectionStrategy.OnPush,
3535
template: `
36-
<ht-titled-content [title]="this.model.title | htDisplayTitle">
37-
<div class="visualization" *htLoadAsync="this.data$ as data">
38-
<div *ngIf="this.model.showLegend" class="legend">
39-
<div class="latency">
40-
<div class="label">P99 Latency:</div>
41-
<div class="entry" *ngFor="let entry of this.getLatencyLegendConfig()">
42-
<div [ngClass]="entry.categoryClass" class="symbol"></div>
43-
<span class="label">{{ entry.label }}</span>
36+
<div class="topology-container" [ngClass]="{ 'box-style': this.model.enableBoxStyle }">
37+
<ht-titled-content [title]="this.model.title | htDisplayTitle">
38+
<div class="visualization" *htLoadAsync="this.data$ as data">
39+
<div *ngIf="this.model.showLegend" class="legend">
40+
<div class="latency">
41+
<div class="label">P99 Latency:</div>
42+
<div class="entry" *ngFor="let entry of this.getLatencyLegendConfig()">
43+
<div [ngClass]="entry.categoryClass" class="symbol"></div>
44+
<span class="label">{{ entry.label }}</span>
45+
</div>
4446
</div>
45-
</div>
46-
<div class="error-percentage">
47-
<div class="label">Errors:</div>
48-
<div class="entry" *ngFor="let entry of this.getErrorPercentageLegendConfig()">
49-
<div [ngClass]="entry.categoryClass" class="symbol"></div>
50-
<span class="label">{{ entry.label }}</span>
47+
<div class="error-percentage">
48+
<div class="label">Errors:</div>
49+
<div class="entry" *ngFor="let entry of this.getErrorPercentageLegendConfig()">
50+
<div [ngClass]="entry.categoryClass" class="symbol"></div>
51+
<span class="label">{{ entry.label }}</span>
52+
</div>
5153
</div>
5254
</div>
55+
<ht-topology
56+
class="topology"
57+
[nodes]="data.nodes"
58+
[nodeRenderer]="this.nodeRenderer"
59+
[edgeRenderer]="this.edgeRenderer"
60+
[tooltipRenderer]="this.tooltipRenderer"
61+
[nodeDataSpecifiers]="data.nodeSpecs"
62+
[edgeDataSpecifiers]="data.edgeSpecs"
63+
[showBrush]="this.model.showBrush"
64+
[shouldAutoZoomToFit]="this.model.shouldAutoZoomToFit"
65+
>
66+
</ht-topology>
5367
</div>
54-
<ht-topology
55-
class="topology"
56-
[nodes]="data.nodes"
57-
[nodeRenderer]="this.nodeRenderer"
58-
[edgeRenderer]="this.edgeRenderer"
59-
[tooltipRenderer]="this.tooltipRenderer"
60-
[nodeDataSpecifiers]="data.nodeSpecs"
61-
[edgeDataSpecifiers]="data.edgeSpecs"
62-
[showBrush]="this.model.showBrush"
63-
[shouldAutoZoomToFit]="this.model.shouldAutoZoomToFit"
64-
>
65-
</ht-topology>
66-
</div>
67-
</ht-titled-content>
68+
</ht-titled-content>
69+
</div>
6870
`
6971
})
7072
export class TopologyWidgetRendererComponent extends WidgetRenderer<TopologyWidgetModel, TopologyTemplateData> {

projects/observability/src/shared/dashboard/widgets/topology/topology-widget.model.ts

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -40,6 +40,14 @@ export class TopologyWidgetModel {
4040
})
4141
public shouldAutoZoomToFit?: boolean = false;
4242

43+
@ModelProperty({
44+
key: 'enableBoxStyle',
45+
displayName: 'Enable Box Style',
46+
type: BOOLEAN_PROPERTY.type,
47+
required: false
48+
})
49+
public enableBoxStyle?: boolean = false;
50+
4351
@ModelInject(MODEL_API)
4452
private readonly api!: ModelApi;
4553

0 commit comments

Comments
 (0)