diff --git a/src/views/dashboard/configuration/widget/metric/Index.vue b/src/views/dashboard/configuration/widget/metric/Index.vue index e207a0b8..cdb31f0d 100644 --- a/src/views/dashboard/configuration/widget/metric/Index.vue +++ b/src/views/dashboard/configuration/widget/metric/Index.vue @@ -242,7 +242,10 @@ async function setMetricType(chart?: any) { } function setDashboards(type?: string) { - const chart = type || dashboardStore.selectedGrid.graph || {}; + const chart = + type || + (dashboardStore.selectedGrid.graph && + dashboardStore.selectedGrid.graph.type); const list = JSON.parse(sessionStorage.getItem("dashboards") || "[]"); const arr = list.reduce( ( @@ -251,9 +254,9 @@ function setDashboards(type?: string) { ) => { if (d.layer === dashboardStore.layerId) { if ( - (d.entity === EntityType[0].value && chart.type === "ServiceList") || - (d.entity === EntityType[2].value && chart.type === "EndpointList") || - (d.entity === EntityType[3].value && chart.type === "InstanceList") + (d.entity === EntityType[0].value && chart === "ServiceList") || + (d.entity === EntityType[2].value && chart === "EndpointList") || + (d.entity === EntityType[3].value && chart === "InstanceList") ) { prev.push({ ...d, diff --git a/src/views/dashboard/configuration/widget/metric/Standard.vue b/src/views/dashboard/configuration/widget/metric/Standard.vue index 65d3ae6f..1ba282c4 100644 --- a/src/views/dashboard/configuration/widget/metric/Standard.vue +++ b/src/views/dashboard/configuration/widget/metric/Standard.vue @@ -115,7 +115,9 @@ const currentMetric = ref({ topN: props.currentMetricConfig.topN || 10, }); const metricTypes = dashboardStore.selectedGrid.metricTypes || []; -const metricType = computed(() => metricTypes[props.index]); +const metricType = computed( + () => (dashboardStore.selectedGrid.metricTypes || [])[props.index] +); const hasLabel = computed(() => { const graph = dashboardStore.selectedGrid.graph || {}; return ( diff --git a/src/views/dashboard/graphs/ServiceList.vue b/src/views/dashboard/graphs/ServiceList.vue index e66e3705..4db2542d 100644 --- a/src/views/dashboard/graphs/ServiceList.vue +++ b/src/views/dashboard/graphs/ServiceList.vue @@ -211,7 +211,7 @@ async function queryServiceMetrics(currentServices: Service[]) { if (metrics.length && metrics[0] && types.length && types[0]) { const params = await useQueryPodsMetrics( currentServices, - props.config, + { ...props.config, metricConfig: metricConfig.value || [] }, EntityType[0].value ); const json = await dashboardStore.fetchMetricValue(params);