Signed-off-by: Denis Bykhov <bykhov.denis@gmail.com>
This commit is contained in:
Denis Bykhov 2022-10-31 17:57:49 +06:00 committed by GitHub
parent 242b3dc96e
commit b600d736b8
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
3 changed files with 14 additions and 17 deletions

View File

@ -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) => {
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)
}

View File

@ -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)

View File

@ -240,7 +240,7 @@ export async function buildModel (options: BuildModelOptions): Promise<Attribute
const pos = key.key.lastIndexOf('.')
if (pos !== -1) {
const mixinName = key.key.substring(0, pos) as Ref<Class<Doc>>
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<Attribute
}
}
}
return await getPresenter(options.client, options._class, key, key, options.lookup)
} catch (err: any) {
if (options.ignoreMissing ?? false) {