From 7868d6fe3757caefa6719388f2e864d13e78d50f Mon Sep 17 00:00:00 2001 From: Fabio Manganiello Date: Tue, 3 Jan 2023 23:16:14 +0100 Subject: [PATCH] Support for nested configuration objects on entity modals --- .../src/components/panels/Entities/Index.vue | 22 +++++- .../src/components/panels/Entities/Modal.vue | 68 +++++++++++++++++-- 2 files changed, 82 insertions(+), 8 deletions(-) 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 01bf26b0a9..13345e63c9 100644 --- a/platypush/backend/http/webapp/src/components/panels/Entities/Index.vue +++ b/platypush/backend/http/webapp/src/components/panels/Entities/Index.vue @@ -15,9 +15,12 @@
- No entities found @@ -240,6 +243,19 @@ export default { }, {}) }, + configValuesByParentId(parentId) { + return Object.values(this.entities). + filter( + (entity) => entity + && entity.parent_id === parentId + && entity.is_configuration + ). + reduce((obj, entity) => { + obj[entity.id] = entity + return obj + }, {}) + }, + clearEntityTimeouts(entityId) { if (this.errorEntities[entityId]) delete this.errorEntities[entityId] 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 71ae59bd38..9db443f1e3 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,5 @@ @@ -111,11 +135,12 @@ import ConfirmDialog from "@/components/elements/ConfirmDialog"; import EditButton from "@/components/elements/EditButton"; import NameEditor from "@/components/elements/NameEditor"; import Utils from "@/Utils"; -import meta from './meta.json' +import Entity from "./Entity"; +import meta from './meta.json'; export default { - name: "Entity", - components: {Modal, EditButton, NameEditor, Icon, ConfirmDialog}, + name: "EntityModal", + components: {Entity, Modal, EditButton, NameEditor, Icon, ConfirmDialog}, mixins: [Utils], emits: ['input', 'loading'], props: { @@ -128,6 +153,19 @@ export default { type: Boolean, default: false, }, + + configValues: { + type: Object, + default: () => {}, + }, + }, + + computed: { + computedConfig() { + return Object.values(this.configValues).sort( + (a, b) => (a.name || '').localeCompare(b.name || '') + ) + }, }, data() { @@ -135,6 +173,7 @@ export default { loading: false, editName: false, editIcon: false, + configCollapsed: true, } }, @@ -211,10 +250,11 @@ export default {