refactored logs header search terms logic and the handling of active buttons

This commit is contained in:
Peter Olu 2022-05-12 07:56:57 +01:00
parent aa7485391b
commit 59a9bc15ea
2 changed files with 41 additions and 13 deletions

View File

@ -108,12 +108,13 @@ limitations under the License. -->
<el-input v-model="traceId" class="inputs-max" size="small" />
</div>
</div>
<ConditionTags
v-if="currentSearchTerm === 'tags'"
:type="'LOG'"
@update="updateTags"
/>
<keep-alive>
<ConditionTags
v-if="currentSearchTerm === 'tags'"
:type="'LOG'"
@update="updateTags"
/>
</keep-alive>
</div>
<div class="flex-h items-center" v-show="!isBrowser">
@ -348,8 +349,37 @@ function removeFromActiveTerms() {
(term) => term !== currentSearchTerm.value
);
}
function handleActiveSearchTerms() {
switch (currentSearchTerm.value) {
case "traceId":
if (!traceId.value.length) return;
addToActiveTerms();
break;
case "tags":
if (!tagsList.value.length) return;
addToActiveTerms();
break;
case "keywords":
if (!keywordsOfContent.value.length) return;
addToActiveTerms();
break;
case "exclude":
if (!excludingKeywordsOfContent.value.length) return;
addToActiveTerms();
break;
case "instance":
addToActiveTerms();
break;
case "service":
addToActiveTerms();
break;
case "endpoint":
addToActiveTerms();
break;
}
}
function searchLogs() {
addToActiveTerms();
handleActiveSearchTerms();
currentSearchTerm.value = "";
let endpoint = "",
instance = "";
@ -434,9 +464,7 @@ function removeExcludeContent(index: number) {
excludingContentStr.value = "";
}
function setSearchTerm(term: string) {
// if (!term) return;
currentSearchTerm.value = term;
console.log(currentSearchTerm.value);
}
function cancelSearchTerm() {
switch (currentSearchTerm.value) {
@ -465,7 +493,7 @@ function cancelSearchTerm() {
}
removeFromActiveTerms();
currentSearchTerm.value = "";
init()
init();
}
watch(
() => selectorStore.currentService,

View File

@ -292,13 +292,13 @@ function handleActiveFilterState() {
traceStore.setActiveFilter(activeFilter.value);
break;
case "service":
traceStore.setActiveFilter(activeFilter.value);
traceStore.setActiveFilter(activeFilter.value);
break;
case "instance":
traceStore.setActiveFilter(activeFilter.value);
traceStore.setActiveFilter(activeFilter.value);
break;
case "status":
traceStore.setActiveFilter(activeFilter.value);
traceStore.setActiveFilter(activeFilter.value);
break;
}
}