summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorJannik Schönartz2021-03-09 22:38:11 +0100
committerJannik Schönartz2021-03-09 22:38:11 +0100
commitd225122a497876af8c2f3c613b64be60820be697 (patch)
tree446e807fe1a6701dbadd6eec7ff6679a5a13625b
parent[server/external-backends] Add error logging of object deletion in the extern... (diff)
downloadbas-d225122a497876af8c2f3c613b64be60820be697.tar.gz
bas-d225122a497876af8c2f3c613b64be60820be697.tar.xz
bas-d225122a497876af8c2f3c613b64be60820be697.zip
[webapp/clients] Add warning snackbar if there are errors when deleting an object from external-backends
-rw-r--r--webapp/src/components/GroupModuleDialog.vue8
-rw-r--r--webapp/src/store/groups.js11
2 files changed, 15 insertions, 4 deletions
diff --git a/webapp/src/components/GroupModuleDialog.vue b/webapp/src/components/GroupModuleDialog.vue
index 55053e6..7776aa0 100644
--- a/webapp/src/components/GroupModuleDialog.vue
+++ b/webapp/src/components/GroupModuleDialog.vue
@@ -275,7 +275,13 @@ export default {
callback: () => this.$snackbar({
color: 'success',
text: this.$tc('success.' + this.action + '.' + this.dialog.info.type, count, [count])
- })
+ }),
+ snackbar: (color, message) => {
+ this.$snackbar({
+ color: color,
+ text: message
+ })
+ }
}
if (this.action === 'add') data.selected = this.selected
if (this.action === 'delete') data.backends = this.backends
diff --git a/webapp/src/store/groups.js b/webapp/src/store/groups.js
index bd44bb7..8ec6e7c 100644
--- a/webapp/src/store/groups.js
+++ b/webapp/src/store/groups.js
@@ -199,15 +199,20 @@ export default {
if (callback) callback()
})
},
- deleteClients (context, { selected, callback, backends }) {
+ deleteClients (context, { selected, callback, snackbar, backends }) {
const ids = selected.map(x => x.id)
const backendIds = backends.filter(x => x.selected).map(x => x.id)
- axios.post('/api/clients/?delete', { ids, backendIds }).then(() => {
+ axios.post('/api/clients/?delete', { ids, backendIds }).then(response => {
const index = context.state.tabChain.length - 1
const item = context.state.tabChain[index]
if (item.tabType === 'client' && ids.includes(item.id)) context.commit('deleteFromTabChain', { index, count: 1 })
context.dispatch('reload')
- if (callback) callback()
+
+ if (callback) {
+ if (response.data.errors) {
+ snackbar('warning', response.data.message)
+ } else callback()
+ }
})
},
removeSubroups (context, { tabIndex, selected, callback }) {