Show error in folder view
parent
1709649dc6
commit
eb60b9fb91
|
@ -2,6 +2,7 @@
|
||||||
<div class="folder" v-bind:class="{
|
<div class="folder" v-bind:class="{
|
||||||
hasPreview: previewFileInfos.length > 0,
|
hasPreview: previewFileInfos.length > 0,
|
||||||
onePreview: previewFileInfos.length === 1,
|
onePreview: previewFileInfos.length === 1,
|
||||||
|
hasError: error,
|
||||||
}"
|
}"
|
||||||
@click="openFolder(data)"
|
@click="openFolder(data)"
|
||||||
v-bind:style="{
|
v-bind:style="{
|
||||||
|
@ -9,10 +10,7 @@
|
||||||
height: rowHeight + 'px',
|
height: rowHeight + 'px',
|
||||||
}">
|
}">
|
||||||
<div class="big-icon">
|
<div class="big-icon">
|
||||||
<FolderIcon class="memories__big-folder-icon" v-bind:class="{
|
<FolderIcon class="memories__big-folder-icon" />
|
||||||
'icon-dark': previewFileInfos.length === 0,
|
|
||||||
'icon-white': previewFileInfos.length > 0,
|
|
||||||
}" />
|
|
||||||
<div class="name">{{ data.name }}</div>
|
<div class="name">{{ data.name }}</div>
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
|
@ -54,6 +52,9 @@ export default class Folder extends Mixins(GlobalMixin) {
|
||||||
// Separate property because the one on data isn't reactive
|
// Separate property because the one on data isn't reactive
|
||||||
private previewFileInfos: IFileInfo[] = [];
|
private previewFileInfos: IFileInfo[] = [];
|
||||||
|
|
||||||
|
// Error occured fetching thumbs
|
||||||
|
private error = false;
|
||||||
|
|
||||||
/** Passthrough */
|
/** Passthrough */
|
||||||
private getPreviewUrl = getPreviewUrl;
|
private getPreviewUrl = getPreviewUrl;
|
||||||
|
|
||||||
|
@ -68,6 +69,10 @@ export default class Folder extends Mixins(GlobalMixin) {
|
||||||
|
|
||||||
/** Refresh previews */
|
/** Refresh previews */
|
||||||
refreshPreviews() {
|
refreshPreviews() {
|
||||||
|
// Reset state
|
||||||
|
this.error = false;
|
||||||
|
|
||||||
|
// Get preview infos
|
||||||
if (!this.data.previewFileInfos) {
|
if (!this.data.previewFileInfos) {
|
||||||
const folderPath = this.data.path.split('/').slice(3).join('/');
|
const folderPath = this.data.path.split('/').slice(3).join('/');
|
||||||
dav.getFolderPreviewFileIds(folderPath, 4).then(fileInfos => {
|
dav.getFolderPreviewFileIds(folderPath, 4).then(fileInfos => {
|
||||||
|
@ -81,6 +86,10 @@ export default class Folder extends Mixins(GlobalMixin) {
|
||||||
}).catch(() => {
|
}).catch(() => {
|
||||||
this.data.previewFileInfos = [];
|
this.data.previewFileInfos = [];
|
||||||
this.previewFileInfos = [];
|
this.previewFileInfos = [];
|
||||||
|
|
||||||
|
// Something is wrong with the folder
|
||||||
|
// e.g. external storage not available
|
||||||
|
this.error = true;
|
||||||
});
|
});
|
||||||
} else {
|
} else {
|
||||||
this.previewFileInfos = this.data.previewFileInfos;
|
this.previewFileInfos = this.data.previewFileInfos;
|
||||||
|
@ -129,6 +138,7 @@ export default class Folder extends Mixins(GlobalMixin) {
|
||||||
top: 65%;
|
top: 65%;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// Make it white if there is a preview
|
||||||
.folder.hasPreview > & {
|
.folder.hasPreview > & {
|
||||||
.folder-icon {
|
.folder-icon {
|
||||||
opacity: 1;
|
opacity: 1;
|
||||||
|
@ -136,9 +146,19 @@ export default class Folder extends Mixins(GlobalMixin) {
|
||||||
}
|
}
|
||||||
.name { color: white; }
|
.name { color: white; }
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// Show it on hover if not a preview
|
||||||
.folder:hover > & > .folder-icon { opacity: 0.8; }
|
.folder:hover > & > .folder-icon { opacity: 0.8; }
|
||||||
.folder.hasPreview:hover > & { opacity: 0; }
|
.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 {
|
> .folder-icon {
|
||||||
cursor: pointer;
|
cursor: pointer;
|
||||||
height: 90%; width: 100%;
|
height: 90%; width: 100%;
|
||||||
|
|
Loading…
Reference in New Issue