Add service icons to traces (again :D) (#19728)

* Add service icons to traces (again :D)

* Update hat-graph-node.ts
This commit is contained in:
Bram Kragten
2024-02-08 13:33:10 +01:00
committed by GitHub
parent b1e1b44c75
commit 23cbecb2c4
5 changed files with 31 additions and 11 deletions

View File

@@ -5,6 +5,7 @@ import {
html,
TemplateResult,
svg,
nothing,
} from "lit";
import { customElement, property } from "lit/decorators";
import { NODE_SIZE, SPACING } from "./hat-graph-const";
@@ -51,7 +52,7 @@ export class HatGraphNode extends LitElement {
: Math.ceil((NODE_SIZE + SPACING * 2) / 2)} ${width} ${height}"
>
${this.graphStart
? ``
? nothing
: svg`
<path
class="connector"
@@ -64,7 +65,6 @@ export class HatGraphNode extends LitElement {
`}
<g class="node">
<circle cx="0" cy="0" r=${NODE_SIZE / 2} />
}
${this.badge
? svg`
<g class="number">
@@ -81,9 +81,11 @@ export class HatGraphNode extends LitElement {
>${this.badge > 9 ? "9+" : this.badge}</text>
</g>
`
: ""}
: nothing}
<g style="pointer-events: none" transform="translate(${-12} ${-12})">
${this.iconPath ? svg`<path class="icon" d=${this.iconPath}/>` : ""}
${this.iconPath
? svg`<path class="icon" d=${this.iconPath}/>`
: svg`<foreignObject><span class="icon"><slot name="icon"></slot></span></foreignObject>`}
</g>
</g>
</svg>
@@ -152,6 +154,13 @@ export class HatGraphNode extends LitElement {
path.icon {
fill: var(--icon-clr);
}
foreignObject {
width: 24px;
height: 24px;
}
.icon {
color: var(--icon-clr);
}
`;
}
}