fix: update

This commit is contained in:
Fine 2023-06-03 15:24:20 +08:00
parent 09e4f6786c
commit b7fe7b4e4c
2 changed files with 18 additions and 2 deletions

View File

@ -25,7 +25,7 @@ import { NewControl, TextConfig, TimeRangeConfig, ControlsTypes } from "../data"
import type { AxiosResponse } from "axios";
import { ElMessage } from "element-plus";
import { useI18n } from "vue-i18n";
import { EntityType } from "@/views/dashboard/data";
import { EntityType, MetricModes } from "@/views/dashboard/data";
interface DashboardState {
showConfig: boolean;
layout: LayoutConfig[];
@ -92,6 +92,9 @@ export const dashboardStore = defineStore({
metricTypes: [""],
metrics: [""],
};
if (type === "Widget") {
newItem.metricMode = MetricModes.Expression;
}
if (type === "Tab") {
newItem.h = 36;
newItem.activedTabIndex = 0;
@ -167,6 +170,9 @@ export const dashboardStore = defineStore({
metricTypes: [""],
metrics: [""],
};
if (type === "Widget") {
newItem.metricMode = MetricModes.Expression;
}
if (type === "Topology") {
newItem.h = 32;
newItem.graph = {

View File

@ -280,12 +280,22 @@ limitations under the License. -->
...dashboardStore.selectedGrid,
metrics: [""],
metricTypes: [""],
expressions: [""],
typesOfMQE: [""],
});
states.metrics = [""];
states.metricTypes = [""];
defaultLen.value = 5;
}
setMetricType(chart);
if (isExpression.value) {
dashboardStore.selectWidget({
...dashboardStore.selectedGrid,
graph: chart,
});
} else {
setMetricType(chart);
}
setDashboards(chart.type);
states.dashboardName = "";
defaultLen.value = 10;