From 68ab97e08605c7b3868375bec0fd031add3e2887 Mon Sep 17 00:00:00 2001 From: Fine Date: Tue, 3 Jan 2023 15:47:27 +0800 Subject: [PATCH] refactor: update types --- src/store/data.ts | 2 ++ src/store/modules/dashboard.ts | 6 +++--- 2 files changed, 5 insertions(+), 3 deletions(-) diff --git a/src/store/data.ts b/src/store/data.ts index ce31dd2c..04a51f52 100644 --- a/src/store/data.ts +++ b/src/store/data.ts @@ -37,3 +37,5 @@ export const TimeRangeConfig = { textAlign: "center", text: "text", }; + +export const ControlsTypes = ["Trace", "Profile", "Log", "DemandLog", "Ebpf", "NetworkProfiling", "ThirdPartyApp"]; diff --git a/src/store/modules/dashboard.ts b/src/store/modules/dashboard.ts index 4569b261..7a20c78f 100644 --- a/src/store/modules/dashboard.ts +++ b/src/store/modules/dashboard.ts @@ -21,7 +21,7 @@ import graphql from "@/graphql"; import query from "@/graphql/fetch"; import type { DashboardItem } from "@/types/dashboard"; import { useSelectorStore } from "@/store/modules/selectors"; -import { NewControl, TextConfig, TimeRangeConfig } from "../data"; +import { NewControl, TextConfig, TimeRangeConfig, ControlsTypes } from "../data"; import type { AxiosResponse } from "axios"; import { ElMessage } from "element-plus"; import { useI18n } from "vue-i18n"; @@ -108,7 +108,7 @@ export const dashboardStore = defineStore({ depth: this.entity === EntityType[1].value ? 1 : this.entity === EntityType[0].value ? 2 : 3, }; } - if (["Trace", "Profile", "Log", "DemandLog", "Ebpf", "NetworkProfiling", "ThirdPartyApp"].includes(type)) { + if (ControlsTypes.includes(type)) { newItem.h = 36; } if (type === "Text") { @@ -168,7 +168,7 @@ export const dashboardStore = defineStore({ showDepth: true, }; } - if (["Trace", "Profile", "Log", "DemandLog", "Ebpf", "NetworkProfiling", "ThirdPartyApp"].includes(type)) { + if (ControlsTypes.includes(type)) { newItem.h = 32; } if (type === "Text") {