diff --git a/models/board/src/index.ts b/models/board/src/index.ts index 73633adec9..494ae2bce0 100644 --- a/models/board/src/index.ts +++ b/models/board/src/index.ts @@ -41,7 +41,7 @@ import workbench, { Application } from '@hcengineering/model-workbench' import { IntlString } from '@hcengineering/platform' import type { AnyComponent } from '@hcengineering/ui' import board from './plugin' -import { State } from '@hcengineering/task' +import { DoneState, State } from '@hcengineering/task' export { boardId } from '@hcengineering/board' export { boardOperation } from './migration' @@ -103,6 +103,9 @@ export class TCard extends TTask implements Card { @Prop(TypeRef(task.class.State), task.string.TaskState, { _id: board.attribute.State }) declare status: Ref + + @Prop(TypeRef(task.class.DoneState), task.string.TaskStateDone, { _id: board.attribute.DoneState }) + declare doneState: Ref } @Model(board.class.MenuPage, core.class.Doc, DOMAIN_MODEL) diff --git a/models/lead/src/index.ts b/models/lead/src/index.ts index f0dc5818bf..011552ddd6 100644 --- a/models/lead/src/index.ts +++ b/models/lead/src/index.ts @@ -42,7 +42,7 @@ import view, { createAction, actionTemplates as viewTemplates } from '@hcenginee import workbench from '@hcengineering/model-workbench' import notification from '@hcengineering/notification' import setting from '@hcengineering/setting' -import { State } from '@hcengineering/task' +import { DoneState, State } from '@hcengineering/task' import { ViewOptionsModel } from '@hcengineering/view' import lead from './plugin' @@ -84,6 +84,9 @@ export class TLead extends TTask implements Lead { @Prop(TypeRef(task.class.State), task.string.TaskState, { _id: lead.attribute.State }) declare status: Ref + @Prop(TypeRef(task.class.DoneState), task.string.TaskStateDone, { _id: lead.attribute.DoneState }) + declare doneState: Ref + declare space: Ref } diff --git a/models/recruit/src/index.ts b/models/recruit/src/index.ts index 39a524b5af..4b513b2496 100644 --- a/models/recruit/src/index.ts +++ b/models/recruit/src/index.ts @@ -55,7 +55,7 @@ import { recruitId } from '@hcengineering/recruit' import setting from '@hcengineering/setting' -import { State } from '@hcengineering/task' +import { DoneState, State } from '@hcengineering/task' import { KeyBinding, ViewOptionsModel } from '@hcengineering/view' import recruit from './plugin' import { createReviewModel, reviewTableConfig, reviewTableOptions } from './review' @@ -167,6 +167,9 @@ export class TApplicant extends TTask implements Applicant { @Prop(TypeRef(task.class.State), task.string.TaskState, { _id: recruit.attribute.State }) declare status: Ref + + @Prop(TypeRef(task.class.DoneState), task.string.TaskStateDone, { _id: recruit.attribute.DoneState }) + declare doneState: Ref } @Model(recruit.class.ApplicantMatch, core.class.AttachedDoc, DOMAIN_TASK) @@ -1196,23 +1199,17 @@ export function createModel (builder: Builder): void { }) createAction(builder, { - action: view.actionImpl.ValueSelector, - actionPopup: view.component.ValueSelector, + action: task.actionImpl.SelectStatus, + actionPopup: task.component.StatusSelector, actionProps: { - attribute: 'status', _class: task.class.State, - query: {}, - searchField: 'name', - // should match space - fillQuery: { space: 'space' }, - // Only apply for same vacancy - docMatches: ['space'], + ofAttribute: recruit.attribute.State, placeholder: task.string.TaskState }, label: task.string.TaskState, icon: task.icon.TaskState, - keyBinding: [], - input: 'none', + keyBinding: ['keyS->keyS'], + input: 'any', category: recruit.category.Recruit, target: recruit.class.Applicant, context: { @@ -1221,24 +1218,19 @@ export function createModel (builder: Builder): void { group: 'edit' } }) + createAction(builder, { - action: view.actionImpl.ValueSelector, - actionPopup: view.component.ValueSelector, + action: task.actionImpl.SelectStatus, + actionPopup: task.component.StatusSelector, actionProps: { - attribute: 'doneState', _class: task.class.DoneState, - query: {}, - searchField: 'name', - // should match space - fillQuery: { space: 'space' }, - // Only apply for same vacancy - docMatches: ['space'], + ofAttribute: recruit.attribute.DoneState, placeholder: task.string.DoneState }, label: task.string.DoneState, icon: task.icon.TaskState, - keyBinding: [], - input: 'none', + keyBinding: ['keyS->keyD'], + input: 'any', category: recruit.category.Recruit, target: recruit.class.Applicant, context: { @@ -1247,6 +1239,7 @@ export function createModel (builder: Builder): void { group: 'edit' } }) + createAction( builder, { diff --git a/models/task/src/migration.ts b/models/task/src/migration.ts index e5054d330b..d8ed47a8a6 100644 --- a/models/task/src/migration.ts +++ b/models/task/src/migration.ts @@ -240,21 +240,21 @@ async function fixStatusAttributes (client: MigrationClient): Promise { const space = map.get(oldStatus.space) if (space !== undefined) { try { - const isDone = oldStatus._class === task.class.DoneState + const isDone = client.hierarchy.isDerived(oldStatus._class, task.class.DoneState) let ofAttribute = task.attribute.State if (space._class === ('recruit:class:Vacancy' as Ref>)) { ofAttribute = isDone - ? ('recruit.attribute.DoneState' as Ref>) + ? ('recruit:attribute:DoneState' as Ref>) : ('recruit:attribute:State' as Ref>) } if (space._class === ('lead:class:Funnel' as Ref>)) { ofAttribute = isDone - ? ('lead.attribute.DoneState' as Ref>) + ? ('lead:attribute:DoneState' as Ref>) : ('lead:attribute:State' as Ref>) } if (space._class === ('board:class:Board' as Ref>)) { ofAttribute = isDone - ? ('board.attribute.DoneState' as Ref>) + ? ('board:attribute:DoneState' as Ref>) : ('board:attribute:State' as Ref>) } if (space._class === ('tracker:class:Project' as Ref>)) { diff --git a/models/task/src/plugin.ts b/models/task/src/plugin.ts index 6f65c08f2a..48a2c15e9d 100644 --- a/models/task/src/plugin.ts +++ b/models/task/src/plugin.ts @@ -34,7 +34,8 @@ export default mergeIds(taskId, task, { TodoItemMarkDone: '' as ViewAction, TodoItemMarkUnDone: '' as ViewAction, ArchiveSpace: '' as ViewAction, - UnarchiveSpace: '' as ViewAction + UnarchiveSpace: '' as ViewAction, + SelectStatus: '' as ViewAction }, category: { Task: '' as Ref, @@ -57,7 +58,8 @@ export default mergeIds(taskId, task, { TaskHeader: '' as AnyComponent, Dashboard: '' as AnyComponent, StateRefPresenter: '' as AnyComponent, - DoneStateRefPresenter: '' as AnyComponent + DoneStateRefPresenter: '' as AnyComponent, + StatusSelector: '' as AnyComponent }, space: { TasksPublic: '' as Ref diff --git a/models/tracker/src/index.ts b/models/tracker/src/index.ts index e40e03a824..b61b7b90ea 100644 --- a/models/tracker/src/index.ts +++ b/models/tracker/src/index.ts @@ -1541,8 +1541,13 @@ export function createModel (builder: Builder): void { createAction( builder, { - action: tracker.actionImpl.SelectStatus, - actionPopup: tracker.component.StatusSelector, + action: task.actionImpl.SelectStatus, + actionPopup: task.component.StatusSelector, + actionProps: { + _class: tracker.class.IssueStatus, + ofAttribute: tracker.attribute.IssueStatus, + placeholder: tracker.string.Status + }, label: tracker.string.Status, icon: tracker.icon.CategoryBacklog, keyBinding: ['keyS->keyS'], diff --git a/models/tracker/src/plugin.ts b/models/tracker/src/plugin.ts index acc8e1b311..c52a3cb162 100644 --- a/models/tracker/src/plugin.ts +++ b/models/tracker/src/plugin.ts @@ -54,8 +54,7 @@ export default mergeIds(trackerId, tracker, { IssueStatistics: '' as AnyComponent, TimeSpendReportPopup: '' as AnyComponent, NotificationIssuePresenter: '' as AnyComponent, - MilestoneFilter: '' as AnyComponent, - StatusSelector: '' as AnyComponent + MilestoneFilter: '' as AnyComponent }, app: { Tracker: '' as Ref @@ -78,7 +77,6 @@ export default mergeIds(trackerId, tracker, { IssueCategory: '' as Ref }, actionImpl: { - SelectStatus: '' as ViewAction, Move: '' as ViewAction, CopyToClipboard: '' as ViewAction, EditWorkflowStatuses: '' as ViewAction, diff --git a/plugins/tracker-resources/src/components/issues/StatusSelector.svelte b/plugins/task-resources/src/components/StatusSelector.svelte similarity index 59% rename from plugins/tracker-resources/src/components/issues/StatusSelector.svelte rename to plugins/task-resources/src/components/StatusSelector.svelte index c46c2dcd54..4c285e96cc 100644 --- a/plugins/tracker-resources/src/components/issues/StatusSelector.svelte +++ b/plugins/task-resources/src/components/StatusSelector.svelte @@ -1,24 +1,29 @@