diff --git a/src/hooks/useSnapshot.ts b/src/hooks/useSnapshot.ts
index 31848728..0448418c 100644
--- a/src/hooks/useSnapshot.ts
+++ b/src/hooks/useSnapshot.ts
@@ -34,7 +34,24 @@ export function useSnapshot(metrics: { name: string; results: any[] }[]) {
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 label = item.metric.labels[0];
+ metricsMap[`${label.key}=${label.value}`] = arr;
+ }
+ }
+ }
+ return metricsMap;
+ }
+
return {
processResults,
+ getMetricsMap,
};
}
diff --git a/src/types/dashboard.d.ts b/src/types/dashboard.d.ts
index fa72ce4a..564a87c7 100644
--- a/src/types/dashboard.d.ts
+++ b/src/types/dashboard.d.ts
@@ -111,6 +111,7 @@ export interface LineConfig extends AreaConfig {
showYAxis?: boolean;
smallTips?: boolean;
showlabels?: boolean;
+ noTooltips?: boolean;
}
export interface AreaConfig {
diff --git a/src/views/alarm/Content.vue b/src/views/alarm/Content.vue
index 759422b1..ac859653 100644
--- a/src/views/alarm/Content.vue
+++ b/src/views/alarm/Content.vue
@@ -22,15 +22,30 @@ limitations under the License. -->
{{ i.message }}
-
- {{ t(i.scope.toLowerCase()) }}
+
+
+ {{ t(i.scope.toLowerCase()) }}
+
+
+
+
{{ dateFormat(parseInt(i.startTime)) }}
@@ -118,12 +133,16 @@ limitations under the License. -->
import { useI18n } from "vue-i18n";
import type { Alarm, Event } from "@/types/alarm";
import { useAlarmStore } from "@/store/modules/alarm";
+ import { useAppStoreWithOut } from "@/store/modules/app";
import { EventsDetailHeaders, AlarmDetailCol, EventsDetailKeys } from "./data";
import { dateFormat } from "@/utils/dateFormat";
+ import { useSnapshot } from "@/hooks/useSnapshot";
import Snapshot from "./components/Snapshot.vue";
+ import Line from "@/views/dashboard/graphs/Line.vue";
const { t } = useI18n();
const alarmStore = useAlarmStore();
+ const appStore = useAppStoreWithOut();
const isShowDetails = ref
(false);
const showEventDetails = ref(false);
const currentDetail = ref({});
@@ -144,6 +163,12 @@ limitations under the License. -->
currentEvent.value = event;
showEventDetails.value = true;
}
+
+ function handleMetrics(snapshot: any) {
+ const { getMetricsMap } = useSnapshot(snapshot.metrics);
+
+ return getMetricsMap();
+ }
diff --git a/src/views/dashboard/graphs/Line.vue b/src/views/dashboard/graphs/Line.vue
index 3a48b844..d6a199c9 100644
--- a/src/views/dashboard/graphs/Line.vue
+++ b/src/views/dashboard/graphs/Line.vue
@@ -60,6 +60,7 @@ limitations under the License. -->
showYAxis: true,
smallTips: false,
showlabels: true,
+ noTooltips: false,
}),
},
});
@@ -97,6 +98,7 @@ limitations under the License. -->
const color: string[] = chartColors();
const tooltip = {
trigger: "axis",
+ show: !props.config.noTooltips,
backgroundColor: appStore.theme === Themes.Dark ? "#333" : "#fff",
borderColor: appStore.theme === Themes.Dark ? "#333" : "#fff",
textStyle: {
@@ -108,10 +110,10 @@ limitations under the License. -->
extraCssText: "max-height:85%; overflow: auto;",
};
const tips = {
+ show: !props.config.noTooltips,
formatter(params: any) {
return `${params[0].value[1]}`;
},
- confine: true,
extraCssText: `height: 20px; padding:0 2px;`,
trigger: "axis",
backgroundColor: appStore.theme === Themes.Dark ? "#666" : "#eee",