fix: update

This commit is contained in:
Fine 2024-01-10 13:53:09 +08:00
parent 2c0d03cbd2
commit 77a08456e6
4 changed files with 19 additions and 15 deletions

View File

@ -129,18 +129,22 @@ export const topologyStore = defineStore({
for (const relation of relations) { for (const relation of relations) {
const upperId = relation.upperInstance.id; const upperId = relation.upperInstance.id;
const lowerId = relation.lowerInstance.id; const lowerId = relation.lowerInstance.id;
if (!nodesMap.get(upperId)) { const lowerKey = `${lowerId}-${relation.lowerInstance.layer}`;
nodesMap.set(upperId, relation.upperInstance); 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)) { if (!nodesMap.get(lowerKey)) {
nodesMap.set(lowerId, relation.lowerInstance); nodesMap.set(lowerKey, lowerObj);
} }
callList.push({ callList.push({
source: upperId, source: lowerKey,
target: lowerId, target: upperKey,
id: `${upperId}->${lowerId}`, id: `${upperKey}->${lowerKey}`,
sourceObj: relation.upperInstance, sourceObj: upperObj,
targetObj: relation.lowerInstance, targetObj: lowerObj,
}); });
} }
this.hierarchyInstanceCalls = callList; this.hierarchyInstanceCalls = callList;

View File

@ -58,15 +58,15 @@ limitations under the License. -->
const dashboardStore = useDashboardStore(); const dashboardStore = useDashboardStore();
const topologyStore = useTopologyStore(); const topologyStore = useTopologyStore();
const selectorStore = useSelectorStore(); const selectorStore = useSelectorStore();
const { hierarchyServicesConfig } = dashboardStore.selectedGrid; const hierarchyServicesConfig = dashboardStore.selectedGrid.hierarchyServicesConfig || [];
const layers = ref<Option[]>([]); const layers = ref<Option[]>([]);
const currentConfig = ref<HierarchyServicesConfig>(hierarchyServicesConfig(0) || {}); const currentConfig = ref<HierarchyServicesConfig>(hierarchyServicesConfig[0] || {});
onMounted(() => { onMounted(() => {
setLayers(); setLayers();
}); });
function changeLayer(opt: Option[]) { function changeLayer(opt: Option[]) {
const { hierarchyServicesConfig } = dashboardStore.selectedGrid; const hierarchyServicesConfig = dashboardStore.selectedGrid.hierarchyServicesConfig || [];
const layer = opt[0].value; const layer = opt[0].value;
currentConfig.value = hierarchyServicesConfig.value.find((d: HierarchyServicesConfig) => d.layer === layer) || {}; currentConfig.value = hierarchyServicesConfig.value.find((d: HierarchyServicesConfig) => d.layer === layer) || {};

View File

@ -95,7 +95,7 @@ limitations under the License. -->
<Icon size="middle" iconName="settings" /> <Icon size="middle" iconName="settings" />
</span> </span>
</div> </div>
<div class="setting" v-if="showSetting && dashboardStore.editMode"> <div class="hierarchy-settings" v-if="showSetting && dashboardStore.editMode">
<hierarchy-settings @update="updateSettings" /> <hierarchy-settings @update="updateSettings" />
</div> </div>
</div> </div>
@ -368,7 +368,7 @@ limitations under the License. -->
} }
} }
.setting { .hierarchy-settings {
position: absolute; position: absolute;
top: 40px; top: 40px;
right: 10px; right: 10px;

View File

@ -147,7 +147,7 @@ limitations under the License. -->
import { EntityType, DepthList, MetricModes, CallTypes } from "@/views/dashboard/data"; import { EntityType, DepthList, MetricModes, CallTypes } from "@/views/dashboard/data";
import router from "@/router"; import router from "@/router";
import { ElMessage } from "element-plus"; import { ElMessage } from "element-plus";
import Settings from "../config/HierarchySettings.vue"; import Settings from "../config/Settings.vue";
import HierarchyMap from "./HierarchyMap.vue"; import HierarchyMap from "./HierarchyMap.vue";
import type { Option } from "@/types/app"; import type { Option } from "@/types/app";
import type { Service } from "@/types/selector"; import type { Service } from "@/types/selector";