From 986fe8b90e238e889ab93ae92dc5b7482bf122f5 Mon Sep 17 00:00:00 2001 From: Fine0830 Date: Thu, 25 May 2023 09:12:46 +0800 Subject: [PATCH] fix: topn type (#267) --- src/hooks/useMetricsProcessor.ts | 4 ++-- src/views/dashboard/configuration/widget/metric/Standard.vue | 4 ++-- 2 files changed, 4 insertions(+), 4 deletions(-) diff --git a/src/hooks/useMetricsProcessor.ts b/src/hooks/useMetricsProcessor.ts index 3013f163..0a1265e5 100644 --- a/src/hooks/useMetricsProcessor.ts +++ b/src/hooks/useMetricsProcessor.ts @@ -58,7 +58,7 @@ export function useQueryProcessor(config: Indexable) { parentService: ["All"].includes(dashboardStore.entity) ? null : selectorStore.currentService.value, normal: selectorStore.currentService ? selectorStore.currentService.normal : true, scope: config.catalog, - topN: c.topN || 10, + topN: Number(c.topN) || 10, order: c.sortOrder || "DES", }; } else { @@ -95,7 +95,7 @@ export function useQueryProcessor(config: Indexable) { conditions[`condition${index}`] = { name, parentEntity: entity, - topN: c.topN || 10, + topN: Number(c.topN) || 10, order: c.sortOrder || "DES", }; } else { diff --git a/src/views/dashboard/configuration/widget/metric/Standard.vue b/src/views/dashboard/configuration/widget/metric/Standard.vue index 3381bb27..1172f631 100644 --- a/src/views/dashboard/configuration/widget/metric/Standard.vue +++ b/src/views/dashboard/configuration/widget/metric/Standard.vue @@ -85,7 +85,7 @@ limitations under the License. --> type="number" :min="1" :max="100" - @change="changeConfigs(index, { topN: currentMetric.topN || 10 })" + @change="changeConfigs(index, { topN: Number(currentMetric.topN) || 10 })" /> @@ -150,7 +150,7 @@ limitations under the License. --> () => { currentMetric.value = { ...props.currentMetricConfig, - topN: props.currentMetricConfig.topN || 10, + topN: Number(props.currentMetricConfig.topN) || 10, }; }, );