From a607b6710de4130736af000bbf923414903fb0a6 Mon Sep 17 00:00:00 2001 From: Fine Date: Mon, 13 Jan 2025 16:25:29 +0800 Subject: [PATCH] remove mini chart --- src/hooks/useSnapshot.ts | 20 -------------------- src/views/alarm/Content.vue | 10 ---------- 2 files changed, 30 deletions(-) diff --git a/src/hooks/useSnapshot.ts b/src/hooks/useSnapshot.ts index 5637d555..fe46b35e 100644 --- a/src/hooks/useSnapshot.ts +++ b/src/hooks/useSnapshot.ts @@ -38,27 +38,7 @@ export function useSnapshot(metrics: { name: string; results: MetricsResults[] } return sources; } - function getMetricsMap() { - const metricsMap: { [key: string]: number[] } = {}; - for (const metric of metrics) { - for (const item of metric.results) { - const arr = item.values.map((v: { value: string }) => Number(v.value)); - if (!item.metric.labels.length) { - metricsMap[metric.name] = arr; - } else { - const name = item.metric.labels - .map((label: { key: string; value: string }) => `${label.key}=${label.value}`) - .join(","); - metricsMap[name] = arr; - } - } - } - - return metricsMap; - } - return { processResults, - getMetricsMap, }; } diff --git a/src/views/alarm/Content.vue b/src/views/alarm/Content.vue index 489a3150..ff7fe1c9 100644 --- a/src/views/alarm/Content.vue +++ b/src/views/alarm/Content.vue @@ -122,9 +122,7 @@ limitations under the License. --> import { useAlarmStore } from "@/store/modules/alarm"; import { EventsDetailHeaders, AlarmDetailCol, EventsDetailKeys } from "./data"; import { dateFormat } from "@/utils/dateFormat"; - import { useSnapshot } from "@/hooks/useSnapshot"; import Snapshot from "./components/Snapshot.vue"; - import type { MetricsResults } from "@/types/dashboard"; const { t } = useI18n(); const alarmStore = useAlarmStore(); @@ -148,14 +146,6 @@ limitations under the License. --> currentEvent.value = event; showEventDetails.value = true; } - - function handleMetrics(snapshot: { metrics: { name: string; results: MetricsResults[] }[] }) { - const { getMetricsMap } = useSnapshot(snapshot.metrics); - const metrics = getMetricsMap(); - const keys = Object.keys(metrics); - - return { [keys[0]]: metrics[keys[0]] }; - }