fix(files): better wording and catch single action run

Signed-off-by: John Molakvoæ <skjnldsv@protonmail.com>
This commit is contained in:
John Molakvoæ 2023-04-05 17:34:47 +02:00
parent 8298bb44fd
commit ea3e77d6b9
No known key found for this signature in database
GPG key ID: 60C25B8C072916CF
8 changed files with 19 additions and 14 deletions

View file

@ -103,7 +103,7 @@ import { debounce } from 'debounce'
import { formatFileSize } from '@nextcloud/files'
import { Fragment } from 'vue-fragment'
import { join } from 'path'
import { showError } from '@nextcloud/dialogs'
import { showError, showSuccess } from '@nextcloud/dialogs'
import { translate } from '@nextcloud/l10n'
import CancelablePromise from 'cancelable-promise'
import FileIcon from 'vue-material-design-icons/File.vue'
@ -434,10 +434,15 @@ export default Vue.extend({
const displayName = action.displayName([this.source], this.currentView)
try {
this.loading = action.id
await action.exec(this.source, this.currentView)
const success = await action.exec(this.source, this.currentView)
if (success) {
showSuccess(this.t('files', '"{displayName}" action executed successfully', { displayName }))
return
}
showError(this.t('files', '"{displayName}" action failed', { displayName }))
} catch (e) {
logger.error('Error while executing action', { action, e })
showError(this.t('files', 'Error while executing action "{displayName}"', { displayName }))
showError(this.t('files', '"{displayName}" action failed', { displayName }))
} finally {
this.loading = ''
}

View file

@ -136,11 +136,11 @@ export default Vue.extend({
}
// Show success message and clear selection
showSuccess(this.t('files', '"{displayName}" batch action successfully executed', { displayName }))
showSuccess(this.t('files', '"{displayName}" batch action executed successfully', { displayName }))
this.selectionStore.reset()
} catch (e) {
logger.error('Error while executing action', { action, e })
showError(this.t('files', 'Error while executing action "{displayName}"', { displayName }))
showError(this.t('files', '"{displayName}" action failed', { displayName }))
} finally {
this.loading = null
}

4
dist/files-main.js vendored

File diff suppressed because one or more lines are too long

File diff suppressed because one or more lines are too long

File diff suppressed because one or more lines are too long

File diff suppressed because one or more lines are too long

File diff suppressed because one or more lines are too long

File diff suppressed because one or more lines are too long