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) {
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;

View File

@ -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<Option[]>([]);
const currentConfig = ref<HierarchyServicesConfig>(hierarchyServicesConfig(0) || {});
const currentConfig = ref<HierarchyServicesConfig>(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) || {};

View File

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

View File

@ -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";