fix data and style

This commit is contained in:
Qiuxia Fan 2022-04-14 13:51:54 +08:00
parent ceec794fce
commit d2d49a55dd
2 changed files with 4 additions and 3 deletions

View File

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

View File

@ -105,6 +105,7 @@ function editConfig() {
cursor: pointer;
display: flex;
align-items: center;
overflow: auto;
}
.tools {