From d53fe5ed73aaa0788722b9861a4aee9ac42a1759 Mon Sep 17 00:00:00 2001 From: Qiuxia Fan Date: Mon, 28 Mar 2022 17:32:18 +0800 Subject: [PATCH] search endpoints --- src/store/modules/log.ts | 4 ++-- src/store/modules/trace.ts | 4 ++-- src/views/dashboard/panel/Tool.vue | 10 +++++++--- src/views/dashboard/related/log/Header.vue | 8 ++++++++ src/views/dashboard/related/trace/Filter.vue | 12 ++++++++++-- 5 files changed, 29 insertions(+), 9 deletions(-) diff --git a/src/store/modules/log.ts b/src/store/modules/log.ts index a4d93ca3..b9934976 100644 --- a/src/store/modules/log.ts +++ b/src/store/modules/log.ts @@ -86,14 +86,14 @@ export const logStore = defineStore({ ] || [{ value: " 0", label: "All" }]; return res.data; }, - async getEndpoints(id: string) { + async getEndpoints(id: string, keyword?: string) { const serviceId = this.selectorStore.currentService ? this.selectorStore.currentService.id : id; const res: AxiosResponse = await graphql.query("queryEndpoints").params({ serviceId, duration: this.durationTime, - keyword: "", + keyword: keyword || "", }); if (res.data.errors) { return res.data; diff --git a/src/store/modules/trace.ts b/src/store/modules/trace.ts index 695865f7..a7178a0d 100644 --- a/src/store/modules/trace.ts +++ b/src/store/modules/trace.ts @@ -101,14 +101,14 @@ export const traceStore = defineStore({ ] || [{ value: " 0", label: "All" }]; return res.data; }, - async getEndpoints(id: string) { + async getEndpoints(id: string, keyword?: string) { const serviceId = this.selectorStore.currentService ? this.selectorStore.currentService.id : id; const res: AxiosResponse = await graphql.query("queryEndpoints").params({ serviceId, duration: this.durationTime, - keyword: "", + keyword: keyword || "", }); if (res.data.errors) { return res.data; diff --git a/src/views/dashboard/panel/Tool.vue b/src/views/dashboard/panel/Tool.vue index b0f00231..a060c1a0 100644 --- a/src/views/dashboard/panel/Tool.vue +++ b/src/views/dashboard/panel/Tool.vue @@ -42,7 +42,9 @@ limitations under the License. --> @change="changePods" @query="searchPods" class="selectorPod" - :isRemote="true" + :isRemote=" + ['EndpointRelation', 'Endpoint'].includes(dashboardStore.entity) + " />
@@ -62,8 +64,8 @@ limitations under the License. --> dashboardStore.entity === "EndpointRelation" ? "$DestinationEndpoint" : "$DestinationServiceInstance" - }} + }} + placeholder="Select a data" @change="changePods" class="selectorPod" + @query="searchPods" + :isRemote="dashboardStore.entity === 'EndpointRelation'" />
diff --git a/src/views/dashboard/related/log/Header.vue b/src/views/dashboard/related/log/Header.vue index be71bc07..9ba79875 100644 --- a/src/views/dashboard/related/log/Header.vue +++ b/src/views/dashboard/related/log/Header.vue @@ -46,6 +46,8 @@ limitations under the License. --> :options="logStore.endpoints" placeholder="Select a endpoint" @change="changeField('endpoint', $event)" + :isRemote="true" + @query="searchEndpoints" /> @@ -243,6 +245,12 @@ function changeField(type: string, opt: any) { getInstances(state.service.id); } } +async function searchEndpoints(keyword: string) { + const resp = await logStore.getEndpoints(state.service.id, keyword); + if (resp.errors) { + ElMessage.error(resp.errors); + } +} function updateTags(data: { tagsMap: Array