refactor: create a component for metric config

This commit is contained in:
Qiuxia Fan
2022-01-19 18:12:16 +08:00
parent 3d6fe887a5
commit 4baa00001a
10 changed files with 201 additions and 226 deletions

View File

@@ -34,7 +34,7 @@ export const ConfigData: any = {
h: 12,
i: "0",
metrics: ["service_resp_time"],
queryMetricType: "readMetricsValues",
metricTypes: ["readMetricsValues"],
type: "Widget",
widget: {
title: "Title",

View File

@@ -173,10 +173,10 @@ export const dashboardStore = defineStore({
return res.data;
},
async fetchMetricValue(config: LayoutConfig) {
// if (!config.queryMetricType) {
// if (!config.metricTypes) {
// return;
// }
config.queryMetricType = "readMetricsValues";
// config.metricTypes = "readMetricsValues";
const appStoreWithOut = useAppStoreWithOut();
const variable = {
condition: {
@@ -190,7 +190,7 @@ export const dashboardStore = defineStore({
duration: appStoreWithOut.durationTime,
};
const res: AxiosResponse = await graph
.query(config.queryMetricType)
.query("readMetricsValues")
.params(variable);
return res.data;