From 7ee7162165a8f0880ecd21f822cc951f35be150d Mon Sep 17 00:00:00 2001 From: Qiuxia Fan Date: Tue, 25 Jan 2022 16:39:40 +0800 Subject: [PATCH] fix: avoid refetch data --- src/views/dashboard/controls/Widget.vue | 18 ++++++++++++++++-- 1 file changed, 16 insertions(+), 2 deletions(-) diff --git a/src/views/dashboard/controls/Widget.vue b/src/views/dashboard/controls/Widget.vue index 2393da29..d78f94a1 100644 --- a/src/views/dashboard/controls/Widget.vue +++ b/src/views/dashboard/controls/Widget.vue @@ -69,7 +69,7 @@ import { useSelectorStore } from "@/store/modules/selectors"; import graphs from "../graphs"; import { useI18n } from "vue-i18n"; import { useQueryProcessor, useSourceProcessor } from "@/hooks/useProcessor"; -import { TableChartTypes } from "../data"; +import { EntityType, TableChartTypes } from "../data"; const props = { data: { @@ -133,8 +133,22 @@ export default defineComponent({ } ); watch( - () => [selectorStore.currentService, selectorStore.currentPod], + () => [selectorStore.currentService], () => { + if (dashboardStore.entity === EntityType[0].value) { + queryMetrics(); + } + } + ); + watch( + () => [selectorStore.currentPod], + () => { + if ( + dashboardStore.entity === EntityType[0].value || + dashboardStore.entity === EntityType[1].value + ) { + return; + } queryMetrics(); } );