From 62b3692ee3723aed9f0ad7f15adf1f0847c76f8c Mon Sep 17 00:00:00 2001 From: Fine Date: Fri, 12 Jan 2024 10:26:38 +0800 Subject: [PATCH] fix: query param --- src/hooks/useExpressionsProcessor.ts | 12 ++++++++++-- src/store/modules/topology.ts | 12 ++++-------- 2 files changed, 14 insertions(+), 10 deletions(-) diff --git a/src/hooks/useExpressionsProcessor.ts b/src/hooks/useExpressionsProcessor.ts index e237cb0d..63db0e29 100644 --- a/src/hooks/useExpressionsProcessor.ts +++ b/src/hooks/useExpressionsProcessor.ts @@ -332,10 +332,14 @@ export function useQueryTopologyExpressionsProcessor(metrics: string[], instance let serviceInstanceName; let destServiceInstanceName; let destEndpointName; + let normal = false; + let destNormal; if (d.sourceObj && d.targetObj) { // instances = Calls serviceName = d.sourceObj.serviceName || d.sourceObj.name; destServiceName = d.targetObj.serviceName || d.targetObj.name; + normal = d.sourceObj.normal || d.sourceObj.isReal || false; + destNormal = d.targetObj.normal || d.targetObj.isReal || false; if (EntityType[4].value === dashboardStore.entity) { serviceInstanceName = d.sourceObj.name; destServiceInstanceName = d.targetObj.name; @@ -347,6 +351,10 @@ export function useQueryTopologyExpressionsProcessor(metrics: string[], instance } else { // instances = Nodes serviceName = d.serviceName || d.name; + normal = d.normal || d.isReal || false; + if (EntityType[3].value === dashboardStore.entity) { + serviceInstanceName = d.name; + } if (EntityType[4].value === dashboardStore.entity) { serviceInstanceName = d.name; } @@ -356,11 +364,11 @@ export function useQueryTopologyExpressionsProcessor(metrics: string[], instance } const entity = { serviceName, - normal: true, + normal, serviceInstanceName, endpointName, destServiceName, - destNormal: destServiceName ? true : undefined, + destNormal: destServiceName ? destNormal : undefined, destServiceInstanceName, destEndpointName, }; diff --git a/src/store/modules/topology.ts b/src/store/modules/topology.ts index 075cbfc7..f8d92ec1 100644 --- a/src/store/modules/topology.ts +++ b/src/store/modules/topology.ts @@ -611,13 +611,10 @@ export const topologyStore = defineStore({ async queryHierarchyNodeExpressions(expressions: string[], layer: string) { const nodes = this.hierarchyServiceNodes.filter((n: Node) => n.layer === layer); if (!nodes.length) { - return; - } - if (!expressions.length) { this.setHierarchyNodeMetricValue({}, layer); return; } - if (!this.hierarchyServiceNodes.length) { + if (!expressions.length) { this.setHierarchyNodeMetricValue({}, layer); return; } @@ -626,17 +623,16 @@ export const topologyStore = defineStore({ }, async queryHierarchyInstanceNodeExpressions(expressions: string[], layer: string) { const nodes = this.hierarchyInstanceNodes.filter((n: Node) => n.layer === layer); - if (!nodes.length) { - return; - } + if (!expressions.length) { this.setHierarchyInstanceNodeMetricValue({}, layer); return; } - if (!this.hierarchyServiceNodes.length) { + if (!nodes.length) { this.setHierarchyInstanceNodeMetricValue({}, layer); return; } + console.log(nodes); const metrics = await this.queryHierarchyExpressions(expressions, nodes); this.setHierarchyInstanceNodeMetricValue(metrics, layer); },