diff --git a/src/hooks/useDashboardsSession.ts b/src/hooks/useDashboardsSession.ts index a51a25f2..a97d7c33 100644 --- a/src/hooks/useDashboardsSession.ts +++ b/src/hooks/useDashboardsSession.ts @@ -17,15 +17,25 @@ import { ElMessage } from "element-plus"; import { useDashboardStore } from "@/store/modules/dashboard"; import type { LayoutConfig } from "@/types/dashboard"; +import { ConfigFieldTypes } from "@/views/dashboard/data"; -export default function getDashboard(param?: { name: string; layer: string; entity: string }) { +export default function getDashboard(param?: { name?: string; layer: string; entity: string }, t?: string) { + const type = t || ConfigFieldTypes.NAME; // "NAME" or "ISDEFAULT" const dashboardStore = useDashboardStore(); const opt = param || dashboardStore.currentDashboard; const list = JSON.parse(sessionStorage.getItem("dashboards") || "[]"); - const dashboard = list.find( - (d: { name: string; layer: string; entity: string }) => - d.name === opt.name && d.entity === opt.entity && d.layer === opt.layer, - ); + let dashboard; + if (type === ConfigFieldTypes.NAME) { + dashboard = list.find( + (d: { name: string; layer: string; entity: string }) => + d.name === opt.name && d.entity === opt.entity && d.layer === opt.layer, + ); + } else { + dashboard = list.find( + (d: { name: string; layer: string; entity: string; isDefault: boolean }) => + d.isDefault && d.entity === opt.entity && d.layer === opt.layer, + ); + } const all = dashboardStore.layout; const widgets: LayoutConfig[] = []; for (const item of all) { diff --git a/src/locales/lang/en.ts b/src/locales/lang/en.ts index 51a33db6..a27f917e 100644 --- a/src/locales/lang/en.ts +++ b/src/locales/lang/en.ts @@ -386,5 +386,6 @@ const msg = { "The trace segment serves as a representation of a trace portion executed within one single OS process, such as a JVM. It comprises a collection of spans, typically associated with and collected from a single request or execution context.", tabExpressions: "Tab Expressions", hierarchyServicesSettings: "Service Hierarchy Topology Settings", + hierarchyNodeMetrics: "Metrics related with hierarchy topology nodes", }; export default msg; diff --git a/src/locales/lang/es.ts b/src/locales/lang/es.ts index cd4f9cf8..8b3627b0 100644 --- a/src/locales/lang/es.ts +++ b/src/locales/lang/es.ts @@ -386,5 +386,6 @@ const msg = { "The trace segment serves as a representation of a trace portion executed within one single OS process, such as a JVM. It comprises a collection of spans, typically associated with and collected from a single request or execution context.", tabExpressions: "Tab Expressions", hierarchyServicesSettings: "Service Hierarchy Topology Settings", + hierarchyNodeMetrics: "Metrics related with hierarchy topology nodes", }; export default msg; diff --git a/src/locales/lang/zh.ts b/src/locales/lang/zh.ts index f84bcea2..e7ebbafb 100644 --- a/src/locales/lang/zh.ts +++ b/src/locales/lang/zh.ts @@ -384,5 +384,6 @@ const msg = { "Trace Segment代表在单一操作系统进程(例如JVM)中执行的追踪部分。它包含了一组跨度(spans),这些跨度通常与单一请求或执行上下文关联。", tabExpressions: "Tab表达式", hierarchyServicesSettings: "层次结构服务拓扑设置", + hierarchyNodeMetrics: "层级拓扑节点关联的指标", }; export default msg; diff --git a/src/types/dashboard.d.ts b/src/types/dashboard.d.ts index 7abdb57b..6fb6a929 100644 --- a/src/types/dashboard.d.ts +++ b/src/types/dashboard.d.ts @@ -22,6 +22,7 @@ export type DashboardItem = { isRoot: boolean; name: string; isDefault: boolean; + expressions?: string[]; }; export interface LayoutConfig { x: number; diff --git a/src/views/dashboard/List.vue b/src/views/dashboard/List.vue index 25373068..f9489ce0 100644 --- a/src/views/dashboard/List.vue +++ b/src/views/dashboard/List.vue @@ -78,7 +78,7 @@ limitations under the License. -->