in src/store/modules/topology.ts [408:449]
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) => {
return `endpointTopology${index}: getEndpointDependencies(endpointId: "${id}", duration: $duration) {
nodes {
id
name
serviceId
serviceName
type
isReal
}
calls {
id
source
target
detectPoints
}
}`;
});
const queryStr = `query queryData(${variables}) {${fragment}}`;
const conditions = { duration };
const res = await fetchQuery({ queryStr, conditions });
if (res.errors) {
return res;
}
const topo = res.data;
const calls = [] as Call[];
const nodes = [] as Node[];
for (const key of Object.keys(topo)) {
calls.push(...topo[key].calls);
nodes.push(...topo[key].nodes);
}
// this.setTopology({ calls, nodes });
return { calls, nodes };
},