diff --git a/src/hooks/useExpressionsProcessor.ts b/src/hooks/useExpressionsProcessor.ts index 1adea5d1..94ca8378 100644 --- a/src/hooks/useExpressionsProcessor.ts +++ b/src/hooks/useExpressionsProcessor.ts @@ -227,6 +227,8 @@ export async function useExpressionsQueryPodsMetrics( const subNames: string[] = []; const metricConfigArr: MetricConfigOpt[] = []; const metricTypesArr: string[] = []; + const expressionsTips: string[] = []; + const subExpressionsTips: string[] = []; const data = pods.map((d: any, idx: number) => { for (let index = 0; index < config.expressions.length; index++) { const c: MetricConfigOpt = (config.metricConfig && config.metricConfig[index]) || {}; @@ -235,8 +237,11 @@ export async function useExpressionsQueryPodsMetrics( const obj = resp.data[k] || {}; const results = obj.results || []; const typesOfMQE = obj.type || ""; - const subResults = (resp.data[sub] && resp.data[sub].results) || []; + const subObj = resp.data[sub] || {}; + const subResults = subObj.results || []; + expressionsTips.push(obj.error); + subExpressionsTips.push(subObj.error); if (results.length > 1) { const labels = (c.label || "").split(",").map((item: string) => item.replace(/^\s*|\s*$/g, "")); const labelsIdx = (c.labelsIndex || "").split(",").map((item: string) => item.replace(/^\s*|\s*$/g, "")); @@ -292,7 +297,7 @@ export async function useExpressionsQueryPodsMetrics( return d; }); - return { data, names, subNames, metricConfigArr, metricTypesArr }; + return { data, names, subNames, metricConfigArr, metricTypesArr, expressionsTips, subExpressionsTips }; } const dashboardStore = useDashboardStore(); const params = await expressionsGraphqlPods(); diff --git a/src/views/dashboard/configuration/Widget.vue b/src/views/dashboard/configuration/Widget.vue index 772f2f8d..63c3f4f3 100644 --- a/src/views/dashboard/configuration/Widget.vue +++ b/src/views/dashboard/configuration/Widget.vue @@ -45,6 +45,7 @@ limitations under the License. --> subTypesOfMQE: dashboardStore.selectedGrid.subTypesOfMQE || [], }" :needQuery="true" + @expressionTips="getErrors" />
{{ t("noData") }} @@ -54,7 +55,7 @@ limitations under the License. -->
- + @@ -102,6 +103,8 @@ limitations under the License. --> const dashboardStore = useDashboardStore(); const appStoreWithOut = useAppStoreWithOut(); const loading = ref(false); + const errors = ref([]); + const subErrors = ref([]); const states = reactive<{ activeNames: string; source: unknown; @@ -128,6 +131,11 @@ limitations under the License. --> states.source = source; } + function getErrors(params: { tips: string[]; subTips: string[] }) { + errors.value = params.tips; + subErrors.value = params.subTips; + } + function setLoading(load: boolean) { loading.value = load; } @@ -169,12 +177,15 @@ limitations under the License. --> applyConfig, cancelConfig, getSource, + getErrors, setLoading, widget, graph, title, tips, hasAssociate, + errors, + subErrors, }; }, }); diff --git a/src/views/dashboard/configuration/widget/metric/Index.vue b/src/views/dashboard/configuration/widget/metric/Index.vue index 4ddecb14..b0c3b95a 100644 --- a/src/views/dashboard/configuration/widget/metric/Index.vue +++ b/src/views/dashboard/configuration/widget/metric/Index.vue @@ -93,8 +93,12 @@ limitations under the License. --> /> -
{{ states.tips[index] }}
-
{{ states.tips[index] }}
+
+ {{ (errors || states.tips)[index] }} +
+
+ {{ (subErrors || states.tips)[index] }} +
{{ t("visualization") }}
@@ -110,6 +114,7 @@ limitations under the License. -->