refactor: change the nodes type for Hierarchy Topology (#371)
This commit is contained in:
parent
931cea4c4c
commit
8e58f000a0
|
@ -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 {
|
||||
|
|
|
@ -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();
|
||||
|
|
|
@ -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();
|
||||
|
|
Loading…
Reference in New Issue