show only active tools

This commit is contained in:
Peter Olu 2022-05-11 16:10:11 +01:00
parent 12c2e36516
commit 86b04a0368

View File

@ -26,6 +26,7 @@ limitations under the License. -->
type="success" type="success"
:class="[activeTerms.includes(item.name) ? 'active-toggle' : '']" :class="[activeTerms.includes(item.name) ? 'active-toggle' : '']"
class="toggle-btn mx-3" class="toggle-btn mx-3"
v-show="item.isVisible"
@click="setSearchTerm(item.name)" @click="setSearchTerm(item.name)"
> >
<Icon iconSize="sm" :iconName="item.iconName" /> <Icon iconSize="sm" :iconName="item.iconName" />
@ -34,9 +35,10 @@ limitations under the License. -->
</div> </div>
</div> </div>
<div class="flex-h items-center row"> <div class="flex-h items-center row">
<div class="flex-h items-center" v-if="currentSearchTerm === 'service'">
<div <div
class="mr-5 flex-h items-center" class="mr-5 flex-h items-center"
v-if="dashboardStore.entity === EntityType[1].value && currentSearchTerm === 'service' " v-if="dashboardStore.entity === EntityType[1].value"
> >
<span class="grey mr-5">{{ t("service") }}:</span> <span class="grey mr-5">{{ t("service") }}:</span>
<Selector <Selector
@ -47,9 +49,16 @@ limitations under the License. -->
@change="changeField('service', $event)" @change="changeField('service', $event)"
/> />
</div> </div>
<b v-else>{{ t("service") }} data not available</b>
</div>
<div class="flex-h items-center" v-if="currentSearchTerm === 'instance'">
<div <div
class="mr-5 flex-h" class="mr-5 flex-h"
v-if="dashboardStore.entity !== EntityType[3].value && currentSearchTerm === 'instance'" v-if="
dashboardStore.entity !== EntityType[3].value &&
currentSearchTerm === 'instance'
"
> >
<span class="grey mr-5"> <span class="grey mr-5">
{{ isBrowser ? t("version") : t("instance") }}: {{ isBrowser ? t("version") : t("instance") }}:
@ -62,9 +71,16 @@ limitations under the License. -->
@change="changeField('instance', $event)" @change="changeField('instance', $event)"
/> />
</div> </div>
<b v-else>{{ t("instance") }} data not available</b>
</div>
<div class="flex-h items-center" v-if="currentSearchTerm === 'endpoints'">
<div <div
class="mr-5 flex-h items-center" class="mr-5 flex-h items-center"
v-if="dashboardStore.entity !== EntityType[2].value && currentSearchTerm === 'endpoint'" v-if="
dashboardStore.entity !== EntityType[2].value &&
currentSearchTerm === 'endpoint'
"
> >
<span class="grey mr-5" <span class="grey mr-5"
>{{ isBrowser ? t("page") : t("endpoint") }}:</span >{{ isBrowser ? t("page") : t("endpoint") }}:</span
@ -79,6 +95,8 @@ limitations under the License. -->
@query="searchEndpoints" @query="searchEndpoints"
/> />
</div> </div>
<b v-else>{{ t("endpoint") }} data not available</b>
</div>
</div> </div>
<!-- <div class="row tips"> <!-- <div class="row tips">
<b>{{ t("conditionNotice") }}</b> <b>{{ t("conditionNotice") }}</b>
@ -216,42 +234,50 @@ interface filtersObject {
name: string; name: string;
iconName: string; iconName: string;
description: string; description: string;
isVisible?: boolean;
} }
const arrayOfFilters = ref<filtersObject[]>([ const arrayOfFilters = ref<filtersObject[]>([
{ {
name: "traceId", name: "traceId",
iconName: "timeline", iconName: "timeline",
description: "Trace ID", description: "Trace ID",
isVisible: true,
}, },
{ {
name: "tags", name: "tags",
iconName: "epic", iconName: "epic",
description: "Tags", description: "Tags",
isVisible: true,
}, },
{ {
name: "keywords", name: "keywords",
iconName: "library_books", iconName: "library_books",
description: "Keywords", description: "Keywords",
isVisible: logStore.supportQueryLogsByKeywords,
}, },
{ {
name: "exclude", name: "exclude",
iconName: "issue-child", iconName: "issue-child",
description: "Exclude keywords", description: "Exclude keywords",
isVisible: logStore.supportQueryLogsByKeywords,
}, },
{ {
name: "instance", name: "instance",
iconName: "epic", iconName: "epic",
description: "Instance", description: "Instance",
isVisible: dashboardStore.entity !== EntityType[3].value,
}, },
{ {
name: "service", name: "service",
iconName: "settings", iconName: "settings",
description: "Service", description: "Service",
isVisible: dashboardStore.entity === EntityType[1].value,
}, },
{ {
name: "endpoints", name: "endpoints",
iconName: "timeline", iconName: "timeline",
description: "Endpoints", description: "Endpoints",
isVisible: dashboardStore.entity !== EntityType[2].value,
}, },
]); ]);
init(); init();
@ -318,11 +344,13 @@ function addToActiveTerms(){
activeTerms.value.push(currentSearchTerm.value); activeTerms.value.push(currentSearchTerm.value);
} }
function removeFromActiveTerms() { function removeFromActiveTerms() {
activeTerms.value = activeTerms.value.filter(term => term !== currentSearchTerm.value ); activeTerms.value = activeTerms.value.filter(
(term) => term !== currentSearchTerm.value
);
} }
function searchLogs() { function searchLogs() {
addToActiveTerms() addToActiveTerms();
currentSearchTerm.value = "" currentSearchTerm.value = "";
let endpoint = "", let endpoint = "",
instance = ""; instance = "";
if (dashboardStore.entity === EntityType[2].value) { if (dashboardStore.entity === EntityType[2].value) {
@ -409,7 +437,7 @@ function setSearchTerm(term: string) {
currentSearchTerm.value = term; currentSearchTerm.value = term;
} }
function cancelSearchTerm() { function cancelSearchTerm() {
removeFromActiveTerms() removeFromActiveTerms();
currentSearchTerm.value = ""; currentSearchTerm.value = "";
} }
watch( watch(