From a9cd08047626f34d24a6d119359659996ce90303 Mon Sep 17 00:00:00 2001 From: Denis Bykhov Date: Sat, 9 Sep 2023 14:43:54 +0600 Subject: [PATCH] UBER-846 (#3674) Signed-off-by: Denis Bykhov --- models/tracker/src/index.ts | 25 +---- models/tracker/src/plugin.ts | 4 +- .../components/issues/StatusSelector.svelte | 104 ++++++++++++++++++ plugins/tracker-resources/src/index.ts | 10 +- 4 files changed, 118 insertions(+), 25 deletions(-) create mode 100644 plugins/tracker-resources/src/components/issues/StatusSelector.svelte diff --git a/models/tracker/src/index.ts b/models/tracker/src/index.ts index 1ab8837b14..e40e03a824 100644 --- a/models/tracker/src/index.ts +++ b/models/tracker/src/index.ts @@ -19,7 +19,6 @@ import { DOMAIN_MODEL, DateRangeMode, Domain, - FindOptions, IndexKind, Markup, Ref, @@ -1518,13 +1517,6 @@ export function createModel (builder: Builder): void { tracker.completion.IssueCategory ) - const statusOptions: FindOptions = { - lookup: { - category: core.class.StatusCategory - }, - sort: { rank: SortingOrder.Ascending } - } - createAction(builder, { action: view.actionImpl.ShowPopup, actionProps: { @@ -1549,20 +1541,8 @@ export function createModel (builder: Builder): void { createAction( builder, { - action: view.actionImpl.ValueSelector, - actionPopup: view.component.ValueSelector, - actionProps: { - attribute: 'status', - _class: tracker.class.IssueStatus, - placeholder: tracker.string.SetStatus, - query: { - ofAttribute: tracker.attribute.IssueStatus - }, - fillQuery: { - space: 'space' - }, - queryOptions: statusOptions - }, + action: tracker.actionImpl.SelectStatus, + actionPopup: tracker.component.StatusSelector, label: tracker.string.Status, icon: tracker.icon.CategoryBacklog, keyBinding: ['keyS->keyS'], @@ -1577,6 +1557,7 @@ export function createModel (builder: Builder): void { }, tracker.action.SetStatus ) + createAction( builder, { diff --git a/models/tracker/src/plugin.ts b/models/tracker/src/plugin.ts index c52a3cb162..acc8e1b311 100644 --- a/models/tracker/src/plugin.ts +++ b/models/tracker/src/plugin.ts @@ -54,7 +54,8 @@ export default mergeIds(trackerId, tracker, { IssueStatistics: '' as AnyComponent, TimeSpendReportPopup: '' as AnyComponent, NotificationIssuePresenter: '' as AnyComponent, - MilestoneFilter: '' as AnyComponent + MilestoneFilter: '' as AnyComponent, + StatusSelector: '' as AnyComponent }, app: { Tracker: '' as Ref @@ -77,6 +78,7 @@ 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/tracker-resources/src/components/issues/StatusSelector.svelte new file mode 100644 index 0000000000..c46c2dcd54 --- /dev/null +++ b/plugins/tracker-resources/src/components/issues/StatusSelector.svelte @@ -0,0 +1,104 @@ + + +{#if docMatch} + { + changeStatus(evt.detail === null ? null : evt.detail?._id) + }} + {placeholder} + on:changeContent + > + +
+ +
+
+
+{:else} +
dispatch('changeContent')}> +
+
+
+{/if} diff --git a/plugins/tracker-resources/src/index.ts b/plugins/tracker-resources/src/index.ts index 57237a1be8..171c8796b7 100644 --- a/plugins/tracker-resources/src/index.ts +++ b/plugins/tracker-resources/src/index.ts @@ -75,7 +75,7 @@ import SetDueDateActionPopup from './components/SetDueDateActionPopup.svelte' import SetParentIssueActionPopup from './components/SetParentIssueActionPopup.svelte' import CreateIssueTemplate from './components/templates/CreateIssueTemplate.svelte' import Statuses from './components/workflow/Statuses.svelte' - +import StatusSelector from './components/issues/StatusSelector.svelte' import { getIssueId, getIssueTitle, @@ -208,6 +208,10 @@ async function move (issues: Issue | Issue[]): Promise { showPopup(MoveIssues, { selected: issues }, 'top') } +async function selectStatus (doc: Issue | Issue[]): Promise { + showPopup(StatusSelector, { value: doc }, 'top') +} + async function editWorkflowStatuses (project: Project | undefined): Promise { if (project !== undefined) { showPopup(Statuses, { projectId: project._id, projectClass: project._class }, 'top') @@ -474,7 +478,8 @@ export default async (): Promise => ({ PriorityFilterValuePresenter, StatusFilterValuePresenter, ProjectFilterValuePresenter, - ComponentFilterValuePresenter + ComponentFilterValuePresenter, + StatusSelector }, completion: { IssueQuery: async (client: Client, query: string, filter?: { in?: RelatedDocument[], nin?: RelatedDocument[] }) => @@ -497,6 +502,7 @@ export default async (): Promise => ({ IsProjectJoined: async (project: Project) => !project.private || project.members.includes(getCurrentAccount()._id) }, actionImpl: { + SelectStatus: selectStatus, Move: move, EditWorkflowStatuses: editWorkflowStatuses, EditProject: editProject,