mirror of
https://github.com/hcengineering/platform.git
synced 2024-12-22 19:11:33 +03:00
Fix class editor (#7099)
This commit is contained in:
parent
9d79ab65ae
commit
3ea2659d9e
@ -99,13 +99,12 @@
|
||||
async function showMenu (ev: MouseEvent, attribute: AnyAttribute, row: number): Promise<void> {
|
||||
hovered = row
|
||||
const exist = (await client.findOne(attribute.attributeOf, { [attribute.name]: { $exists: true } })) !== undefined
|
||||
|
||||
const actions: Action[] = [
|
||||
{
|
||||
label: presentation.string.Edit,
|
||||
icon: IconEdit,
|
||||
action: async () => {
|
||||
dispatch('select', attribute._id)
|
||||
dispatch('select', attribute)
|
||||
}
|
||||
}
|
||||
]
|
||||
@ -118,7 +117,7 @@
|
||||
}
|
||||
})
|
||||
}
|
||||
const extra = await getContextActions(client, attribute, { mode: 'context' })
|
||||
const extra = await getContextActions(client, attribute, { mode: 'context' }, core.class.Attribute)
|
||||
actions.push(
|
||||
...extra.map((it) => ({
|
||||
label: it.label,
|
||||
|
@ -58,7 +58,7 @@
|
||||
|
||||
const data: Data<AnyAttribute> = {
|
||||
attributeOf: _class,
|
||||
name: name.trim().replace('/', '').replace(' ', '') + '_' + generateId(),
|
||||
name: 'custom' + generateId(),
|
||||
label: getEmbeddedLabel(name),
|
||||
isCustom: true,
|
||||
type,
|
||||
|
@ -44,7 +44,8 @@
|
||||
)
|
||||
})
|
||||
|
||||
let refClass: Ref<Doc> | undefined = type !== undefined ? hierarchy.getClass(type.of._class)._id : undefined
|
||||
let refClass: Ref<Doc> | undefined =
|
||||
type?.of?._class !== undefined ? hierarchy.getClass(type.of._class)._id : undefined
|
||||
|
||||
$: selected = types.find((p) => p._id === refClass)
|
||||
|
||||
|
@ -136,9 +136,10 @@ export async function getContextActions (
|
||||
context: {
|
||||
mode: ViewContextType
|
||||
application?: Ref<Doc>
|
||||
}
|
||||
},
|
||||
derived: Ref<Class<Doc>> = core.class.Doc
|
||||
): Promise<Action[]> {
|
||||
const result = await getActions(client, doc, undefined, context.mode)
|
||||
const result = await getActions(client, doc, derived, context.mode)
|
||||
|
||||
if (context.application !== undefined) {
|
||||
return result.filter((it) => it.context.application === context.application || it.context.application === undefined)
|
||||
|
Loading…
Reference in New Issue
Block a user