aboutsummaryrefslogtreecommitdiff
path: root/viewer/src/views/PanelLeft.vue
diff options
context:
space:
mode:
authorOzoneGrif2020-02-27 18:18:37 +0100
committerGitHub2020-02-27 18:18:37 +0100
commit3e27a3cfa35359f6ffa83843aa2f2ad53f42f1d4 (patch)
tree9b4c12bd263013687f8cec3f0002122bd458aa49 /viewer/src/views/PanelLeft.vue
parentd862c99d6ee74f25261c00fcfee3a6e551501f16 (diff)
parent7c2a2ff46469d5e8f44fb3ec7feae5f798e0baf8 (diff)
downloadldgallery-3e27a3cfa35359f6ffa83843aa2f2ad53f42f1d4.tar.gz
Merge pull request #162 from pacien/oz-architecture-fix
viewer: architectural fixes and improvements
Diffstat (limited to 'viewer/src/views/PanelLeft.vue')
-rw-r--r--viewer/src/views/PanelLeft.vue29
1 files changed, 23 insertions, 6 deletions
diff --git a/viewer/src/views/PanelLeft.vue b/viewer/src/views/PanelLeft.vue
index 6292e78..54b9c63 100644
--- a/viewer/src/views/PanelLeft.vue
+++ b/viewer/src/views/PanelLeft.vue
@@ -19,11 +19,11 @@
19 19
20<template> 20<template>
21 <div class="flex-column sidebar"> 21 <div class="flex-column sidebar">
22 <ld-tag-input v-model="$uiStore.searchFilters" :tags-index="$galleryStore.tagsIndex" /> 22 <ld-tag-input :search-filters.sync="searchFilters" :tags-index="$galleryStore.tagsIndex" />
23 <ld-command-search @clear="clear" @search="search" /> 23 <ld-command-search @clear="clear" @search="search" />
24 <h1 class="title">{{$t('panelLeft.propositions')}}</h1> 24 <h1 class="title">{{$t('panelLeft.propositions')}}</h1>
25 <ld-proposition 25 <ld-proposition
26 v-model="$uiStore.searchFilters" 26 :search-filters.sync="searchFilters"
27 :tags-index="$galleryStore.tagsIndex" 27 :tags-index="$galleryStore.tagsIndex"
28 :current-tags="currentTags()" 28 :current-tags="currentTags()"
29 class="scrollbar no-scroll-x" 29 class="scrollbar no-scroll-x"
@@ -32,14 +32,21 @@
32</template> 32</template>
33 33
34<script lang="ts"> 34<script lang="ts">
35import { Component, Vue, Prop } from "vue-property-decorator"; 35import { Component, Vue, Prop, Watch } from "vue-property-decorator";
36import { Dictionary } from "vue-router/types/router"; 36import { Dictionary, Route } from "vue-router/types/router";
37import Navigation from "@/services/navigation"; 37import Navigation from "@/services/navigation";
38import IndexFactory from "@/services/indexfactory";
38 39
39@Component 40@Component
40export default class PanelLeft extends Vue { 41export default class PanelLeft extends Vue {
42 searchFilters: Tag.Search[] = [];
43
44 mounted() {
45 this.restoreSearchFilters(this.$route);
46 }
47
41 clear() { 48 clear() {
42 this.$uiStore.searchFilters = []; 49 this.searchFilters = [];
43 this.search(); 50 this.search();
44 } 51 }
45 52
@@ -52,13 +59,23 @@ export default class PanelLeft extends Vue {
52 59
53 serializeSearch() { 60 serializeSearch() {
54 let query: Dictionary<null> = {}; 61 let query: Dictionary<null> = {};
55 this.$uiStore.searchFilters.forEach(filter => (query[filter.display] = null)); 62 this.searchFilters.forEach(filter => (query[filter.display] = null));
56 return query; 63 return query;
57 } 64 }
58 65
59 currentTags() { 66 currentTags() {
60 return this.$galleryStore.currentItem?.tags ?? []; 67 return this.$galleryStore.currentItem?.tags ?? [];
61 } 68 }
69
70 @Watch("$route")
71 restoreSearchFilters(route: Route) {
72 const query = Object.keys(route.query);
73 if (query.length > 0) {
74 const tagsIndex = this.$galleryStore.tagsIndex;
75 this.searchFilters = Object.keys(route.query).flatMap(filter => IndexFactory.searchTags(tagsIndex, filter));
76 this.$galleryStore.setCurrentSearch([...this.searchFilters]);
77 }
78 }
62} 79}
63</script> 80</script>
64 81