From 4b9d1dd362f25e12fa21b2ee3ad637665df1b68f Mon Sep 17 00:00:00 2001 From: Qiuxia Fan Date: Wed, 29 Dec 2021 16:22:23 +0800 Subject: [PATCH] feat: update metric config --- src/store/modules/dashboard.ts | 9 ++++ src/types/app.d.ts | 2 +- .../dashboard/configuration/WidgetConfig.vue | 42 +++++++++++++++---- src/views/dashboard/data.ts | 4 +- 4 files changed, 45 insertions(+), 12 deletions(-) diff --git a/src/store/modules/dashboard.ts b/src/store/modules/dashboard.ts index 01f6add6..981f4ac4 100644 --- a/src/store/modules/dashboard.ts +++ b/src/store/modules/dashboard.ts @@ -17,6 +17,8 @@ import { defineStore } from "pinia"; import { store } from "@/store"; import { LayoutConfig } from "@/types/dashboard"; +import graph from "@/graph"; +import { AxiosResponse } from "axios"; interface DashboardState { showConfig: boolean; @@ -53,6 +55,13 @@ export const dashboardStore = defineStore({ setConfigPanel(show: boolean) { this.showConfig = show; }, + async fetchMetricType(item: string) { + const res: AxiosResponse = await graph + .query("queryTypeOfMetrics") + .params({ name: item }); + + return res.data; + }, }, }); diff --git a/src/types/app.d.ts b/src/types/app.d.ts index f5e3db1e..82369754 100644 --- a/src/types/app.d.ts +++ b/src/types/app.d.ts @@ -15,7 +15,7 @@ * limitations under the License. */ export interface Option { - key: string | number; + value: string | number; label: string; } export interface Duration { diff --git a/src/views/dashboard/configuration/WidgetConfig.vue b/src/views/dashboard/configuration/WidgetConfig.vue index 63caf4d0..21795bad 100644 --- a/src/views/dashboard/configuration/WidgetConfig.vue +++ b/src/views/dashboard/configuration/WidgetConfig.vue @@ -15,9 +15,9 @@ limitations under the License. -->