diff --git a/models/tracker/src/index.ts b/models/tracker/src/index.ts index da9b04001b..83e3768585 100644 --- a/models/tracker/src/index.ts +++ b/models/tracker/src/index.ts @@ -181,11 +181,16 @@ export class TIssue extends TAttachedDoc implements Issue { @Index(IndexKind.FullText) description!: Markup - @Prop(TypeRef(tracker.class.IssueStatus), tracker.string.Status, { _id: tracker.attribute.IssueStatus }) + @Prop(TypeRef(tracker.class.IssueStatus), tracker.string.Status, { + _id: tracker.attribute.IssueStatus, + iconComponent: tracker.activity.StatusIcon + }) @Index(IndexKind.Indexed) status!: Ref - @Prop(TypeIssuePriority(), tracker.string.Priority) + @Prop(TypeIssuePriority(), tracker.string.Priority, { + iconComponent: tracker.activity.PriorityIcon + }) @Index(IndexKind.Indexed) priority!: IssuePriority diff --git a/models/tracker/src/plugin.ts b/models/tracker/src/plugin.ts index b2a497a52a..c10b96b072 100644 --- a/models/tracker/src/plugin.ts +++ b/models/tracker/src/plugin.ts @@ -39,7 +39,9 @@ export default mergeIds(trackerId, tracker, { CreatedOn: '' as IntlString }, activity: { - TxIssueCreated: '' as AnyComponent + TxIssueCreated: '' as AnyComponent, + StatusIcon: '' as AnyComponent, + PriorityIcon: '' as AnyComponent }, component: { SprintSelector: '' as AnyComponent, diff --git a/plugins/activity-resources/src/components/TxView.svelte b/plugins/activity-resources/src/components/TxView.svelte index 49441d9c3a..338a4ddd43 100644 --- a/plugins/activity-resources/src/components/TxView.svelte +++ b/plugins/activity-resources/src/components/TxView.svelte @@ -21,6 +21,7 @@ import { createQuery, getClient } from '@hcengineering/presentation' import { ActionIcon, + AnyComponent, Component, Icon, IconEdit, @@ -56,6 +57,7 @@ let employee: Employee | undefined let model: AttributeModel[] = [] let modelIcon: Asset | undefined = undefined + let iconComponent: AnyComponent | undefined = undefined let edit = false @@ -83,6 +85,7 @@ viewlet = result.viewlet model = result.model modelIcon = result.modelIcon + iconComponent = result.iconComponent props = getProps(result.props, edit) } }) @@ -172,7 +175,9 @@ {:else}
- {#if viewlet} + {#if iconComponent} + + {:else if viewlet} {:else if viewlet === undefined && model.length > 0} diff --git a/plugins/activity-resources/src/utils.ts b/plugins/activity-resources/src/utils.ts index bf0552a760..de44544add 100644 --- a/plugins/activity-resources/src/utils.ts +++ b/plugins/activity-resources/src/utils.ts @@ -99,17 +99,17 @@ export async function updateViewlet ( model: AttributeModel[] props: any modelIcon: Asset | undefined + iconComponent: AnyComponent | undefined }> { let viewlet = getViewlet(viewlets, dtx) - let props = getDTxProps(dtx) + const props = getDTxProps(dtx) let model: AttributeModel[] = [] let modelIcon: Asset | undefined + let iconComponent: AnyComponent | undefined if (viewlet === undefined) { ;({ viewlet, model } = await checkInlineViewlets(dtx, viewlet, client, model)) - // Only value is necessary for inline viewlets - props = { value: dtx.doc } if (model !== undefined) { // Check for State attribute for (const a of model) { @@ -118,9 +118,15 @@ export async function updateViewlet ( break } } + for (const a of model) { + if (a.attribute?.iconComponent !== undefined) { + iconComponent = a.attribute?.iconComponent + break + } + } } } - return { viewlet, id: dtx.tx._id, model, props, modelIcon } + return { viewlet, id: dtx.tx._id, model, props, modelIcon, iconComponent } } async function checkInlineViewlets ( diff --git a/plugins/tracker-resources/src/components/activity/PriorityIcon.svelte b/plugins/tracker-resources/src/components/activity/PriorityIcon.svelte new file mode 100644 index 0000000000..97fad4f956 --- /dev/null +++ b/plugins/tracker-resources/src/components/activity/PriorityIcon.svelte @@ -0,0 +1,31 @@ + + + +
+ +
diff --git a/plugins/tracker-resources/src/components/activity/StatusIcon.svelte b/plugins/tracker-resources/src/components/activity/StatusIcon.svelte new file mode 100644 index 0000000000..3a227d61e8 --- /dev/null +++ b/plugins/tracker-resources/src/components/activity/StatusIcon.svelte @@ -0,0 +1,31 @@ + + + +
+ {#if status} + + {/if} +
diff --git a/plugins/tracker-resources/src/components/issues/PriorityRefPresenter.svelte b/plugins/tracker-resources/src/components/issues/PriorityRefPresenter.svelte index 72ed7e7e8d..d3cbc2b07e 100644 --- a/plugins/tracker-resources/src/components/issues/PriorityRefPresenter.svelte +++ b/plugins/tracker-resources/src/components/issues/PriorityRefPresenter.svelte @@ -14,61 +14,22 @@ --> -{#if kind === 'list' || kind === 'list-header'} -
-
- {#if issuePriorities[value]?.icon}{/if} -
- - -
-{:else} -