From d261b9bb9bd16b7abd75ea012fb91dc38b3d3017 Mon Sep 17 00:00:00 2001 From: Fabio Manganiello Date: Sun, 24 Apr 2022 21:40:10 +0200 Subject: [PATCH] Frontend support for entities deletion --- .../src/components/panels/Entities/Index.vue | 16 +++++++++ .../src/components/panels/Entities/Modal.vue | 36 ++++++++++++++++++- 2 files changed, 51 insertions(+), 1 deletion(-) diff --git a/platypush/backend/http/webapp/src/components/panels/Entities/Index.vue b/platypush/backend/http/webapp/src/components/panels/Entities/Index.vue index 041bf22a1..662b87651 100644 --- a/platypush/backend/http/webapp/src/components/panels/Entities/Index.vue +++ b/platypush/backend/http/webapp/src/components/panels/Entities/Index.vue @@ -256,6 +256,16 @@ export default { this.entities[entityId] = entity }, + onEntityDelete(event) { + const entityId = event.entity?.id + if (entityId == null) + return + if (entityId === this.modalEntityId) + this.modalEntityId = null + if (this.entities[entityId]) + delete this.entities[entityId] + }, + onEntityModal(entityId) { if (entityId) { this.modalEntityId = entityId @@ -274,6 +284,12 @@ export default { 'platypush.message.event.entities.EntityUpdateEvent' ) + this.subscribe( + this.onEntityDelete, + 'on-entity-delete', + 'platypush.message.event.entities.EntityDeleteEvent' + ) + this.sync() }, } diff --git a/platypush/backend/http/webapp/src/components/panels/Entities/Modal.vue b/platypush/backend/http/webapp/src/components/panels/Entities/Modal.vue index f4f256b08..1a2b608bb 100644 --- a/platypush/backend/http/webapp/src/components/panels/Entities/Modal.vue +++ b/platypush/backend/http/webapp/src/components/panels/Entities/Modal.vue @@ -1,5 +1,12 @@