From afd9a1d6bfa32d3f7837f1757f9a5ede4d24f58b Mon Sep 17 00:00:00 2001 From: Fabio Manganiello Date: Sat, 14 Jan 2023 22:33:53 +0100 Subject: [PATCH] Don't load entities that only have non-queriable children --- .../src/components/panels/Entities/Index.vue | 19 ++++++++++++++++++- 1 file changed, 18 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 685313b9..c1fa989f 100644 --- a/platypush/backend/http/webapp/src/components/panels/Entities/Index.vue +++ b/platypush/backend/http/webapp/src/components/panels/Entities/Index.vue @@ -177,6 +177,23 @@ export default { }, {}) }, + _shouldSkipLoading(entity) { + const children = Object.values(this.childrenByParentId(entity.id)) + const hasReadableChildren = children.filter((child) => { + return ( + !child.is_configuration && + !child.is_write_only && + !child.is_query_disabled + ) + }).length > 0 + + return ( + entity.is_query_disabled || + entity.is_write_only || + (children.length && !hasReadableChildren) + ) + }, + async refresh(group) { const entities = (group ? group.entities : this.entities) || {} const args = {} @@ -187,7 +204,7 @@ export default { }, {})) this.loadingEntities = Object.values(entities).reduce((obj, entity) => { - if (entity.is_query_disabled || entity.is_write_only) + if (this._shouldSkipLoading(entity)) return obj const self = this