mirror of
https://github.com/apache/skywalking-booster-ui.git
synced 2025-05-01 22:24:25 +00:00
fix: avoid querying data with empty parameters (#331)
* fix: Avoid querying data with empty parameters
This commit is contained in:
parent
6fb4f074c1
commit
d9064e8b45
@ -191,6 +191,9 @@ export const topologyStore = defineStore({
|
||||
}
|
||||
},
|
||||
async getServicesTopology(serviceIds: string[]) {
|
||||
if (!serviceIds.length) {
|
||||
return new Promise((resolve) => resolve({}));
|
||||
}
|
||||
const duration = useAppStoreWithOut().durationTime;
|
||||
const res: AxiosResponse = await graphql.query("getServicesTopology").params({
|
||||
serviceIds,
|
||||
@ -207,7 +210,7 @@ export const topologyStore = defineStore({
|
||||
const clientServiceId = (currentDestService && currentDestService.id) || "";
|
||||
const duration = useAppStoreWithOut().durationTime;
|
||||
if (!(serverServiceId && clientServiceId)) {
|
||||
return;
|
||||
return new Promise((resolve) => resolve({}));
|
||||
}
|
||||
const res: AxiosResponse = await graphql.query("getInstanceTopology").params({
|
||||
clientServiceId,
|
||||
@ -220,6 +223,9 @@ export const topologyStore = defineStore({
|
||||
return res.data;
|
||||
},
|
||||
async updateEndpointTopology(endpointIds: string[], depth: number) {
|
||||
if (!endpointIds.length) {
|
||||
return new Promise((resolve) => resolve({}));
|
||||
}
|
||||
const res = await this.getEndpointTopology(endpointIds);
|
||||
if (depth > 1) {
|
||||
const ids = res.nodes.map((item: Node) => item.id).filter((d: string) => !endpointIds.includes(d));
|
||||
@ -285,6 +291,9 @@ export const topologyStore = defineStore({
|
||||
}
|
||||
},
|
||||
async getEndpointTopology(endpointIds: string[]) {
|
||||
if (!endpointIds.length) {
|
||||
return new Promise((resolve) => resolve({}));
|
||||
}
|
||||
const duration = useAppStoreWithOut().durationTime;
|
||||
const variables = ["$duration: Duration!"];
|
||||
const fragment = endpointIds.map((id: string, index: number) => {
|
||||
|
@ -19,7 +19,8 @@ import type { Node, Call } from "@/types/topology";
|
||||
|
||||
export function layout(levels: Node[][], calls: Call[], radius: number) {
|
||||
// precompute level depth
|
||||
levels.forEach((l: Node[], i: number) => l.forEach((n: any) => (n.level = i)));
|
||||
console.log(levels);
|
||||
levels.forEach((l: Node[], i: number) => l.forEach((n: any) => n && (n.level = i)));
|
||||
|
||||
const nodes: Node[] = levels.reduce((a, x) => a.concat(x), []);
|
||||
// layout
|
||||
|
Loading…
Reference in New Issue
Block a user