aboutsummaryrefslogtreecommitdiffstats
path: root/apps/files/src/components/FilesListHeaderActions.vue
diff options
context:
space:
mode:
authorJohn Molakvoæ <skjnldsv@protonmail.com>2023-04-07 09:30:13 +0200
committerJohn Molakvoæ <skjnldsv@protonmail.com>2023-04-11 11:58:02 +0200
commit45f39d65fea0c00ea3b01f0593422d97e791ff16 (patch)
tree306bace300249b7dd97c45fd6ec2e31cdee3652c /apps/files/src/components/FilesListHeaderActions.vue
parent441aab68a4bbc1e2b88831ccb0f885cd80b7dd1a (diff)
downloadnextcloud-server-45f39d65fea0c00ea3b01f0593422d97e791ff16.tar.gz
nextcloud-server-45f39d65fea0c00ea3b01f0593422d97e791ff16.zip
fix(files): fix private variables and share loading marker between header and row
Signed-off-by: John Molakvoæ <skjnldsv@protonmail.com>
Diffstat (limited to 'apps/files/src/components/FilesListHeaderActions.vue')
-rw-r--r--apps/files/src/components/FilesListHeaderActions.vue17
1 files changed, 16 insertions, 1 deletions
diff --git a/apps/files/src/components/FilesListHeaderActions.vue b/apps/files/src/components/FilesListHeaderActions.vue
index b7d48f1de25..d60fd81ad00 100644
--- a/apps/files/src/components/FilesListHeaderActions.vue
+++ b/apps/files/src/components/FilesListHeaderActions.vue
@@ -22,7 +22,7 @@
<template>
<th class="files-list__column files-list__row-actions-batch" colspan="2">
<NcActions ref="actionsMenu"
- :disabled="!!loading"
+ :disabled="!!loading || areSomeNodesLoading"
:force-title="true"
:inline="3">
<NcActionButton v-for="action in enabledActions"
@@ -105,6 +105,10 @@ export default Vue.extend({
.map(fileid => this.getNode(fileid))
.filter(node => node)
},
+
+ areSomeNodesLoading() {
+ return this.nodes.some(node => node._loading)
+ },
},
methods: {
@@ -122,9 +126,16 @@ export default Vue.extend({
const displayName = action.displayName(this.nodes, this.currentView)
const selectionIds = this.selectedNodes
try {
+ // Set loading markers
this.loading = action.id
+ this.nodes.forEach(node => {
+ Vue.set(node, '_loading', true)
+ })
+
+ // Dispatch action execution
const results = await action.execBatch(this.nodes, this.currentView)
+ // Handle potential failures
if (results.some(result => result !== true)) {
// Remove the failed ids from the selection
const failedIds = selectionIds
@@ -142,7 +153,11 @@ export default Vue.extend({
logger.error('Error while executing action', { action, e })
showError(this.t('files', '"{displayName}" action failed', { displayName }))
} finally {
+ // Remove loading markers
this.loading = null
+ this.nodes.forEach(node => {
+ Vue.set(node, '_loading', false)
+ })
}
},