diff --git a/src/components/Graph.vue b/src/components/Graph.vue index 217831b7..a694cdeb 100644 --- a/src/components/Graph.vue +++ b/src/components/Graph.vue @@ -53,6 +53,9 @@ const available = computed( (Array.isArray(props.option.series.data) && props.option.series.data[0]) ); onMounted(async () => { + if (!available.value) { + return; + } await setOptions(props.option); chartRef.value && addResizeListener(unref(chartRef), resize); setTimeout(() => { @@ -70,6 +73,9 @@ onMounted(async () => { watch( () => props.option, (newVal, oldVal) => { + if (!available.value) { + return; + } if (JSON.stringify(newVal) === JSON.stringify(oldVal)) { return; } diff --git a/src/views/dashboard/configuration/Widget.vue b/src/views/dashboard/configuration/Widget.vue index 9e804297..3cc992ec 100644 --- a/src/views/dashboard/configuration/Widget.vue +++ b/src/views/dashboard/configuration/Widget.vue @@ -37,6 +37,7 @@ limitations under the License. --> metricTypes: dashboardStore.selectedGrid.metricTypes, metricConfig: dashboardStore.selectedGrid.metricConfig, }" + :needQuery="true" />
{{ t("noData") }} diff --git a/src/views/dashboard/graphs/EndpointList.vue b/src/views/dashboard/graphs/EndpointList.vue index 838a1d9a..9dc8d1b6 100644 --- a/src/views/dashboard/graphs/EndpointList.vue +++ b/src/views/dashboard/graphs/EndpointList.vue @@ -111,9 +111,10 @@ const props = defineProps({ i: "", }), }, + needQuery: { type: Boolean, default: false }, intervalTime: { type: Array as PropType, default: () => [] }, }); -// const emit = defineEmits(["changeOpt"]); + const selectorStore = useSelectorStore(); const dashboardStore = useDashboardStore(); const chartLoading = ref(false); @@ -121,8 +122,9 @@ const endpoints = ref([]); const searchText = ref(""); const colMetrics = computed(() => props.config.metrics.map((d: string) => d)); -queryEndpoints(); - +if (props.needQuery) { + queryEndpoints(); +} async function queryEndpoints() { chartLoading.value = true; const resp = await selectorStore.getEndpoints({ diff --git a/src/views/dashboard/graphs/InstanceList.vue b/src/views/dashboard/graphs/InstanceList.vue index e3641668..4a1b367d 100644 --- a/src/views/dashboard/graphs/InstanceList.vue +++ b/src/views/dashboard/graphs/InstanceList.vue @@ -48,6 +48,7 @@ limitations under the License. --> getLabel(metric, index) )} ${decodeURIComponent(getUnit(index))}`" :key="metric + index" + min-width="120" > - +