From 4752614c0105b864d00e97179b4b77ccbad89e2d Mon Sep 17 00:00:00 2001 From: Jannik Schönartz Date: Wed, 16 Oct 2019 19:16:14 +0000 Subject: [webapp/clients] Add the choice to select backends when deleting clients [group/clients] Checkbox list of the clients in the permanently delete dialog [server/backendhelper] Only deletes from the selected backends (array with backendids) --- webapp/src/components/GroupModuleDialog.vue | 25 +++++++++++++++++++++++-- webapp/src/store/groups.js | 5 +++-- 2 files changed, 26 insertions(+), 4 deletions(-) (limited to 'webapp') diff --git a/webapp/src/components/GroupModuleDialog.vue b/webapp/src/components/GroupModuleDialog.vue index e9bb65d..41b98b5 100644 --- a/webapp/src/components/GroupModuleDialog.vue +++ b/webapp/src/components/GroupModuleDialog.vue @@ -45,7 +45,8 @@ "name": "Name", "description": "Description", "ip": "IP Address", - "wake": "Wake up" + "wake": "Wake up", + "deleteInBackends": "Select the backends, where the clients will get deleted:" }, "de": { "title": { @@ -92,7 +93,8 @@ "name": "Name", "description": "Beschreibung", "ip": "IP Adresse", - "wake": "Aufwecken" + "wake": "Aufwecken", + "deleteInBackends": "Wähle die Backends, aus denen die Clients gelöscht werden:" } } @@ -138,6 +140,19 @@ >
[{{ item.id }}] {{ item.name }}
+
+
{{ $t('deleteInBackends') }}
+ +
@@ -183,6 +198,7 @@ export default { }, computed: { ...mapState('groups', ['dialog', 'tabChain']), + ...mapState('backends', ['backends']), headers () { const lastColumn = this.dialog.info.type === 'client' ? 'ip' : 'description' return [ @@ -227,6 +243,7 @@ export default { if (this.dialog.info.action === 'select') this.selected = this.dialog.info.selected else this.selected = [] if (this.$refs.cardtext) this.$nextTick(() => this.$refs.cardtext.dispatchEvent(new Event('scroll'))) + if (this.dialog.info.type === 'client') this.$store.dispatch('backends/loadData') } } } @@ -262,6 +279,7 @@ export default { }) } if (this.action === 'add') data.selected = this.selected + if (this.action === 'delete') data.backends = this.backends this.$store.dispatch('groups/' + actionMap[this.action][this.dialog.info.type], data) this.setDialog({ show: false }) }, @@ -297,4 +315,7 @@ export default { .selected-list { padding: 30px; } +.select-backends { + margin-top: 20px; +} diff --git a/webapp/src/store/groups.js b/webapp/src/store/groups.js index 2785468..7948e31 100644 --- a/webapp/src/store/groups.js +++ b/webapp/src/store/groups.js @@ -193,9 +193,10 @@ export default { if (callback) callback() }) }, - deleteClients (context, { selected, callback }) { + deleteClients (context, { selected, callback, backends }) { const ids = selected.map(x => x.id) - axios.post('/api/clients/?delete', { ids }).then(() => { + const backendIds = backends.filter(x => x.selected).map(x => x.id) + axios.post('/api/clients/?delete', { ids, backendIds }).then(() => { 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 }) -- cgit v1.2.3-55-g7522