From 8eebc0a8c33d7f5153011a781a8f18fbff4e2c34 Mon Sep 17 00:00:00 2001 From: Fine Date: Sun, 4 Jun 2023 14:05:44 +0800 Subject: [PATCH] fix: address pr --- src/hooks/useExpressionsProcessor.ts | 3 +-- src/views/dashboard/configuration/widget/metric/Index.vue | 2 +- src/views/dashboard/configuration/widget/metric/Standard.vue | 4 ++-- 3 files changed, 4 insertions(+), 5 deletions(-) diff --git a/src/hooks/useExpressionsProcessor.ts b/src/hooks/useExpressionsProcessor.ts index 57f9681e..345fde92 100644 --- a/src/hooks/useExpressionsProcessor.ts +++ b/src/hooks/useExpressionsProcessor.ts @@ -119,11 +119,10 @@ export function useExpressionsSourceProcessor( source[c.label || name] = results[0].values.map((d: { value: unknown }) => d.value) || []; } else { 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, "")); for (const item of results) { const values = item.values.map((d: { value: unknown }) => d.value) || []; const index = item.metric.labels[0].value; - const indexNum = labelsIdx.findIndex((d: string) => d === index); + const indexNum = labels.findIndex((_, i: number) => i === Number(index)); if (labels[indexNum] && indexNum > -1) { source[labels[indexNum]] = values; } else { diff --git a/src/views/dashboard/configuration/widget/metric/Index.vue b/src/views/dashboard/configuration/widget/metric/Index.vue index d16272b3..c54cdfda 100644 --- a/src/views/dashboard/configuration/widget/metric/Index.vue +++ b/src/views/dashboard/configuration/widget/metric/Index.vue @@ -34,7 +34,7 @@ limitations under the License. --> size="small" @change="changeMetricMode" /> -
+
Summary Detail
diff --git a/src/views/dashboard/configuration/widget/metric/Standard.vue b/src/views/dashboard/configuration/widget/metric/Standard.vue index d9bee424..8ba76a6a 100644 --- a/src/views/dashboard/configuration/widget/metric/Standard.vue +++ b/src/views/dashboard/configuration/widget/metric/Standard.vue @@ -45,8 +45,8 @@ limitations under the License. -->
{{ t("labelsIndex") }}