From d2d49a55ddd85418020207508bec4302666c1086 Mon Sep 17 00:00:00 2001 From: Qiuxia Fan Date: Thu, 14 Apr 2022 13:51:54 +0800 Subject: [PATCH] fix data and style --- src/store/modules/topology.ts | 6 +++--- src/views/dashboard/controls/Text.vue | 1 + 2 files changed, 4 insertions(+), 3 deletions(-) diff --git a/src/store/modules/topology.ts b/src/store/modules/topology.ts index 32da7b3f..c381e4bd 100644 --- a/src/store/modules/topology.ts +++ b/src/store/modules/topology.ts @@ -75,7 +75,7 @@ export const topologyStore = defineStore({ setTopology(data: { nodes: Node[]; calls: Call[] }) { const obj = {} as any; const services = useSelectorStore().services; - const nodes = data.nodes.reduce((prev: Node[], next: Node) => { + const nodes = (data.nodes || []).reduce((prev: Node[], next: Node) => { if (!obj[next.id]) { obj[next.id] = true; const s = services.filter((d: Service) => d.id === next.id)[0] || {}; @@ -84,7 +84,7 @@ export const topologyStore = defineStore({ } return prev; }, []); - const calls = data.calls.reduce((prev: Call[], next: Call) => { + const calls = (data.calls || []).reduce((prev: Call[], next: Call) => { if (!obj[next.id]) { obj[next.id] = true; next.value = next.value || 1; @@ -117,7 +117,7 @@ export const topologyStore = defineStore({ async getDepthServiceTopology(serviceIds: string[], depth: number) { const res = await this.getServicesTopology(serviceIds); if (depth > 1) { - const ids = res.nodes + const ids = (res.nodes || []) .map((item: Node) => item.id) .filter((d: string) => !serviceIds.includes(d)); if (!ids.length) { diff --git a/src/views/dashboard/controls/Text.vue b/src/views/dashboard/controls/Text.vue index 98cc0db3..1e1a37bf 100644 --- a/src/views/dashboard/controls/Text.vue +++ b/src/views/dashboard/controls/Text.vue @@ -105,6 +105,7 @@ function editConfig() { cursor: pointer; display: flex; align-items: center; + overflow: auto; } .tools {