From 77a08456e6f4901257026d80e283bdca86790d48 Mon Sep 17 00:00:00 2001 From: Fine Date: Wed, 10 Jan 2024 13:53:09 +0800 Subject: [PATCH] fix: update --- src/store/modules/topology.ts | 22 +++++++++++-------- .../topology/config/HierarchySettings.vue | 6 ++--- .../related/topology/service/HierarchyMap.vue | 4 ++-- .../related/topology/service/ServiceMap.vue | 2 +- 4 files changed, 19 insertions(+), 15 deletions(-) diff --git a/src/store/modules/topology.ts b/src/store/modules/topology.ts index 03d14830..a268b81d 100644 --- a/src/store/modules/topology.ts +++ b/src/store/modules/topology.ts @@ -129,18 +129,22 @@ export const topologyStore = defineStore({ for (const relation of relations) { const upperId = relation.upperInstance.id; const lowerId = relation.lowerInstance.id; - if (!nodesMap.get(upperId)) { - nodesMap.set(upperId, relation.upperInstance); + const lowerKey = `${lowerId}-${relation.lowerInstance.layer}`; + const upperKey = `${upperId}-${relation.upperInstance.layer}`; + const lowerObj = { ...relation.lowerInstance, key: lowerId, id: lowerKey }; + const upperObj = { ...relation.upperInstance, key: upperId, id: upperKey }; + if (!nodesMap.get(upperKey)) { + nodesMap.set(upperKey, upperObj); } - if (!nodesMap.get(lowerId)) { - nodesMap.set(lowerId, relation.lowerInstance); + if (!nodesMap.get(lowerKey)) { + nodesMap.set(lowerKey, lowerObj); } callList.push({ - source: upperId, - target: lowerId, - id: `${upperId}->${lowerId}`, - sourceObj: relation.upperInstance, - targetObj: relation.lowerInstance, + source: lowerKey, + target: upperKey, + id: `${upperKey}->${lowerKey}`, + sourceObj: upperObj, + targetObj: lowerObj, }); } this.hierarchyInstanceCalls = callList; diff --git a/src/views/dashboard/related/topology/config/HierarchySettings.vue b/src/views/dashboard/related/topology/config/HierarchySettings.vue index 4e4a8382..dc773f44 100644 --- a/src/views/dashboard/related/topology/config/HierarchySettings.vue +++ b/src/views/dashboard/related/topology/config/HierarchySettings.vue @@ -58,15 +58,15 @@ limitations under the License. --> const dashboardStore = useDashboardStore(); const topologyStore = useTopologyStore(); const selectorStore = useSelectorStore(); - const { hierarchyServicesConfig } = dashboardStore.selectedGrid; + const hierarchyServicesConfig = dashboardStore.selectedGrid.hierarchyServicesConfig || []; const layers = ref([]); - const currentConfig = ref(hierarchyServicesConfig(0) || {}); + const currentConfig = ref(hierarchyServicesConfig[0] || {}); onMounted(() => { setLayers(); }); function changeLayer(opt: Option[]) { - const { hierarchyServicesConfig } = dashboardStore.selectedGrid; + const hierarchyServicesConfig = dashboardStore.selectedGrid.hierarchyServicesConfig || []; const layer = opt[0].value; currentConfig.value = hierarchyServicesConfig.value.find((d: HierarchyServicesConfig) => d.layer === layer) || {}; diff --git a/src/views/dashboard/related/topology/service/HierarchyMap.vue b/src/views/dashboard/related/topology/service/HierarchyMap.vue index 03d64fb3..16eb86da 100644 --- a/src/views/dashboard/related/topology/service/HierarchyMap.vue +++ b/src/views/dashboard/related/topology/service/HierarchyMap.vue @@ -95,7 +95,7 @@ limitations under the License. --> -
+
@@ -368,7 +368,7 @@ limitations under the License. --> } } - .setting { + .hierarchy-settings { position: absolute; top: 40px; right: 10px; diff --git a/src/views/dashboard/related/topology/service/ServiceMap.vue b/src/views/dashboard/related/topology/service/ServiceMap.vue index d0f6f8c7..4df9d24f 100644 --- a/src/views/dashboard/related/topology/service/ServiceMap.vue +++ b/src/views/dashboard/related/topology/service/ServiceMap.vue @@ -147,7 +147,7 @@ limitations under the License. --> import { EntityType, DepthList, MetricModes, CallTypes } from "@/views/dashboard/data"; import router from "@/router"; import { ElMessage } from "element-plus"; - import Settings from "../config/HierarchySettings.vue"; + import Settings from "../config/Settings.vue"; import HierarchyMap from "./HierarchyMap.vue"; import type { Option } from "@/types/app"; import type { Service } from "@/types/selector";