mirror of
https://github.com/hcengineering/platform.git
synced 2024-12-22 19:11:33 +03:00
1918_fix (#1921)
Signed-off-by: Denis Bykhov <80476319+BykhovDenis@users.noreply.github.com>
This commit is contained in:
parent
89f0898f2f
commit
a2d8bfc5e3
@ -99,6 +99,7 @@ export class TPerson extends TContact implements Person {}
|
||||
export class TOrganization extends TContact implements Organization {}
|
||||
|
||||
@Model(contact.class.Status, core.class.AttachedDoc, DOMAIN_CONTACT)
|
||||
@UX(contact.string.Status)
|
||||
export class TStatus extends TAttachedDoc implements Status {
|
||||
attachedTo!: Ref<Employee>
|
||||
attachedToClass!: Ref<Class<Employee>>
|
||||
|
@ -84,6 +84,7 @@ export class TAttachedDoc extends TDoc implements AttachedDoc {
|
||||
collection!: string
|
||||
}
|
||||
|
||||
@UX(core.string.ClassLabel)
|
||||
@Model(core.class.Class, core.class.Doc, DOMAIN_MODEL)
|
||||
export class TClass extends TDoc implements Class<Obj> {
|
||||
kind!: ClassifierKind
|
||||
|
@ -13,7 +13,18 @@
|
||||
// limitations under the License.
|
||||
-->
|
||||
<script lang="ts">
|
||||
import core, { AnyAttribute, Class, Doc, Ref, RefTo, Type } from '@anticrm/core'
|
||||
import core, {
|
||||
AnyAttribute,
|
||||
ArrOf,
|
||||
AttachedDoc,
|
||||
Class,
|
||||
Collection,
|
||||
Doc,
|
||||
EnumOf,
|
||||
Ref,
|
||||
RefTo,
|
||||
Type
|
||||
} from '@anticrm/core'
|
||||
import { IntlString } from '@anticrm/platform'
|
||||
import presentation, { getClient, MessageBox } from '@anticrm/presentation'
|
||||
import {
|
||||
@ -103,8 +114,24 @@
|
||||
() => {}
|
||||
)
|
||||
}
|
||||
function getRefClassTo (value: Type<Type<any>>): IntlString {
|
||||
return client.getHierarchy().getClass((value as RefTo<Doc>).to).label
|
||||
|
||||
function getAttrType (type: Type<any>): IntlString | undefined {
|
||||
switch (type._class) {
|
||||
case core.class.RefTo:
|
||||
return client.getHierarchy().getClass((type as RefTo<Doc>).to).label
|
||||
case core.class.Collection:
|
||||
return client.getHierarchy().getClass((type as Collection<AttachedDoc>).of).label
|
||||
case core.class.ArrOf:
|
||||
return (type as ArrOf<Doc>).of.label
|
||||
default:
|
||||
return undefined
|
||||
}
|
||||
}
|
||||
|
||||
async function getEnumName (type: Type<any>): Promise<string | undefined> {
|
||||
const ref = (type as EnumOf).of
|
||||
const res = await client.findOne(core.class.Enum, { _id: ref })
|
||||
return res?.name
|
||||
}
|
||||
</script>
|
||||
|
||||
@ -134,7 +161,7 @@
|
||||
</thead>
|
||||
<tbody>
|
||||
{#each attributes as attr}
|
||||
{@const attrType = attr.type._class === core.class.RefTo ? getRefClassTo(attr.type) : undefined}
|
||||
{@const attrType = getAttrType(attr.type)}
|
||||
<tr
|
||||
class="antiTable-body__row"
|
||||
on:contextmenu={(ev) => {
|
||||
@ -159,6 +186,13 @@
|
||||
{#if attrType !== undefined}
|
||||
: <Label label={attrType} />
|
||||
{/if}
|
||||
{#if attr.type._class === core.class.Enum}
|
||||
{#await getEnumName(attr.type) then name}
|
||||
{#if name}
|
||||
: {name}
|
||||
{/if}
|
||||
{/await}
|
||||
{/if}
|
||||
</td>
|
||||
<td>
|
||||
<Component is={view.component.BooleanTruePresenter} props={{ value: attr.isCustom ?? false }} />
|
||||
|
Loading…
Reference in New Issue
Block a user