fix: delete duplicate calls for endpoint dependency (#544)
diff --git a/src/store/modules/profile/profile-store.ts b/src/store/modules/profile/profile-store.ts
index b62bf9b..da0813e 100644
--- a/src/store/modules/profile/profile-store.ts
+++ b/src/store/modules/profile/profile-store.ts
@@ -134,7 +134,7 @@
.query('queryServices')
.params(params)
.then((res: AxiosResponse) => {
- context.commit(types.SET_PROFILE_ERRORS, { msg: 'serviceErrors', desc: res.data.errors || '' });
+ context.commit(types.SET_PROFILE_ERRORS, { msg: 'serviceProfileErrors', desc: res.data.errors || '' });
if (res.data.errors) {
return context.commit(types.SET_SERVICES, []);
}
diff --git a/src/store/modules/topology/index.ts b/src/store/modules/topology/index.ts
index a5f6c65..271d454 100644
--- a/src/store/modules/topology/index.ts
+++ b/src/store/modules/topology/index.ts
@@ -580,7 +580,7 @@
.query('queryServices')
.params(params)
.then((res: AxiosResponse) => {
- context.commit(types.SET_TOPO_ERRORS, { msg: 'serviceErrors', desc: res.data.errors });
+ context.commit(types.SET_TOPO_ERRORS, { msg: 'serviceTopoErrors', desc: res.data.errors });
if (res.data.errors) {
return [];
}
@@ -773,7 +773,7 @@
return;
}
const topo = res.data.data;
- const calls = [] as any;
+ let calls = [] as any;
let nodes = [] as any;
for (const key of Object.keys(topo)) {
calls.push(...topo[key].calls);
@@ -792,6 +792,13 @@
}
return prev;
}, []);
+ calls = calls.reduce((prev: Call[], next: Call) => {
+ if (!obj[next.id]) {
+ obj[next.id] = true;
+ prev.push(next);
+ }
+ return prev;
+ }, []);
const queryVariables = ['$duration: Duration!'];
const fragments = calls
.map((call: Call & EndpointDependencyConidition, index: number) => {
diff --git a/src/store/modules/trace/index.ts b/src/store/modules/trace/index.ts
index fd430d4..9aa7755 100644
--- a/src/store/modules/trace/index.ts
+++ b/src/store/modules/trace/index.ts
@@ -145,7 +145,7 @@
.query('queryServices')
.params(params)
.then((res: AxiosResponse) => {
- context.commit(types.SET_TRACE_ERRORS, { msg: 'serviceError', desc: res.data.errors || '' });
+ context.commit(types.SET_TRACE_ERRORS, { msg: 'serviceTraceError', desc: res.data.errors || '' });
if (res.data.errors) {
context.commit(types.SET_SERVICES, []);
return;