diff --git a/src/locales/lang/en.ts b/src/locales/lang/en.ts index 7a96f187..d13b9e27 100644 --- a/src/locales/lang/en.ts +++ b/src/locales/lang/en.ts @@ -84,6 +84,8 @@ const msg = { endpointDashboard: "Dashboard name related with endpoints", callSettings: "Call settings", nodeSettings: "Node Settings", + conditions: "Conditions", + legendSettings: "Legend Settings", hourTip: "Select Hour", minuteTip: "Select Minute", secondTip: "Select Second", diff --git a/src/locales/lang/zh.ts b/src/locales/lang/zh.ts index 52fcd8fd..9486a572 100644 --- a/src/locales/lang/zh.ts +++ b/src/locales/lang/zh.ts @@ -83,6 +83,8 @@ const msg = { endpointDashboard: "拓节点端点的实例的仪表板名称", callSettings: "拓扑线设置", nodeSettings: "拓扑点设置", + conditions: "条件", + legendSettings: "图例设置", hourTip: "选择小时", minuteTip: "选择分钟", secondTip: "选择秒数", diff --git a/src/store/modules/topology.ts b/src/store/modules/topology.ts index 2ea85b92..69b01e2c 100644 --- a/src/store/modules/topology.ts +++ b/src/store/modules/topology.ts @@ -344,6 +344,29 @@ export const topologyStore = defineStore({ this.setNodeMetrics(res.data.data); return res.data; }, + async getLegendMetrics(param: { + queryStr: string; + conditions: { [key: string]: unknown }; + }) { + const res: AxiosResponse = await query(param); + + if (res.data.errors) { + return res.data; + } + const data = res.data.data; + const metrics = Object.keys(data); + this.nodes = this.nodes.map((d: Node | any) => { + for (const m of metrics) { + for (const val of data[m].values) { + if (d.id === val.id) { + d[m] = val.value; + } + } + } + return d; + }); + return res.data; + }, async getCallServerMetrics(param: { queryStr: string; conditions: { [key: string]: unknown }; diff --git a/src/views/dashboard/data.ts b/src/views/dashboard/data.ts index d0a93443..5d8b9279 100644 --- a/src/views/dashboard/data.ts +++ b/src/views/dashboard/data.ts @@ -177,3 +177,16 @@ export const ScopeType = [ { value: "Endpoint", label: "Endpoint", key: 3 }, { value: "ServiceInstance", label: "Service Instance", key: 3 }, ]; +export const LegendConditions = [ + { label: "&&", value: "and" }, + { label: "||", value: "or" }, +]; +export const MetricConditions = [ + { label: ">", value: ">" }, + { label: "<", value: "<" }, +]; +export enum LegendOpt { + NAME = "name", + VALUE = "value", + CONDITION = "condition", +} diff --git a/src/views/dashboard/related/topology/components/Graph.vue b/src/views/dashboard/related/topology/components/Graph.vue index 53066e16..c1a5ef1d 100644 --- a/src/views/dashboard/related/topology/components/Graph.vue +++ b/src/views/dashboard/related/topology/components/Graph.vue @@ -20,18 +20,18 @@ limitations under the License. --> :style="`height: ${height}px`" >