aboutsummaryrefslogtreecommitdiff
path: root/viewer/src/views/GallerySearch.vue
diff options
context:
space:
mode:
authorZero~Informatique2020-02-27 17:23:32 +0100
committerZero~Informatique2020-02-27 17:53:41 +0100
commit7c2a2ff46469d5e8f44fb3ec7feae5f798e0baf8 (patch)
tree9b4c12bd263013687f8cec3f0002122bd458aa49 /viewer/src/views/GallerySearch.vue
parentd862c99d6ee74f25261c00fcfee3a6e551501f16 (diff)
downloadldgallery-7c2a2ff46469d5e8f44fb3ec7feae5f798e0baf8.tar.gz
viewer: architectural fixes and improvements
Make use of VueX's strict mode (which is different from vuex-class-component strict mode) Fixed issues and bad-practices with search filter tags mutations Correctly implement the new index.json format
Diffstat (limited to 'viewer/src/views/GallerySearch.vue')
-rw-r--r--viewer/src/views/GallerySearch.vue16
1 files changed, 2 insertions, 14 deletions
diff --git a/viewer/src/views/GallerySearch.vue b/viewer/src/views/GallerySearch.vue
index f4c28b0..4b6dd7f 100644
--- a/viewer/src/views/GallerySearch.vue
+++ b/viewer/src/views/GallerySearch.vue
@@ -22,22 +22,17 @@
22</template> 22</template>
23 23
24<script lang="ts"> 24<script lang="ts">
25import { Component, Vue, Prop, Watch } from "vue-property-decorator"; 25import { Component, Vue, Prop } from "vue-property-decorator";
26import { Operation } from "@/@types/Operation"; 26import { Operation } from "@/@types/Operation";
27import IndexSearch from "@/services/indexsearch"; 27import IndexSearch from "@/services/indexsearch";
28import IndexFactory from "@/services/indexfactory";
29 28
30@Component 29@Component
31export default class GalleryPicture extends Vue { 30export default class GalleryPicture extends Vue {
32 @Prop(String) readonly path!: string; 31 @Prop(String) readonly path!: string;
33 @Prop(Array) readonly query!: string[];
34
35 currentSearch: Tag.Search[] = [];
36 32
37 mounted() { 33 mounted() {
38 this.$uiStore.fullscreen = false; 34 this.$uiStore.fullscreen = false;
39 this.$uiStore.searchMode = true; 35 this.$uiStore.searchMode = true;
40 this.restoreSearchFilters();
41 } 36 }
42 37
43 destroyed() { 38 destroyed() {
@@ -45,14 +40,7 @@ export default class GalleryPicture extends Vue {
45 } 40 }
46 41
47 items() { 42 items() {
48 return IndexSearch.search(this.currentSearch, this.path); 43 return IndexSearch.search(this.$galleryStore.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];
56 } 44 }
57} 45}
58</script> 46</script>