From b916c98b70c7aded88694ec8363fe4c71942bab8 Mon Sep 17 00:00:00 2001 From: Fabio Manganiello Date: Sat, 16 Dec 2023 23:29:57 +0100 Subject: [PATCH] [ProcedureEditor] Emit `input` upon action changes. --- .../components/Procedure/ProcedureEditor.vue | 27 ++++++++++++++++--- 1 file changed, 24 insertions(+), 3 deletions(-) diff --git a/platypush/backend/http/webapp/src/components/Procedure/ProcedureEditor.vue b/platypush/backend/http/webapp/src/components/Procedure/ProcedureEditor.vue index 6dced4eb..bb4a7926 100644 --- a/platypush/backend/http/webapp/src/components/Procedure/ProcedureEditor.vue +++ b/platypush/backend/http/webapp/src/components/Procedure/ProcedureEditor.vue @@ -37,8 +37,8 @@ draggable with-delete @drag="dragItem = index" @drop="dragItem = undefined" - @input="newValue.actions[index] = $event" - @delete="newValue.actions.splice(index, 1)" /> + @input="editAction($event, index)" + @delete="deleteAction(index)" />
- +
@@ -126,6 +126,10 @@ export default { this.running = false }, + emitInput() { + this.$emit('input', this.newValue) + }, + onDrop(index) { if (this.dragItem === undefined) return @@ -133,6 +137,8 @@ export default { this.newValue.actions.splice( index, 0, this.newValue.actions.splice(this.dragItem, 1)[0] ) + + this.emitInput() }, executeAction() { @@ -142,6 +148,21 @@ export default { this.running = true this.execute(this.value.actions).then(this.onResponse).catch(this.onError).finally(this.onDone) }, + + editAction(action, index) { + this.newValue.actions[index] = action + this.emitInput() + }, + + addAction(action) { + this.newValue.actions.push(action) + this.emitInput() + }, + + deleteAction(index) { + this.newValue.actions.splice(index, 1) + this.emitInput() + }, }, watch: {