mirror of
https://github.com/apache/skywalking-booster-ui.git
synced 2025-05-13 08:17:33 +00:00
fix: Avoid querying data with empty parameters
This commit is contained in:
parent
6fb4f074c1
commit
66cfbd2700
@ -191,6 +191,9 @@ export const topologyStore = defineStore({
|
|||||||
}
|
}
|
||||||
},
|
},
|
||||||
async getServicesTopology(serviceIds: string[]) {
|
async getServicesTopology(serviceIds: string[]) {
|
||||||
|
if (!serviceIds.length) {
|
||||||
|
return new Promise((resolve) => resolve({}));
|
||||||
|
}
|
||||||
const duration = useAppStoreWithOut().durationTime;
|
const duration = useAppStoreWithOut().durationTime;
|
||||||
const res: AxiosResponse = await graphql.query("getServicesTopology").params({
|
const res: AxiosResponse = await graphql.query("getServicesTopology").params({
|
||||||
serviceIds,
|
serviceIds,
|
||||||
@ -207,7 +210,7 @@ export const topologyStore = defineStore({
|
|||||||
const clientServiceId = (currentDestService && currentDestService.id) || "";
|
const clientServiceId = (currentDestService && currentDestService.id) || "";
|
||||||
const duration = useAppStoreWithOut().durationTime;
|
const duration = useAppStoreWithOut().durationTime;
|
||||||
if (!(serverServiceId && clientServiceId)) {
|
if (!(serverServiceId && clientServiceId)) {
|
||||||
return;
|
return new Promise((resolve) => resolve({}));
|
||||||
}
|
}
|
||||||
const res: AxiosResponse = await graphql.query("getInstanceTopology").params({
|
const res: AxiosResponse = await graphql.query("getInstanceTopology").params({
|
||||||
clientServiceId,
|
clientServiceId,
|
||||||
@ -220,6 +223,9 @@ export const topologyStore = defineStore({
|
|||||||
return res.data;
|
return res.data;
|
||||||
},
|
},
|
||||||
async updateEndpointTopology(endpointIds: string[], depth: number) {
|
async updateEndpointTopology(endpointIds: string[], depth: number) {
|
||||||
|
if (!endpointIds.length) {
|
||||||
|
return new Promise((resolve) => resolve({}));
|
||||||
|
}
|
||||||
const res = await this.getEndpointTopology(endpointIds);
|
const res = await this.getEndpointTopology(endpointIds);
|
||||||
if (depth > 1) {
|
if (depth > 1) {
|
||||||
const ids = res.nodes.map((item: Node) => item.id).filter((d: string) => !endpointIds.includes(d));
|
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[]) {
|
async getEndpointTopology(endpointIds: string[]) {
|
||||||
|
if (!endpointIds.length) {
|
||||||
|
return new Promise((resolve) => resolve({}));
|
||||||
|
}
|
||||||
const duration = useAppStoreWithOut().durationTime;
|
const duration = useAppStoreWithOut().durationTime;
|
||||||
const variables = ["$duration: Duration!"];
|
const variables = ["$duration: Duration!"];
|
||||||
const fragment = endpointIds.map((id: string, index: number) => {
|
const fragment = endpointIds.map((id: string, index: number) => {
|
||||||
|
Loading…
Reference in New Issue
Block a user