Skip to content

Commit

Permalink
Fix initialization dashboards (#424)
Browse files Browse the repository at this point in the history
  • Loading branch information
Fine0830 authored Oct 24, 2024
1 parent 4c60f69 commit 224e761
Showing 1 changed file with 13 additions and 7 deletions.
20 changes: 13 additions & 7 deletions src/views/dashboard/panel/Layout.vue
Original file line number Diff line number Diff line change
Expand Up @@ -78,15 +78,19 @@ limitations under the License. -->
}
async function queryMetrics() {
const widgets = [];
for (const item of dashboardStore.layout) {
const isList = ListChartTypes.includes(item.type || "");
if (item.type === WidgetType.Widget && !isList) {
widgets.push(item);
if (item.type === WidgetType.Widget) {
if (!ListChartTypes.includes(item.graph?.type || "")) {
widgets.push(item);
}
}
if (item.type === WidgetType.Tab) {
const index = isNaN(item.activedTabIndex) ? 0 : item.activedTabIndex;
widgets.push(...item.children[index].children);
widgets.push(
...item.children[index].children.filter(
(d: LayoutConfig) => !ListChartTypes.includes(d.graph?.type || ""),
),
);
}
}
const configList = widgets.map((d: LayoutConfig) => ({
Expand All @@ -103,7 +107,9 @@ limitations under the License. -->
}
async function queryTabsMetrics() {
const configList = dashboardStore.currentTabItems
.filter((item: LayoutConfig) => item.type === WidgetType.Widget && !ListChartTypes.includes(item.type || ""))
.filter(
(item: LayoutConfig) => item.type === WidgetType.Widget && !ListChartTypes.includes(item.graph?.type || ""),
)
.map((d: LayoutConfig) => ({
metrics: d.expressions || [],
metricConfig: d.metricConfig || [],
Expand Down Expand Up @@ -151,7 +157,7 @@ limitations under the License. -->
},
);
watch(
() => appStore.durationTime,
() => [appStore.durationTime, dashboardStore.layout],
() => {
if (dashboardStore.entity === EntityType[1].value) {
queryMetrics();
Expand Down

0 comments on commit 224e761

Please sign in to comment.