Fix label issue in some components

This commit is contained in:
Zaid Humaimidi committed 2023-12-18 11:33:49 -08:00
1 parent ddb240d542
commit bfbbdb12ca
3 files changed
+13 -5

No files matched your search

+2 -2
View File
@@ -27,7 +27,7 @@ interface Attrs {
device: FlatDevice; device: FlatDevice;
parameters: Record< parameters: Record<
string, string,
{ type?: Expression; label: string; parameter: Expression } { type?: Expression; label: Expression; parameter: Expression }
>; >;
deviceQuery: QueryResponse; deviceQuery: QueryResponse;
} }
@@ -62,7 +62,7 @@ const component: ClosureComponent<Attrs> = () => {
: "none"; : "none";
}, },
}, },
m("th", parameter["label"]), m("th", evaluateExpression(parameter.label, device)),
m("td", p), m("td", p),
); );
}); });
+3 -1
View File
@@ -61,7 +61,9 @@ const component: ClosureComponent<Attrs> = () => {
} }
} }
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)); const thead = m("thead", m("tr", headers));
+8 -2
View File
@@ -60,13 +60,19 @@ export const component: ClosureComponent = (): Component => {
document.title = "Overview - GenieACS"; document.title = "Overview - GenieACS";
const children = []; const children = [];
for (const group of Object.values(GROUPS)) { 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 = []; const groupChildren = [];
for (const chartName of Object.values(group["charts"]) as string[]) { for (const chartName of Object.values(group["charts"]) as string[]) {
const chart = vnode.attrs["charts"][chartName]; const chart = vnode.attrs["charts"][chartName];
const chartChildren = []; 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 = {}; const attrs = {};
attrs["chart"] = chart; attrs["chart"] = chart;