From eb60b9fb9160218b053749af3c3a4ebdb6aaf1c1 Mon Sep 17 00:00:00 2001 From: Varun Patil Date: Sun, 25 Sep 2022 14:08:11 -0700 Subject: [PATCH] Show error in folder view --- src/components/Folder.vue | 28 ++++++++++++++++++++++++---- 1 file changed, 24 insertions(+), 4 deletions(-) diff --git a/src/components/Folder.vue b/src/components/Folder.vue index b529678c..0403bb0f 100644 --- a/src/components/Folder.vue +++ b/src/components/Folder.vue @@ -2,6 +2,7 @@
- +
{{ data.name }}
@@ -54,6 +52,9 @@ export default class Folder extends Mixins(GlobalMixin) { // Separate property because the one on data isn't reactive private previewFileInfos: IFileInfo[] = []; + // Error occured fetching thumbs + private error = false; + /** Passthrough */ private getPreviewUrl = getPreviewUrl; @@ -68,6 +69,10 @@ export default class Folder extends Mixins(GlobalMixin) { /** Refresh previews */ refreshPreviews() { + // Reset state + this.error = false; + + // Get preview infos if (!this.data.previewFileInfos) { const folderPath = this.data.path.split('/').slice(3).join('/'); dav.getFolderPreviewFileIds(folderPath, 4).then(fileInfos => { @@ -81,6 +86,10 @@ export default class Folder extends Mixins(GlobalMixin) { }).catch(() => { this.data.previewFileInfos = []; this.previewFileInfos = []; + + // Something is wrong with the folder + // e.g. external storage not available + this.error = true; }); } else { this.previewFileInfos = this.data.previewFileInfos; @@ -129,6 +138,7 @@ export default class Folder extends Mixins(GlobalMixin) { top: 65%; } + // Make it white if there is a preview .folder.hasPreview > & { .folder-icon { opacity: 1; @@ -136,9 +146,19 @@ export default class Folder extends Mixins(GlobalMixin) { } .name { color: white; } } + + // Show it on hover if not a preview .folder:hover > & > .folder-icon { opacity: 0.8; } .folder.hasPreview:hover > & { opacity: 0; } + // Make it red if has an error + .folder.hasError > & { + .folder-icon { + filter: invert(12%) sepia(62%) saturate(5862%) hue-rotate(8deg) brightness(103%) contrast(128%); + } + .name { color: #bb0000; } + } + > .folder-icon { cursor: pointer; height: 90%; width: 100%;