feat: update tabs

This commit is contained in:
Fine 2023-12-12 15:49:16 +08:00
parent 16decafa1c
commit 2a9fde6805
2 changed files with 9 additions and 5 deletions

View File

@ -36,7 +36,7 @@ export interface LayoutConfig {
expressions?: string[]; expressions?: string[];
metricTypes?: string[]; metricTypes?: string[];
typesOfMQE?: string[]; typesOfMQE?: string[];
children?: { name: string; children: LayoutConfig[]; expression?: string; enable: boolean }[]; children?: { name: string; children: LayoutConfig[]; expression?: string; enable?: boolean }[];
activedTabIndex?: number; activedTabIndex?: number;
metricConfig?: MetricConfigOpt[]; metricConfig?: MetricConfigOpt[];
id?: string; id?: string;

View File

@ -20,6 +20,7 @@ limitations under the License. -->
:key="idx" :key="idx"
:class="{ active: activeTabIndex === idx }" :class="{ active: activeTabIndex === idx }"
@click="clickTabs($event, idx)" @click="clickTabs($event, idx)"
v-show="child.enable !== false"
> >
<input <input
@click="editTabName($event, idx)" @click="editTabName($event, idx)"
@ -249,17 +250,20 @@ limitations under the License. -->
for (const child of tabsProps.children || []) { for (const child of tabsProps.children || []) {
if (params.source[child.expression || ""]) { if (params.source[child.expression || ""]) {
child.enable = !!Number(params.source[child.expression || ""]) || true; child.enable = !!Number(params.source[child.expression || ""]);
} else { } else {
child.enable = true; child.enable = true;
} }
} }
console.log(tabsProps); dashboardStore.setConfigs(tabsProps);
} }
watch( watch(
() => (props.data.children || []).map((d: { name: string }) => d.name), () => (props.data.children || []).map((d: any) => d.expression),
() => { (old: string[], data: string[]) => {
if (JSON.stringify(data) === JSON.stringify(old)) {
return;
}
queryExpressions(); queryExpressions();
}, },
); );