mirror of
https://github.com/hcengineering/platform.git
synced 2025-01-08 21:27:45 +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 {}
|
export class TOrganization extends TContact implements Organization {}
|
||||||
|
|
||||||
@Model(contact.class.Status, core.class.AttachedDoc, DOMAIN_CONTACT)
|
@Model(contact.class.Status, core.class.AttachedDoc, DOMAIN_CONTACT)
|
||||||
|
@UX(contact.string.Status)
|
||||||
export class TStatus extends TAttachedDoc implements Status {
|
export class TStatus extends TAttachedDoc implements Status {
|
||||||
attachedTo!: Ref<Employee>
|
attachedTo!: Ref<Employee>
|
||||||
attachedToClass!: Ref<Class<Employee>>
|
attachedToClass!: Ref<Class<Employee>>
|
||||||
|
@ -84,6 +84,7 @@ export class TAttachedDoc extends TDoc implements AttachedDoc {
|
|||||||
collection!: string
|
collection!: string
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@UX(core.string.ClassLabel)
|
||||||
@Model(core.class.Class, core.class.Doc, DOMAIN_MODEL)
|
@Model(core.class.Class, core.class.Doc, DOMAIN_MODEL)
|
||||||
export class TClass extends TDoc implements Class<Obj> {
|
export class TClass extends TDoc implements Class<Obj> {
|
||||||
kind!: ClassifierKind
|
kind!: ClassifierKind
|
||||||
|
@ -13,7 +13,18 @@
|
|||||||
// limitations under the License.
|
// limitations under the License.
|
||||||
-->
|
-->
|
||||||
<script lang="ts">
|
<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 { IntlString } from '@anticrm/platform'
|
||||||
import presentation, { getClient, MessageBox } from '@anticrm/presentation'
|
import presentation, { getClient, MessageBox } from '@anticrm/presentation'
|
||||||
import {
|
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>
|
</script>
|
||||||
|
|
||||||
@ -134,7 +161,7 @@
|
|||||||
</thead>
|
</thead>
|
||||||
<tbody>
|
<tbody>
|
||||||
{#each attributes as attr}
|
{#each attributes as attr}
|
||||||
{@const attrType = attr.type._class === core.class.RefTo ? getRefClassTo(attr.type) : undefined}
|
{@const attrType = getAttrType(attr.type)}
|
||||||
<tr
|
<tr
|
||||||
class="antiTable-body__row"
|
class="antiTable-body__row"
|
||||||
on:contextmenu={(ev) => {
|
on:contextmenu={(ev) => {
|
||||||
@ -159,6 +186,13 @@
|
|||||||
{#if attrType !== undefined}
|
{#if attrType !== undefined}
|
||||||
: <Label label={attrType} />
|
: <Label label={attrType} />
|
||||||
{/if}
|
{/if}
|
||||||
|
{#if attr.type._class === core.class.Enum}
|
||||||
|
{#await getEnumName(attr.type) then name}
|
||||||
|
{#if name}
|
||||||
|
: {name}
|
||||||
|
{/if}
|
||||||
|
{/await}
|
||||||
|
{/if}
|
||||||
</td>
|
</td>
|
||||||
<td>
|
<td>
|
||||||
<Component is={view.component.BooleanTruePresenter} props={{ value: attr.isCustom ?? false }} />
|
<Component is={view.component.BooleanTruePresenter} props={{ value: attr.isCustom ?? false }} />
|
||||||
|
Loading…
Reference in New Issue
Block a user