Skip to content

Commit

Permalink
Improve errors handling
Browse files Browse the repository at this point in the history
Signed-off-by: Louis Chemineau <louis@chmn.me>
  • Loading branch information
artonge committed Feb 15, 2024
1 parent 289c4b8 commit 57aea9b
Show file tree
Hide file tree
Showing 2 changed files with 10 additions and 3 deletions.
6 changes: 5 additions & 1 deletion src/components/FilesListViewer.vue
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@
-->
<template>
<div class="files-list-viewer">
<NcEmptyContent v-if="emptyMessage !== '' && itemsBySections.length === 1 && itemsBySections[0].items.length === 0 && !loading"
<NcEmptyContent v-if="emptyMessage !== '' && photosCount === 0 && !loading"
key="emptycontent"
:name="emptyMessage">
<PackageVariant slot="icon" />
Expand Down Expand Up @@ -215,6 +215,10 @@ export default {
return []
},
photosCount() {
return this.itemsBySections.map(({ items }) => items.length).reduce((total, length) => total + length, 0)
},
/** @return {boolean} The list of items to pass to TiledLayout. */
showLoader() {
return this.loading && (this.fileIds?.length !== 0 || this.sections?.length !== 0)
Expand Down
7 changes: 5 additions & 2 deletions src/views/Timeline.vue
Original file line number Diff line number Diff line change
Expand Up @@ -24,8 +24,9 @@

<template>
<!-- Errors handlers -->
<NcEmptyContent v-if="errorFetchingFiles">
{{ t('photos', 'An error occurred') }}
<NcEmptyContent v-if="errorFetchingFiles" :name="t('photos', 'An error occurred')">
<AlertCircle slot="icon" />
<span v-if="errorFetchingFiles === 404" slot="description">{{ t('photos', 'The source folder does not exists') }}</span>
</NcEmptyContent>

<div v-else class="timeline">
Expand Down Expand Up @@ -150,6 +151,7 @@ import Delete from 'vue-material-design-icons/Delete.vue'
import PlusBoxMultiple from 'vue-material-design-icons/PlusBoxMultiple.vue'
import Download from 'vue-material-design-icons/Download.vue'
import Close from 'vue-material-design-icons/Close.vue'
import AlertCircle from 'vue-material-design-icons/AlertCircle.vue'
import { NcModal, NcActions, NcActionButton, NcButton, NcEmptyContent, isMobile } from '@nextcloud/vue'
import moment from '@nextcloud/moment'
Expand Down Expand Up @@ -189,6 +191,7 @@ export default {
ActionFavorite,
ActionDownload,
HeaderNavigation,
AlertCircle,
},
filters: {
Expand Down

0 comments on commit 57aea9b

Please sign in to comment.