feat: Support searching endpoints with keyword (#43)

This commit is contained in:
Fine0830
2022-03-28 18:07:09 +08:00
committed by GitHub
parent d78ca0cd4b
commit 0a29a86c34
13 changed files with 200 additions and 151 deletions

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],
() => {