diff --git a/src/views/dashboard/related/topology/components/Graph.vue b/src/views/dashboard/related/topology/components/Graph.vue index 5460c426..2a3d70b7 100644 --- a/src/views/dashboard/related/topology/components/Graph.vue +++ b/src/views/dashboard/related/topology/components/Graph.vue @@ -122,10 +122,7 @@ const settings = ref(props.config); const operationsPos = reactive<{ x: number; y: number }>({ x: NaN, y: NaN }); const items = ref< { id: string; title: string; func: any; dashboard?: string }[] ->([ - { id: "inspect", title: "Inspect", func: handleInspect }, - { id: "alarm", title: "Alarm", func: handleGoAlarm }, -]); +>([]); const depth = ref(props.config.graph.depth || 2); onMounted(async () => { @@ -148,6 +145,7 @@ onMounted(async () => { svg.value = d3.select(chart.value).append("svg").attr("class", "topo-svg"); await init(); update(); + setNodeTools(settings.value.nodeDashboard); }); async function init() { tip.value = (d3tip as any)().attr("class", "d3-tip").offset([-8, 0]); @@ -472,16 +470,19 @@ function resize() { svg.value.attr("height", height.value).attr("width", width.value); } function updateSettings(config: any) { + settings.value = config; + setNodeTools(config.nodeDashboard); +} +function setNodeTools(nodeDashboard: any) { items.value = [ { id: "inspect", title: "Inspect", func: handleInspect }, { id: "alarm", title: "Alarm", func: handleGoAlarm }, ]; - settings.value = config; - for (const item of config.nodeDashboard) { + for (const item of nodeDashboard) { if (item.scope === EntityType[0].value) { items.value.push({ id: "dashboard", - title: "Dashboard", + title: "Service Dashboard", func: handleGoDashboard, ...item, }); @@ -489,7 +490,7 @@ function updateSettings(config: any) { if (item.scope === EntityType[2].value) { items.value.push({ id: "endpoint", - title: "Endpoint", + title: "Endpoint Dashboard", func: handleGoEndpoint, ...item, }); @@ -497,7 +498,7 @@ function updateSettings(config: any) { if (item.scope === EntityType[3].value) { items.value.push({ id: "instance", - title: "Service Instance", + title: "Service Instance Dashboard", func: handleGoInstance, ...item, }); @@ -577,7 +578,6 @@ watch( span { display: block; height: 30px; - width: 140px; line-height: 30px; text-align: center; } diff --git a/src/views/dashboard/related/topology/components/Settings.vue b/src/views/dashboard/related/topology/components/Settings.vue index f1d9e35f..0247d1cd 100644 --- a/src/views/dashboard/related/topology/components/Settings.vue +++ b/src/views/dashboard/related/topology/components/Settings.vue @@ -325,6 +325,7 @@ function changeScope(index: number, opt: Option[] | any) { [] ); items[index].dashboard = states.nodeDashboards[0].value; + updateSettings(); } function updateNodeDashboards(index: number, content: Option[] | any) { items[index].dashboard = content[0].value;