Skip to content

Commit caee728

Browse files
hawkgskirjs
authored andcommitted
fix(devtools): signal graph linkedSignal node UI (angular#64105)
Fix the colors of `linkedSignal`s. Use grayish colors for unknown/unhandled signals. PR Close angular#64105
1 parent 238ccc7 commit caee728

4 files changed

Lines changed: 39 additions & 6 deletions

File tree

devtools/projects/ng-devtools/src/lib/devtools-tabs/directive-explorer/signals-view/signals-details/signals-details.component.scss

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -68,7 +68,7 @@
6868
}
6969

7070
&.type-computed {
71-
background-color: var(--green-02);
71+
background-color: var(--green-01);
7272
}
7373

7474
&.type-effect {
@@ -78,6 +78,10 @@
7878
&.type-template {
7979
background-color: var(--gray-500);
8080
}
81+
82+
&.type-linked-signal {
83+
background-color: var(--red-03);
84+
}
8185
}
8286
}
8387
}

devtools/projects/ng-devtools/src/lib/devtools-tabs/directive-explorer/signals-view/signals-details/signals-details.component.ts

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -24,6 +24,7 @@ const TYPE_CLASS_MAP: {[key: string]: string} = {
2424
'computed': 'type-computed',
2525
'effect': 'type-effect',
2626
'template': 'type-template',
27+
'linkedSignal': 'type-linked-signal',
2728
};
2829

2930
@Component({

devtools/projects/ng-devtools/src/lib/devtools-tabs/directive-explorer/signals-view/signals-tab.component.scss

Lines changed: 24 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -21,31 +21,36 @@
2121
text-align: center;
2222
word-wrap: break-word;
2323
border-radius: 8px;
24-
background-color: var(--red-03);
24+
background-color: var(--gray-400);
2525
cursor: pointer;
2626
transition: border-width 0.25s ease-in-out;
2727
border: 0px solid black;
28+
2829
&.animating {
2930
border-width: 5px;
3031
}
32+
3133
.header {
3234
overflow: hidden;
3335
text-overflow: ellipsis;
3436
white-space: nowrap;
35-
padding: 3px;
36-
background-color: var(--red-06);
37+
padding: 3px 5px;
38+
background-color: var(--gray-500);
3739

3840
&.special {
3941
font-style: italic;
4042
}
4143
}
44+
4245
.body {
4346
font-family: tg.$font-family-mono;
4447
font-size: 11px;
4548
padding: 5px;
46-
flex: 1;
49+
overflow: hidden;
50+
text-overflow: ellipsis;
4751
}
4852
}
53+
4954
.selected rect {
5055
stroke: var(--dynamic-blue-02);
5156
stroke-width: 3px;
@@ -55,28 +60,43 @@
5560

5661
.kind-signal {
5762
background-color: var(--blue-02);
63+
5864
.header {
5965
background-color: var(--blue-01);
6066
}
6167
}
68+
6269
.kind-computed {
6370
background-color: var(--green-02);
71+
6472
.header {
6573
background-color: var(--green-01);
6674
}
6775
}
76+
6877
.kind-effect {
6978
background-color: var(--purple-02);
79+
7080
.header {
7181
background-color: var(--purple-01);
7282
}
7383
}
84+
7485
.kind-template {
7586
background-color: var(--gray-400);
87+
7688
.header {
7789
background-color: var(--gray-700);
7890
}
7991
}
92+
93+
.kind-linked-signal {
94+
background-color: var(--red-04);
95+
96+
.header {
97+
background-color: var(--red-03);
98+
}
99+
}
80100
}
81101
}
82102

devtools/projects/ng-devtools/src/lib/devtools-tabs/directive-explorer/signals-view/signals-visualizer.ts

Lines changed: 9 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -10,6 +10,14 @@ import {DebugSignalGraph, DebugSignalGraphNode} from '../../../../../../protocol
1010
import * as d3 from 'd3';
1111
import {graphlib, render as dagreRender} from 'dagre-d3-es';
1212

13+
const KIND_CLASS_MAP: {[key: string]: string} = {
14+
'signal': 'kind-signal',
15+
'computed': 'kind-computed',
16+
'effect': 'kind-effect',
17+
'template': 'kind-template',
18+
'linkedSignal': 'kind-linked-signal',
19+
};
20+
1321
export class SignalsGraphVisualizer {
1422
private graph: graphlib.Graph;
1523
private drender: ReturnType<typeof dagreRender>;
@@ -111,7 +119,7 @@ export class SignalsGraphVisualizer {
111119
cb(node);
112120
}
113121
};
114-
outer.className = `node-label kind-${node.kind}`;
122+
outer.className = `node-label ${KIND_CLASS_MAP[node.kind]}`;
115123
const header = document.createElement('div');
116124
let label = node.label;
117125
if (node.kind === 'effect') {

0 commit comments

Comments
 (0)