diff options
Diffstat (limited to 'viewer/src')
-rw-r--r-- | viewer/src/components/LdGallery.vue | 5 | ||||
-rw-r--r-- | viewer/src/locales/en.json | 5 | ||||
-rw-r--r-- | viewer/src/services/indexsearch.ts | 5 | ||||
-rw-r--r-- | viewer/src/views/GallerySearch.vue | 13 |
4 files changed, 20 insertions, 8 deletions
diff --git a/viewer/src/components/LdGallery.vue b/viewer/src/components/LdGallery.vue index 169bc54..16e9f7c 100644 --- a/viewer/src/components/LdGallery.vue +++ b/viewer/src/components/LdGallery.vue | |||
@@ -24,7 +24,7 @@ | |||
24 | <ld-thumbnail :item="item" /> | 24 | <ld-thumbnail :item="item" /> |
25 | </router-link> | 25 | </router-link> |
26 | </div> | 26 | </div> |
27 | <div v-if="hasNoResults()">{{noresult}}</div> | 27 | <div v-if="hasNoResults()" class="noresult">{{noresult}}</div> |
28 | </div> | 28 | </div> |
29 | </template> | 29 | </template> |
30 | 30 | ||
@@ -44,4 +44,7 @@ export default class LdPicture extends Vue { | |||
44 | </script> | 44 | </script> |
45 | 45 | ||
46 | <style lang="scss"> | 46 | <style lang="scss"> |
47 | .thumbnail-tiles .noresult { | ||
48 | margin-top: 40px; | ||
49 | } | ||
47 | </style> | 50 | </style> |
diff --git a/viewer/src/locales/en.json b/viewer/src/locales/en.json index 878204e..81ddd1e 100644 --- a/viewer/src/locales/en.json +++ b/viewer/src/locales/en.json | |||
@@ -13,5 +13,6 @@ | |||
13 | "command.search.search": "Search", | 13 | "command.search.search": "Search", |
14 | "command.back": "Go back", | 14 | "command.back": "Go back", |
15 | "command.parent": "Go to parent directory", | 15 | "command.parent": "Go to parent directory", |
16 | "directory.no-results": "Empty directory" | 16 | "directory.no-results": "Empty directory", |
17 | } | 17 | "search.no-results.otherfolders": "result(s) in other folders" |
18 | } \ No newline at end of file | ||
diff --git a/viewer/src/services/indexsearch.ts b/viewer/src/services/indexsearch.ts index 3e73fb1..cd3383a 100644 --- a/viewer/src/services/indexsearch.ts +++ b/viewer/src/services/indexsearch.ts | |||
@@ -22,12 +22,11 @@ import { Operation } from '@/@types/Operation'; | |||
22 | export default class IndexSearch { | 22 | export default class IndexSearch { |
23 | 23 | ||
24 | // Results of the search (by tags) | 24 | // Results of the search (by tags) |
25 | public static search(searchTags: Tag.Search[], rootPath: string): Gallery.Item[] { | 25 | public static search(searchTags: Tag.Search[]): Gallery.Item[] { |
26 | const byOperation = this.extractTagsByOperation(searchTags); | 26 | const byOperation = this.extractTagsByOperation(searchTags); |
27 | const intersection = this.extractIntersection(byOperation); | 27 | const intersection = this.extractIntersection(byOperation); |
28 | const substraction = this.extractSubstraction(byOperation); | 28 | const substraction = this.extractSubstraction(byOperation); |
29 | return this.aggregateAll(byOperation, intersection, substraction) | 29 | return this.aggregateAll(byOperation, intersection, substraction); |
30 | .filter(item => item.path.startsWith(rootPath)); | ||
31 | } | 30 | } |
32 | 31 | ||
33 | private static extractTagsByOperation(searchTags: Tag.Search[]): Tag.SearchByOperation { | 32 | private static extractTagsByOperation(searchTags: Tag.Search[]): Tag.SearchByOperation { |
diff --git a/viewer/src/views/GallerySearch.vue b/viewer/src/views/GallerySearch.vue index 4b6dd7f..9f2ac17 100644 --- a/viewer/src/views/GallerySearch.vue +++ b/viewer/src/views/GallerySearch.vue | |||
@@ -18,7 +18,7 @@ | |||
18 | --> | 18 | --> |
19 | 19 | ||
20 | <template> | 20 | <template> |
21 | <ld-gallery :items="items()" :noresult="$t('search.no-results')" /> | 21 | <ld-gallery :items="items()" :noresult="noResult()" /> |
22 | </template> | 22 | </template> |
23 | 23 | ||
24 | <script lang="ts"> | 24 | <script lang="ts"> |
@@ -30,6 +30,8 @@ import IndexSearch from "@/services/indexsearch"; | |||
30 | export default class GalleryPicture extends Vue { | 30 | export default class GalleryPicture extends Vue { |
31 | @Prop(String) readonly path!: string; | 31 | @Prop(String) readonly path!: string; |
32 | 32 | ||
33 | otherCount: Number = 0; | ||
34 | |||
33 | mounted() { | 35 | mounted() { |
34 | this.$uiStore.fullscreen = false; | 36 | this.$uiStore.fullscreen = false; |
35 | this.$uiStore.searchMode = true; | 37 | this.$uiStore.searchMode = true; |
@@ -40,7 +42,14 @@ export default class GalleryPicture extends Vue { | |||
40 | } | 42 | } |
41 | 43 | ||
42 | items() { | 44 | items() { |
43 | return IndexSearch.search(this.$galleryStore.currentSearch, this.path); | 45 | const searchResult = IndexSearch.search(this.$galleryStore.currentSearch); |
46 | const filteredByPath = searchResult.filter(item => item.path.startsWith(this.path)); | ||
47 | this.otherCount = searchResult.length - filteredByPath.length; | ||
48 | return filteredByPath; | ||
49 | } | ||
50 | |||
51 | noResult() { | ||
52 | return `${this.$t("search.no-results")} • ${this.otherCount} ${this.$t("search.no-results.otherfolders")}`; | ||
44 | } | 53 | } |
45 | } | 54 | } |
46 | </script> | 55 | </script> |