mirror of
https://github.com/hcengineering/platform.git
synced 2026-09-27 03:54:57 +02:00
1918_fix (#1921)
Signed-off-by: Denis Bykhov <80476319+BykhovDenis@users.noreply.github.com>
This commit is contained in:
@@ -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 }} />
|
||||
|
||||
Reference in New Issue
Block a user