aboutsummaryrefslogtreecommitdiff
path: root/viewer/src/views
diff options
context:
space:
mode:
authorpacien2020-05-03 23:07:51 +0200
committerpacien2020-05-03 23:15:55 +0200
commit665139f7d25a64f66e1149a6403fc26efcbabb2a (patch)
tree46dd9634423540c3ac6a1ea38dc0f1857b1e95e3 /viewer/src/views
parent09624c0089f0e29ffb1abc578525b6a07fd95e81 (diff)
downloadldgallery-665139f7d25a64f66e1149a6403fc26efcbabb2a.tar.gz
viewer/GalleryNavigation: better error messages
Introducing a generic error page with some icon and a different error for unknown resources GitHub: closes #190
Diffstat (limited to 'viewer/src/views')
-rw-r--r--viewer/src/views/GalleryNavigation.vue32
1 files changed, 24 insertions, 8 deletions
diff --git a/viewer/src/views/GalleryNavigation.vue b/viewer/src/views/GalleryNavigation.vue
index 7c6d11b..08c8218 100644
--- a/viewer/src/views/GalleryNavigation.vue
+++ b/viewer/src/views/GalleryNavigation.vue
@@ -18,18 +18,14 @@
18--> 18-->
19 19
20<template> 20<template>
21 <!-- TODO: eliminate intermediate div -->
21 <div> 22 <div>
22 <gallery-search v-if="query.length" :path="path" /> 23 <component :is="dispatch().component" v-bind="dispatch().properties" />
23 <gallery-directory v-else-if="checkType('directory')" :directory="$galleryStore.currentItem" />
24 <ld-picture v-else-if="checkType('picture')" :picture="$galleryStore.currentItem" />
25 <div v-else>{{$t("gallery.unknowntype")}}</div>
26 </div> 24 </div>
27</template> 25</template>
28 26
29<script lang="ts"> 27<script lang="ts">
30import { Component, Vue, Prop, Watch } from "vue-property-decorator"; 28import { Component, Vue, Prop, Watch } from "vue-property-decorator";
31import { Operation } from "@/@types/Operation";
32import Navigation from "@/services/navigation";
33import GalleryDirectory from "./GalleryDirectory.vue"; 29import GalleryDirectory from "./GalleryDirectory.vue";
34import GallerySearch from "@/views/GallerySearch.vue"; 30import GallerySearch from "@/views/GallerySearch.vue";
35 31
@@ -52,8 +48,28 @@ export default class GalleryNavigation extends Vue {
52 this.$galleryStore.setCurrentPath(this.path); 48 this.$galleryStore.setCurrentPath(this.path);
53 } 49 }
54 50
55 private checkType(type: Gallery.ItemType): boolean { 51 dispatch(): { component: string, properties: {} } {
56 return Navigation.checkType(this.$galleryStore.currentItem, type); 52 switch (this.$galleryStore.currentItem?.properties.type ?? null) {
53 case null:
54 return {
55 component: "ld-error",
56 properties: { icon: "folder-open", message: this.$t("gallery.unknown-resource") }
57 };
58
59 case "directory":
60 return this.query.length > 0
61 ? { component: "gallery-search", properties: { path: this.path } }
62 : { component: "gallery-directory", properties: { directory: this.$galleryStore.currentItem } };
63
64 case "picture":
65 return { component: "ld-picture", properties: { picture: this.$galleryStore.currentItem } };
66
67 default:
68 return {
69 component: "ld-error",
70 properties: { icon: "file", message: this.$t("gallery.unknown-type") }
71 };
72 }
57 } 73 }
58} 74}
59</script> 75</script>