refactor: change the nodes type for Hierarchy Topology (#371)

This commit is contained in:
Fine0830 2024-02-02 11:50:43 +08:00 committed by GitHub
parent 931cea4c4c
commit 8e58f000a0
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
3 changed files with 7 additions and 8 deletions

View File

@ -37,6 +37,7 @@ export interface HierarchyNode {
name: string;
layer: string;
level?: number;
key: string;
}
export interface Node {
id: string;
@ -51,8 +52,6 @@ export interface Node {
y?: number;
level?: number;
l?: number;
key?: string;
layer?: string;
}
export interface ServiceHierarchy {

View File

@ -34,7 +34,7 @@ limitations under the License. -->
<script lang="ts" setup>
import { ref, onMounted, nextTick } from "vue";
import * as d3 from "d3";
import type { Node } from "@/types/topology";
import type { HierarchyNode } from "@/types/topology";
import { useTopologyStore } from "@/store/modules/topology";
import { useDashboardStore } from "@/store/modules/dashboard";
import { EntityType, ConfigFieldTypes } from "@/views/dashboard/data";
@ -106,7 +106,7 @@ limitations under the License. -->
}
}
function showNodeTip(event: MouseEvent, data: Node) {
function showNodeTip(event: MouseEvent, data: HierarchyNode) {
if (!data) {
return;
}
@ -148,7 +148,7 @@ limitations under the License. -->
popover.value.style("visibility", "hidden");
}
function handleNodeClick(event: MouseEvent, d: Node & { serviceId: string }) {
function handleNodeClick(event: MouseEvent, d: HierarchyNode & { serviceId: string }) {
const origin = dashboardStore.entity;
event.stopPropagation();
hideTip();

View File

@ -36,7 +36,7 @@ limitations under the License. -->
import type { PropType } from "vue";
import { ref, onMounted, nextTick } from "vue";
import * as d3 from "d3";
import type { Node } from "@/types/topology";
import type { HierarchyNode } from "@/types/topology";
import { useTopologyStore } from "@/store/modules/topology";
import { useDashboardStore } from "@/store/modules/dashboard";
import { EntityType, ConfigFieldTypes } from "@/views/dashboard/data";
@ -114,7 +114,7 @@ limitations under the License. -->
}
}
function showNodeTip(event: MouseEvent, data: Node) {
function showNodeTip(event: MouseEvent, data: HierarchyNode) {
if (!data) {
return;
}
@ -156,7 +156,7 @@ limitations under the License. -->
popover.value.style("visibility", "hidden");
}
function handleNodeClick(event: MouseEvent, d: Node) {
function handleNodeClick(event: MouseEvent, d: HierarchyNode) {
const origin = dashboardStore.entity;
event.stopPropagation();
hideTip();