From b600d736b8d481fe46b1582ab74e4009b1a4509c Mon Sep 17 00:00:00 2001 From: Denis Bykhov Date: Mon, 31 Oct 2022 17:57:49 +0600 Subject: [PATCH] 326 Fix (#2340) Signed-off-by: Denis Bykhov --- .../src/components/ViewletSetting.svelte | 19 ++++++++----------- .../src/components/filter/ValueFilter.svelte | 9 +++++---- plugins/view-resources/src/utils.ts | 3 +-- 3 files changed, 14 insertions(+), 17 deletions(-) diff --git a/plugins/view-resources/src/components/ViewletSetting.svelte b/plugins/view-resources/src/components/ViewletSetting.svelte index 7eb6f9b815..78bf6bb6df 100644 --- a/plugins/view-resources/src/components/ViewletSetting.svelte +++ b/plugins/view-resources/src/components/ViewletSetting.svelte @@ -147,21 +147,18 @@ const result = getBaseConfig(viewlet) const allAttributes = hierarchy.getAllAttributes(viewlet.attachTo) - for (const [, attribute] of allAttributes) { processAttribute(attribute, result) } - hierarchy - .getDescendants(viewlet.attachTo) - .filter((it) => hierarchy.isMixin(it)) - .forEach((it) => - hierarchy.getAllAttributes(it, viewlet.attachTo).forEach((attr) => { - if (attr.isCustom === true) { - processAttribute(attr, result, true) - } - }) - ) + hierarchy.getDescendants(viewlet.attachTo).forEach((it) => { + const ancestor = hierarchy.getAncestors(it)[1] + hierarchy.getAllAttributes(it, ancestor).forEach((attr) => { + if (attr.isCustom === true) { + processAttribute(attr, result, true) + } + }) + }) return preference === undefined ? result : setStatus(result, preference) } diff --git a/plugins/view-resources/src/components/filter/ValueFilter.svelte b/plugins/view-resources/src/components/filter/ValueFilter.svelte index 7791d7bcb4..cab4a08ab2 100644 --- a/plugins/view-resources/src/components/filter/ValueFilter.svelte +++ b/plugins/view-resources/src/components/filter/ValueFilter.svelte @@ -53,8 +53,9 @@ } : {} let prefix = '' - const attr = client.getHierarchy().getAttribute(filter.key._class, filter.key.key) - if (client.getHierarchy().isMixin(attr.attributeOf)) { + const hieararchy = client.getHierarchy() + const attr = hieararchy.getAttribute(filter.key._class, filter.key.key) + if (hieararchy.isMixin(attr.attributeOf)) { prefix = attr.attributeOf + '.' console.log('prefix', prefix) } @@ -66,8 +67,8 @@ for (const object of res) { let asDoc = object - if (client.getHierarchy().isMixin(filter.key._class)) { - asDoc = client.getHierarchy().as(object, filter.key._class) + if (hieararchy.isMixin(filter.key._class)) { + asDoc = hieararchy.as(object, filter.key._class) } const realValue = getObjectValue(filter.key.key, asDoc) const value = getValue(realValue) diff --git a/plugins/view-resources/src/utils.ts b/plugins/view-resources/src/utils.ts index fb96e2242a..1ed3359308 100644 --- a/plugins/view-resources/src/utils.ts +++ b/plugins/view-resources/src/utils.ts @@ -240,7 +240,7 @@ export async function buildModel (options: BuildModelOptions): Promise> - if (options.client.getHierarchy().isMixin(mixinName)) { + if (!mixinName.includes('$lookup')) { const realKey = key.key.substring(pos + 1) const rkey = { ...key, key: realKey } return { @@ -251,7 +251,6 @@ export async function buildModel (options: BuildModelOptions): Promise