diff --git a/src/components/Selector.vue b/src/components/Selector.vue index 30be63bc..2fae7c58 100644 --- a/src/components/Selector.vue +++ b/src/components/Selector.vue @@ -28,8 +28,8 @@ limitations under the License. --> :filterable="filterable" > :data="item" :activeIndex="`${data.i}-${activeTabIndex}-${item.i}`" :needQuery="needQuery" + :metricsValues="metricsValues" /> @@ -136,6 +137,10 @@ limitations under the License. --> type: Object as PropType, default: () => ({ children: [] }), }, + metricsValues: { + type: Object as PropType, + default: () => ({}), + }, active: { type: Boolean, default: false }, }; export default defineComponent({ diff --git a/src/views/dashboard/controls/Widget.vue b/src/views/dashboard/controls/Widget.vue index b42b34f9..f096ccdf 100644 --- a/src/views/dashboard/controls/Widget.vue +++ b/src/views/dashboard/controls/Widget.vue @@ -88,6 +88,10 @@ limitations under the License. --> type: Object as PropType, default: () => ({ widget: {}, graph: {} }), }, + metricsValues: { + type: Object as PropType, + default: () => ({}), + }, activeIndex: { type: String, default: "" }, needQuery: { type: Boolean, default: false }, }; @@ -111,10 +115,6 @@ limitations under the License. --> const isList = computed(() => ListChartTypes.includes((props.data.graph && props.data.graph.type) || "")); const typesOfMQE = ref([]); - // if ((props.needQuery || !dashboardStore.currentDashboard.id) && !isList.value) { - // queryMetrics(); - // } - async function queryMetrics() { loading.value = true; const e = { @@ -176,48 +176,15 @@ limitations under the License. --> }, ); watch( - () => [selectorStore.currentService, selectorStore.currentDestService], + () => props.metricsValues, () => { - if (isList.value) { - return; - } - if ([EntityType[0].value, EntityType[4].value].includes(dashboardStore.entity)) { - queryMetrics(); - } - }, - ); - watch( - () => [selectorStore.currentPod, selectorStore.currentDestPod], - () => { - if ([EntityType[0].value, EntityType[7].value, EntityType[8].value].includes(dashboardStore.entity)) { - return; - } - if (isList.value) { - return; - } - queryMetrics(); - }, - ); - watch( - () => [selectorStore.currentProcess, selectorStore.currentDestProcess], - () => { - if (isList.value) { - return; - } - if ([EntityType[7].value, EntityType[8].value].includes(dashboardStore.entity)) { - queryMetrics(); - } - }, - ); - watch( - () => appStore.durationTime, - () => { - if (isList.value) { - return; - } - if (dashboardStore.entity === EntityType[1].value) { - queryMetrics(); + loading.value = true; + const params = props.metricsValues[data.value.i]; + if (params) { + state.source = params.source || {}; + typesOfMQE.value = params.typesOfMQE; } + loading.value = false; }, ); diff --git a/src/views/dashboard/panel/Layout.vue b/src/views/dashboard/panel/Layout.vue index 3511e0cf..6265cb3e 100644 --- a/src/views/dashboard/panel/Layout.vue +++ b/src/views/dashboard/panel/Layout.vue @@ -33,19 +33,20 @@ limitations under the License. --> :class="{ active: dashboardStore.activedGridItem === item.i }" :drag-ignore-from="dragIgnoreFrom" > - +
{{ t("noWidget") }}