diff --git a/web/src/elements/TreeView.ts b/web/src/elements/TreeView.ts
index c1c7e2f89..63d04b5ec 100644
--- a/web/src/elements/TreeView.ts
+++ b/web/src/elements/TreeView.ts
@@ -11,7 +11,7 @@ import { EVENT_REFRESH } from "../constants";
import { setURLParams } from "./router/RouteMatch";
export interface TreeViewItem {
- id: string;
+ id?: string;
label: string;
childItems: TreeViewItem[];
parent?: TreeViewItem;
@@ -30,7 +30,7 @@ export class TreeViewNode extends LitElement {
host?: TreeView;
@property()
- path = "";
+ activePath = "";
@property()
separator = "";
@@ -43,7 +43,9 @@ export class TreeViewNode extends LitElement {
const pathItems = [];
let item = this.item;
while (item) {
- pathItems.push(item.id);
+ if (item.id) {
+ pathItems.push(item.id);
+ }
item = item.parent;
}
return pathItems.reverse().join(this.separator);
@@ -54,14 +56,14 @@ export class TreeViewNode extends LitElement {
}
firstUpdated(): void {
- const pathSegments = this.path.split(this.separator);
+ const pathSegments = this.activePath.split(this.separator);
const level = this.item?.level || 0;
// Ignore the last item as that shouldn't be expanded
pathSegments.pop();
if (pathSegments[level] == this.item?.id) {
this.open = true;
}
- if (this.path === this.fullPath && this.host !== undefined) {
+ if (this.activePath === this.fullPath && this.host !== undefined) {
this.host.activeNode = this;
}
}
@@ -122,7 +124,7 @@ export class TreeViewNode extends LitElement {
${this.item?.childItems.map((item) => {
return html`