search endpoints

This commit is contained in:
Qiuxia Fan 2022-03-28 17:32:18 +08:00
parent 10fbf33d5d
commit d53fe5ed73
5 changed files with 29 additions and 9 deletions

View File

@ -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;

View File

@ -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;

View File

@ -42,7 +42,9 @@ limitations under the License. -->
@change="changePods"
@query="searchPods"
class="selectorPod"
:isRemote="true"
:isRemote="
['EndpointRelation', 'Endpoint'].includes(dashboardStore.entity)
"
/>
</div>
<div class="selectors-item" v-if="states.key === 2 || states.key === 4">
@ -62,8 +64,8 @@ limitations under the License. -->
dashboardStore.entity === "EndpointRelation"
? "$DestinationEndpoint"
: "$DestinationServiceInstance"
}}</span
>
}}
</span>
<Selector
v-model="states.currentDestPod"
:options="selectorStore.destPods"
@ -71,6 +73,8 @@ limitations under the License. -->
placeholder="Select a data"
@change="changePods"
class="selectorPod"
@query="searchPods"
:isRemote="dashboardStore.entity === 'EndpointRelation'"
/>
</div>
</div>

View File

@ -46,6 +46,8 @@ limitations under the License. -->
:options="logStore.endpoints"
placeholder="Select a endpoint"
@change="changeField('endpoint', $event)"
:isRemote="true"
@query="searchEndpoints"
/>
</div>
</div>
@ -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<Option>; tagsList: string[] }) {
tagsList.value = data.tagsList;
tagsMap.value = data.tagsMap;

View File

@ -41,7 +41,9 @@ limitations under the License. -->
:value="state.endpoint.value"
:options="traceStore.endpoints"
placeholder="Select a endpoint"
:isRemote="true"
@change="changeField('endpoint', $event)"
@query="searchEndpoints"
/>
</div>
<div class="mr-5">
@ -149,8 +151,8 @@ async function getServices() {
getInstances(state.service.id);
}
async function getEndpoints(id?: string) {
const resp = await traceStore.getEndpoints(id);
async function getEndpoints(id?: string, keyword?: string) {
const resp = await traceStore.getEndpoints(id, keyword);
if (resp.errors) {
ElMessage.error(resp.errors);
return;
@ -208,6 +210,12 @@ function updateTags(data: { tagsMap: Array<Option>; tagsList: string[] }) {
tagsList.value = data.tagsList;
tagsMap.value = data.tagsMap;
}
async function searchEndpoints(keyword: string) {
const resp = await traceStore.getEndpoints(state.service.id, keyword);
if (resp.errors) {
ElMessage.error(resp.errors);
}
}
watch(
() => [selectorStore.currentPod],
() => {