From bfbbdb12cae14a6e245583e0c36fc8d71e29f95a Mon Sep 17 00:00:00 2001 From: Zaid Humaimidi Date: Mon, 18 Dec 2023 11:33:49 -0800 Subject: [PATCH] Fix label issue in some components --- ui/components/parameter-list.ts | 4 ++-- ui/components/parameter-table.ts | 4 +++- ui/overview-page.ts | 10 ++++++++-- 3 files changed, 13 insertions(+), 5 deletions(-) diff --git a/ui/components/parameter-list.ts b/ui/components/parameter-list.ts index ca09af4..800dbbf 100644 --- a/ui/components/parameter-list.ts +++ b/ui/components/parameter-list.ts @@ -27,7 +27,7 @@ interface Attrs { device: FlatDevice; parameters: Record< string, - { type?: Expression; label: string; parameter: Expression } + { type?: Expression; label: Expression; parameter: Expression } >; deviceQuery: QueryResponse; } @@ -62,7 +62,7 @@ const component: ClosureComponent = () => { : "none"; }, }, - m("th", parameter["label"]), + m("th", evaluateExpression(parameter.label, device)), m("td", p), ); }); diff --git a/ui/components/parameter-table.ts b/ui/components/parameter-table.ts index e9c7655..277392b 100644 --- a/ui/components/parameter-table.ts +++ b/ui/components/parameter-table.ts @@ -61,7 +61,9 @@ const component: ClosureComponent = () => { } } - const headers = Object.values(parameters).map((p) => m("th", p["label"])); + const headers = Object.values(parameters).map((p) => + m("th", evaluateExpression(p["label"], device)), + ); const thead = m("thead", m("tr", headers)); diff --git a/ui/overview-page.ts b/ui/overview-page.ts index 404e22a..21bb50c 100644 --- a/ui/overview-page.ts +++ b/ui/overview-page.ts @@ -60,13 +60,19 @@ export const component: ClosureComponent = (): Component => { document.title = "Overview - GenieACS"; const children = []; for (const group of Object.values(GROUPS)) { - if (group["label"]) children.push(m("h1", group["label"])); + if (group["label"]) + children.push( + m("h1", store.evaluateExpression(group["label"], null)), + ); const groupChildren = []; for (const chartName of Object.values(group["charts"]) as string[]) { const chart = vnode.attrs["charts"][chartName]; const chartChildren = []; - if (chart.label) chartChildren.push(m("h2", chart.label)); + if (chart.label) + chartChildren.push( + m("h2", store.evaluateExpression(chart.label, null)), + ); const attrs = {}; attrs["chart"] = chart;