From 5b534391b954267f362aa510d97a8d94a0521f21 Mon Sep 17 00:00:00 2001 From: Sergei Ogorelkov Date: Fri, 17 Jun 2022 15:28:31 +0700 Subject: [PATCH] Tracker: fix status editor (#2097) Signed-off-by: Sergei Ogorelkov --- .../src/components/CreateIssue.svelte | 2 - .../src/components/PrioritySelector.svelte | 57 ---------------- .../src/components/StatusSelector.svelte | 65 ------------------- .../src/components/issues/Board.svelte | 9 +-- .../components/issues/IssuesContent.svelte | 2 +- .../src/components/issues/IssuesList.svelte | 2 + .../src/components/issues/KanbanView.svelte | 9 +-- .../components/issues/PriorityEditor.svelte | 49 +++++++++----- .../src/components/issues/StatusEditor.svelte | 60 ++++++++++++----- .../issues/edit/CreateSubIssue.svelte | 5 +- .../issues/edit/SubIssueList.svelte | 14 +++- 11 files changed, 93 insertions(+), 181 deletions(-) delete mode 100644 plugins/tracker-resources/src/components/PrioritySelector.svelte delete mode 100644 plugins/tracker-resources/src/components/StatusSelector.svelte diff --git a/plugins/tracker-resources/src/components/CreateIssue.svelte b/plugins/tracker-resources/src/components/CreateIssue.svelte index 28368cb5d5..8fd20e7962 100644 --- a/plugins/tracker-resources/src/components/CreateIssue.svelte +++ b/plugins/tracker-resources/src/components/CreateIssue.svelte @@ -250,7 +250,6 @@ value={object} statuses={issueStatuses} kind="no-border" - width="min-content" size="small" shouldShowLabel={true} on:change={({ detail }) => (object.status = detail)} @@ -262,7 +261,6 @@ kind="no-border" size="small" justify="center" - width="" on:change={({ detail }) => (object.priority = detail)} /> - - - diff --git a/plugins/tracker-resources/src/components/issues/Board.svelte b/plugins/tracker-resources/src/components/issues/Board.svelte index 5ee2a275de..f40e90dfb6 100644 --- a/plugins/tracker-resources/src/components/issues/Board.svelte +++ b/plugins/tracker-resources/src/components/issues/Board.svelte @@ -182,14 +182,7 @@ {#if issue && issueStatuses && issue.subIssues > 0} {/if} - + = new Map([ ['@currentTeam', { key: '', presenter: tracker.component.IssuePresenter, props: { currentTeam } }], - ['@statuses', { key: '', presenter: tracker.component.StatusEditor, props: { statuses } }] + ['@statuses', { key: '', presenter: tracker.component.StatusEditor, props: { statuses, justify: 'center' } }] ]) function createConfig (descr: Viewlet, preference: ViewletPreference | undefined): (string | BuildModelKey)[] { diff --git a/plugins/tracker-resources/src/components/issues/IssuesList.svelte b/plugins/tracker-resources/src/components/issues/IssuesList.svelte index 4d3e4f4628..e0849dbc8d 100644 --- a/plugins/tracker-resources/src/components/issues/IssuesList.svelte +++ b/plugins/tracker-resources/src/components/issues/IssuesList.svelte @@ -232,6 +232,7 @@ @@ -256,6 +257,7 @@ this={attributeModel.presenter} value={getObjectValue(attributeModel.key, docObject) ?? ''} issueId={docObject._id} + width="100%" {...attributeModel.props} /> diff --git a/plugins/tracker-resources/src/components/issues/KanbanView.svelte b/plugins/tracker-resources/src/components/issues/KanbanView.svelte index abf85b1b15..6305c23c90 100644 --- a/plugins/tracker-resources/src/components/issues/KanbanView.svelte +++ b/plugins/tracker-resources/src/components/issues/KanbanView.svelte @@ -194,14 +194,7 @@ {#if issue && issueStatuses && issue.subIssues > 0} {/if} - + export let isEditable: boolean = true @@ -29,12 +29,28 @@ export let kind: ButtonKind = 'link' export let size: ButtonSize = 'large' export let justify: 'left' | 'center' = 'left' - export let width: string | undefined = '100%' + export let width: string | undefined = undefined const client = getClient() const dispatch = createEventDispatcher() + const prioritiesInfo = defaultPriorities.map((p) => ({ id: p, ...issuePriorities[p] })) - const handlePriorityChanged = async (newPriority: IssuePriority | undefined) => { + const handlePriorityEditorOpened = (event: MouseEvent) => { + event.stopPropagation() + + if (!isEditable) { + return + } + + showPopup( + SelectPopup, + { value: prioritiesInfo, placeholder: tracker.string.SetPriority, searchable: true }, + eventToHTMLElement(event), + changePriority + ) + } + + const changePriority = async (newPriority: IssuePriority | undefined) => { if (!isEditable || newPriority === undefined || value.priority === newPriority) { return } @@ -48,16 +64,15 @@ {#if value} -
- -
+ + {:else} +