Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Files lists loading state #4099

Merged
merged 5 commits into from
Sep 24, 2020
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
8 changes: 8 additions & 0 deletions apps/files/src/components/AllFilesList.vue
Original file line number Diff line number Diff line change
Expand Up @@ -88,6 +88,14 @@
<template #rowActions="{ item: rowItem }">
<quick-actions :actions="app.quickActions" :item="rowItem" />
</template>
<template #loadingMessage>
<template v-if="!$_isFavoritesList">
<translate key="all-files-loading-folder">Loading folder</translate>
</template>
<template v-else>
<translate key="all-files-loading-favorites">Loading favorites</translate>
</template>
</template>
<template #noContentMessage>
<no-content-message v-if="!$_isFavoritesList" icon="folder">
<template #message
Expand Down
4 changes: 2 additions & 2 deletions apps/files/src/components/Collaborators/NewCollaborator.vue
Original file line number Diff line number Diff line change
Expand Up @@ -87,7 +87,7 @@
</template>

<script>
import _ from 'lodash'
import debounce from 'lodash/debounce'
import { mapActions, mapGetters } from 'vuex'
import Mixins from '../../mixins/collaborators'
import { roleToBitmask } from '../../helpers/collaborators'
Expand Down Expand Up @@ -139,7 +139,7 @@ export default {
this.$refs.ocSharingAutocomplete.focus()
})

this.$_onAutocompleteInput = _.debounce(this.$_onAutocompleteInput, 1000)
this.$_onAutocompleteInput = debounce(this.$_onAutocompleteInput, 1000)
},

methods: {
Expand Down
3 changes: 3 additions & 0 deletions apps/files/src/components/Collaborators/SharedFilesList.vue
Original file line number Diff line number Diff line change
Expand Up @@ -154,6 +154,9 @@
v-text="formDateFromNow(item.shareTime)"
/>
</template>
<template #loadingMessage>
<translate>Loading shared resources</translate>
</template>
<template #noContentMessage>
<no-content-message icon="group">
<template #message>
Expand Down
10 changes: 9 additions & 1 deletion apps/files/src/components/FileList.vue
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,15 @@
>
</div>
</oc-grid>
<div v-if="!loading" id="files-list-container" class="uk-overflow-auto">
<div v-if="loading" id="files-list-loading-message" class="uk-position-center">
<div class="uk-text-center">
<oc-spinner id="files-list-progress" size="large" :aria-hidden="true" />
<div class="uk-text-muted uk-text-large">
<slot name="loadingMessage" />
</div>
</div>
</div>
<div v-else id="files-list-container" class="uk-overflow-auto">
<RecycleScroller
v-if="fileData.length"
v-slot="{ item: rowItem, index, active }"
Expand Down
1 change: 0 additions & 1 deletion apps/files/src/components/FilesApp.vue
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,6 @@
:class="{ 'uk-visible@m': _sidebarOpen }"
@dragover="$_ocApp_dragOver"
>
<oc-loader v-if="loadingFolder" id="files-list-progress"></oc-loader>
<trash-bin v-if="$route.name === 'files-trashbin'" :file-data="activeFiles" />
<shared-files-list
v-else-if="sharedList"
Expand Down
3 changes: 3 additions & 0 deletions apps/files/src/components/Trashbin.vue
Original file line number Diff line number Diff line change
Expand Up @@ -54,6 +54,9 @@
{{ formDateFromNow(item.deleteTimestamp) }}
</div>
</template>
<template #loadingMessage>
<translate>Loading deleted files</translate>
</template>
<template #noContentMessage>
<no-content-message icon="delete">
<template #message>
Expand Down
3 changes: 2 additions & 1 deletion apps/files/src/store/actions.js
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
import moment from 'moment'
import uniqueId from 'lodash/uniqueId'
import _ from 'lodash'
import { getParentPaths } from '../helpers/path'
import { bitmaskToRole, permissionsBitmask } from '../helpers/collaborators'
Expand All @@ -23,7 +24,7 @@ function _buildFile(file) {
// actual file id (string)
id: file.fileInfo['{http://owncloud.org/ns}fileid'],
// temporary list id, to be used for view only and for uniqueness inside the list
viewId: _.uniqueId('file-'),
viewId: uniqueId('file-'),
starred: file.fileInfo['{http://owncloud.org/ns}favorite'] !== '0',
mdate: file.fileInfo['{DAV:}getlastmodified'],
mdateMoment: moment(file.fileInfo['{DAV:}getlastmodified']),
Expand Down
6 changes: 3 additions & 3 deletions apps/files/src/store/mutations.js
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
import Vue from 'vue'
import _ from 'lodash'
import pickBy from 'lodash/pickBy'

/**
* @param {Array.<Object>} shares array of shares
Expand Down Expand Up @@ -185,8 +185,8 @@ export default {
if (pathToKeep.charAt(0) !== '/') {
pathToKeep = '/' + pathToKeep
}
state.sharesTree = _.pickBy(state.sharesTree, (shares, path) => {
return _.startsWith(pathToKeep, path + '/')
state.sharesTree = pickBy(state.sharesTree, (shares, path) => {
return pathToKeep.startsWith(path + '/')
})
} else {
state.sharesTree = {}
Expand Down
5 changes: 5 additions & 0 deletions changelog/unreleased/files-list-loader
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
Change: More descriptive loading state

When browsing the different variations of the files list we removed the loader component at the top in favor of a spinner in the center of the viewport. The spinner has one line of text which describes what kind of data is being loaded.

https://github.com/owncloud/phoenix/pull/4099