From 673e7b88c2b9c0bfeab4ea67e16802c5885428da Mon Sep 17 00:00:00 2001 From: Sergei Ogorelkov Date: Wed, 17 May 2023 15:32:48 +0400 Subject: [PATCH] [UBER-71] Use "New issue" dialog for creating sub-issues (#3199) Signed-off-by: Sergei Ogorelkov --- .../src/components/CreateIssue.svelte | 4 - .../src/components/SubIssues.svelte | 71 +--- .../issues/edit/CreateSubIssue.svelte | 315 ------------------ .../components/issues/edit/SubIssues.svelte | 37 +- tests/sanity/tests/tracker.spec.ts | 63 +--- tests/sanity/tests/tracker.utils.ts | 42 ++- 6 files changed, 68 insertions(+), 464 deletions(-) delete mode 100644 plugins/tracker-resources/src/components/issues/edit/CreateSubIssue.svelte diff --git a/plugins/tracker-resources/src/components/CreateIssue.svelte b/plugins/tracker-resources/src/components/CreateIssue.svelte index bca41a5029..a18af8b1c5 100644 --- a/plugins/tracker-resources/src/components/CreateIssue.svelte +++ b/plugins/tracker-resources/src/components/CreateIssue.svelte @@ -404,7 +404,6 @@ draftController.remove() resetObject() descriptionBox?.removeDraft(false) - subIssuesComponent.removeChildDraft() } async function showMoreActions (ev: Event) { @@ -518,7 +517,6 @@ if (result === true) { dispatch('close') resetObject() - subIssuesComponent.removeChildDraft() draftController.remove() descriptionBox?.removeDraft(true) } @@ -624,11 +622,9 @@ diff --git a/plugins/tracker-resources/src/components/SubIssues.svelte b/plugins/tracker-resources/src/components/SubIssues.svelte index 37919a53b2..fdee09aa8c 100644 --- a/plugins/tracker-resources/src/components/SubIssues.svelte +++ b/plugins/tracker-resources/src/components/SubIssues.svelte @@ -19,27 +19,21 @@ import { DraftController, draftsStore, getClient } from '@hcengineering/presentation' import tags from '@hcengineering/tags' import { Component, Issue, IssueDraft, IssueParentInfo, Project, Milestone, calcRank } from '@hcengineering/tracker' - import { Button, ExpandCollapse, IconAdd, Scroller, closeTooltip } from '@hcengineering/ui' + import { Button, ExpandCollapse, Scroller } from '@hcengineering/ui' import { onDestroy } from 'svelte' import tracker from '../plugin' import Collapsed from './icons/Collapsed.svelte' import Expanded from './icons/Expanded.svelte' - import DraftIssueChildEditor from './templates/DraftIssueChildEditor.svelte' import DraftIssueChildList from './templates/DraftIssueChildList.svelte' - export let parendIssueId: Ref export let projectId: Ref export let project: Project | undefined export let milestone: Ref | null = null export let component: Ref | null = null export let subIssues: IssueDraft[] = [] - export let shouldSaveDraft: boolean = false - let lastProject = project + let lastProject = project let isCollapsed = false - $: isCreatingMode = $draftsStore[`${parendIssueId}_subIssue`] !== undefined - let isManualCreating = false - $: isCreating = isCreatingMode || isManualCreating async function handleIssueSwap (ev: CustomEvent<{ fromIndex: number; toIndex: number }>) { if (subIssues) { @@ -65,6 +59,7 @@ const client = getClient() + // TODO: move to utils export async function save (parents: IssueParentInfo[], _id: Ref) { if (project === undefined) return saved = true @@ -162,6 +157,7 @@ } }) + // TODO: move to utils export async function removeDraft (_id: string, removeFiles: boolean = false): Promise { const draftAttachments = $draftsStore[`${_id}_attachments`] DraftController.remove(`${_id}_attachments`) @@ -172,18 +168,11 @@ } } } - - export function removeChildDraft () { - draftChild?.removeDraft() - } - - $: hasSubIssues = subIssues.length > 0 - - let draftChild: DraftIssueChildEditor -
- {#if hasSubIssues} + +{#if subIssues.length > 0} +
-
-{#if hasSubIssues}
@@ -230,28 +199,6 @@
{/if} -{#if isCreating && project} - - { - isManualCreating = false - }} - on:create={(evt) => { - if (subIssues === undefined) { - subIssues = [] - } - subIssues = [...subIssues, evt.detail] - }} - on:changeContent - /> - -{/if} diff --git a/plugins/tracker-resources/src/components/issues/edit/SubIssues.svelte b/plugins/tracker-resources/src/components/issues/edit/SubIssues.svelte index 76aa196129..c0bb37961f 100644 --- a/plugins/tracker-resources/src/components/issues/edit/SubIssues.svelte +++ b/plugins/tracker-resources/src/components/issues/edit/SubIssues.svelte @@ -14,19 +14,19 @@ --> @@ -91,7 +91,6 @@ kind="transparent" on:click={() => { isCollapsed = !isCollapsed - isCreating = false }} > @@ -130,17 +129,16 @@