summaryrefslogtreecommitdiffstats
path: root/apps/files/src/components
diff options
context:
space:
mode:
Diffstat (limited to 'apps/files/src/components')
-rw-r--r--apps/files/src/components/FileEntry.vue6
-rw-r--r--apps/files/src/components/FilesListHeaderActions.vue17
2 files changed, 22 insertions, 1 deletions
diff --git a/apps/files/src/components/FileEntry.vue b/apps/files/src/components/FileEntry.vue
index 130cd12367e..fca83cabbd1 100644
--- a/apps/files/src/components/FileEntry.vue
+++ b/apps/files/src/components/FileEntry.vue
@@ -63,6 +63,7 @@
<!-- Menu actions -->
<NcActions v-if="active"
ref="actionsMenu"
+ :disabled="source._loading"
:force-title="true"
:inline="enabledInlineActions.length">
<NcActionButton v-for="action in enabledMenuActions"
@@ -433,7 +434,10 @@ export default Vue.extend({
async onActionClick(action) {
const displayName = action.displayName([this.source], this.currentView)
try {
+ // Set the loading marker
this.loading = action.id
+ Vue.set(this.source, '_loading', true)
+
const success = await action.exec(this.source, this.currentView)
if (success) {
showSuccess(this.t('files', '"{displayName}" action executed successfully', { displayName }))
@@ -444,7 +448,9 @@ export default Vue.extend({
logger.error('Error while executing action', { action, e })
showError(this.t('files', '"{displayName}" action failed', { displayName }))
} finally {
+ // Reset the loading marker
this.loading = ''
+ Vue.set(this.source, '_loading', false)
}
},
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)
+ })
}
},