aboutsummaryrefslogtreecommitdiff
path: root/viewer/src/views/GallerySearch.vue
diff options
context:
space:
mode:
Diffstat (limited to 'viewer/src/views/GallerySearch.vue')
-rw-r--r--viewer/src/views/GallerySearch.vue36
1 files changed, 26 insertions, 10 deletions
diff --git a/viewer/src/views/GallerySearch.vue b/viewer/src/views/GallerySearch.vue
index 97c5c66..eacbcdd 100644
--- a/viewer/src/views/GallerySearch.vue
+++ b/viewer/src/views/GallerySearch.vue
@@ -18,25 +18,41 @@
18--> 18-->
19 19
20<template> 20<template>
21 <div class="thumbnail-tiles"> 21 <ld-gallery :items="items()" :noresult="$t('search.no-results')" />
22 <div v-for="(item) in items" :key="item.path">
23 <router-link :to="item.path" @click.native="$uiStore.setModeNavigation()">
24 <ld-thumbnail :item="item" />
25 </router-link>
26 </div>
27 <div v-if="items.length===0">{{$t('search.no-results')}}</div>
28 </div>
29</template> 22</template>
30 23
31<script lang="ts"> 24<script lang="ts">
32import { Component, Vue, Prop } from "vue-property-decorator"; 25import { Component, Vue, Prop, Watch } from "vue-property-decorator";
26import { Operation } from "@/@types/Operation";
27import IndexSearch from "@/services/indexsearch";
28import IndexFactory from "../services/indexfactory";
33 29
34@Component 30@Component
35export default class GalleryPicture extends Vue { 31export default class GalleryPicture extends Vue {
36 @Prop({ required: true }) readonly items!: Gallery.Item[]; 32 @Prop(String) readonly path!: string;
33 @Prop(Array) readonly query!: string[];
34
35 currentSearch: Tag.Search[] = [];
37 36
38 mounted() { 37 mounted() {
39 this.$uiStore.fullscreen = false; 38 this.$uiStore.fullscreen = false;
39 this.$uiStore.searchMode = true;
40 this.restoreSearchFilters();
41 }
42
43 destroyed() {
44 this.$uiStore.searchMode = false;
45 }
46
47 items() {
48 return IndexSearch.search(this.currentSearch, this.path);
49 }
50
51 @Watch("query")
52 restoreSearchFilters() {
53 const tagsIndex = this.$galleryStore.tagsIndex;
54 this.currentSearch = this.query.flatMap(filter => IndexFactory.searchTags(tagsIndex, filter));
55 this.$uiStore.searchFilters = [...this.currentSearch];
40 } 56 }
41} 57}
42</script> 58</script>