Fix condition in tracing graph (#24075)

This commit is contained in:
Bram Kragten 2025-02-05 11:04:39 +01:00
parent 553bb61db7
commit 7cbdb1dcfd

View File

@ -1,4 +1,4 @@
import { css, html, LitElement, svg } from "lit"; import { css, html, LitElement, nothing, svg } from "lit";
import { customElement, property, state } from "lit/decorators"; import { customElement, property, state } from "lit/decorators";
import { classMap } from "lit/directives/class-map"; import { classMap } from "lit/directives/class-map";
import { BRANCH_HEIGHT, SPACING } from "./hat-graph-const"; import { BRANCH_HEIGHT, SPACING } from "./hat-graph-const";
@ -41,8 +41,8 @@ export class HatGraphBranch extends LitElement {
branches.push({ branches.push({
x: width / 2 + total_width, x: width / 2 + total_width,
height, height,
start: c.hasAttribute("graphStart"), start: c.hasAttribute("graph-start"),
end: c.hasAttribute("graphEnd"), end: c.hasAttribute("graph-end"),
track: c.hasAttribute("track"), track: c.hasAttribute("track"),
}); });
total_width += width; total_width += width;
@ -65,11 +65,8 @@ export class HatGraphBranch extends LitElement {
return html` return html`
<slot name="head"></slot> <slot name="head"></slot>
${!this.start ${!this.start
? svg` ? html`
<svg <svg id="top" width=${this._totalWidth}>
id="top"
width="${this._totalWidth}"
>
${this._branches.map((branch) => ${this._branches.map((branch) =>
branch.start branch.start
? "" ? ""
@ -86,7 +83,7 @@ export class HatGraphBranch extends LitElement {
)} )}
</svg> </svg>
` `
: ""} : nothing}
<div id="branches"> <div id="branches">
<svg id="lines" width=${this._totalWidth} height=${this._maxHeight}> <svg id="lines" width=${this._totalWidth} height=${this._maxHeight}>
${this._branches.map((branch) => { ${this._branches.map((branch) => {
@ -107,11 +104,8 @@ export class HatGraphBranch extends LitElement {
</div> </div>
${!this.short ${!this.short
? svg` ? html`
<svg <svg id="bottom" width=${this._totalWidth}>
id="bottom"
width="${this._totalWidth}"
>
${this._branches.map((branch) => { ${this._branches.map((branch) => {
if (branch.end) return ""; if (branch.end) return "";
return svg` return svg`
@ -128,7 +122,7 @@ export class HatGraphBranch extends LitElement {
})} })}
</svg> </svg>
` `
: ""} : nothing}
`; `;
} }