made keywords selection dependent on a computed value from logstore

This commit is contained in:
Peter Olu 2022-05-12 13:26:36 +01:00
parent ce77ba655e
commit 8ab1ae3641
2 changed files with 14 additions and 7 deletions

View File

@ -47,7 +47,7 @@ export const logStore = defineStore({
queryDuration: useAppStoreWithOut().durationTime, queryDuration: useAppStoreWithOut().durationTime,
paging: { pageNum: 1, pageSize: 15, needTotal: true }, paging: { pageNum: 1, pageSize: 15, needTotal: true },
}, },
supportQueryLogsByKeywords: false, supportQueryLogsByKeywords: true,
durationTime: useAppStoreWithOut().durationTime, durationTime: useAppStoreWithOut().durationTime,
selectorStore: useSelectorStore(), selectorStore: useSelectorStore(),
logs: [], logs: [],

View File

@ -122,7 +122,7 @@ limitations under the License. -->
<div <div
class="mr-5 flex-h items-center" class="mr-5 flex-h items-center"
v-show=" v-show="
logStore.supportQueryLogsByKeywords && supportQueryLogsByKeywords &&
currentSearchTerm === 'keywords' currentSearchTerm === 'keywords'
" "
> >
@ -148,7 +148,7 @@ limitations under the License. -->
<div <div
class="mr-5 flex-h items-center" class="mr-5 flex-h items-center"
v-show=" v-show="
logStore.supportQueryLogsByKeywords && currentSearchTerm === 'exclude' supportExcludeQueryLogsByKeywords && currentSearchTerm === 'exclude'
" "
> >
<span class="grey mr-5"> {{ t("excludingKeywordsOfContent") }}: </span> <span class="grey mr-5"> {{ t("excludingKeywordsOfContent") }}: </span>
@ -201,7 +201,7 @@ limitations under the License. -->
</div> </div>
</template> </template>
<script lang="ts" setup> <script lang="ts" setup>
import { ref, reactive, watch } from "vue"; import { ref, reactive, watch, computed } from "vue";
import { useI18n } from "vue-i18n"; import { useI18n } from "vue-i18n";
import { Option } from "@/types/app"; import { Option } from "@/types/app";
import { useLogStore } from "@/store/modules/log"; import { useLogStore } from "@/store/modules/log";
@ -220,6 +220,13 @@ const logStore = useLogStore();
const traceId = ref<string>(""); const traceId = ref<string>("");
const keywordsOfContent = ref<string[]>([]); const keywordsOfContent = ref<string[]>([]);
const excludingKeywordsOfContent = ref<string[]>([]); const excludingKeywordsOfContent = ref<string[]>([]);
const supportQueryLogsByKeywords = computed<boolean>(() => {
return logStore.supportQueryLogsByKeywords
})
const supportExcludeQueryLogsByKeywords = computed<boolean>(() => {
return logStore.supportQueryLogsByKeywords
})
const currentSearchTerm = ref<string>(""); const currentSearchTerm = ref<string>("");
const activeTerms = ref<string[]>([]); const activeTerms = ref<string[]>([]);
const tagsList = ref<string[]>([]); const tagsList = ref<string[]>([]);
@ -237,7 +244,7 @@ interface filtersObject {
name: string; name: string;
iconName: string; iconName: string;
description: string; description: string;
isVisible?: boolean; isVisible?: boolean | unknown; // one of the situations is dependent on an api call
} }
const arrayOfFilters = ref<filtersObject[]>([ const arrayOfFilters = ref<filtersObject[]>([
{ {
@ -256,13 +263,13 @@ const arrayOfFilters = ref<filtersObject[]>([
name: "keywords", name: "keywords",
iconName: "library_books", iconName: "library_books",
description: "Keywords", description: "Keywords",
isVisible: logStore.supportQueryLogsByKeywords, isVisible: supportQueryLogsByKeywords,
}, },
{ {
name: "exclude", name: "exclude",
iconName: "issue-child", iconName: "issue-child",
description: "Exclude keywords", description: "Exclude keywords",
isVisible: logStore.supportQueryLogsByKeywords, isVisible: supportExcludeQueryLogsByKeywords,
}, },
{ {
name: "instance", name: "instance",