From bc27d42542aec72a1a957d837eab5e2051e5f815 Mon Sep 17 00:00:00 2001 From: Andrey Sobolev Date: Mon, 10 Oct 2022 13:35:27 +0700 Subject: [PATCH] Unify related issue creation and few fixes (#2289) Signed-off-by: Andrey Sobolev --- .../ui/src/components/PopupInstance.svelte | 2 +- .../src/components/ChannelsDropdown.svelte | 4 +- .../src/components/EditVacancy.svelte | 11 +- plugins/tracker-assets/lang/ru.json | 1 + .../src/components/CreateIssue.svelte | 2 + .../issues/edit/ControlPanel.svelte | 21 ++ .../issues/edit/SubIssueList.svelte | 7 +- .../issues/related/CreateRelatedIssue.svelte | 261 ------------------ .../issues/related/RelatedIssues.svelte | 18 -- .../src/components/myissues/MyIssues.svelte | 2 +- plugins/tracker-resources/src/plugin.ts | 1 - plugins/tracker-resources/src/utils.ts | 10 +- plugins/tracker/src/index.ts | 3 +- 13 files changed, 38 insertions(+), 305 deletions(-) delete mode 100644 plugins/tracker-resources/src/components/issues/related/CreateRelatedIssue.svelte diff --git a/packages/ui/src/components/PopupInstance.svelte b/packages/ui/src/components/PopupInstance.svelte index aaf76c4e95..edbfb5a717 100644 --- a/packages/ui/src/components/PopupInstance.svelte +++ b/packages/ui/src/components/PopupInstance.svelte @@ -120,7 +120,7 @@ on:update={(ev) => { _update(ev.detail) }} - on:close={(ev) => _close(ev.detail)} + on:close={(ev) => _close(ev?.detail)} on:fullsize={() => { fullSize = !fullSize }} diff --git a/plugins/contact-resources/src/components/ChannelsDropdown.svelte b/plugins/contact-resources/src/components/ChannelsDropdown.svelte index e148d2023f..f8f04cf209 100644 --- a/plugins/contact-resources/src/components/ChannelsDropdown.svelte +++ b/plugins/contact-resources/src/components/ChannelsDropdown.svelte @@ -194,7 +194,7 @@ if (result === '') { displayItems = dropItem(n) } else { - if (result !== 'open') displayItems[n].value = result + if (result !== 'open') item.value = result } saveItems() focusManager?.setFocusPos(focusIndex + 1 + n) @@ -208,7 +208,7 @@ if (result === '') { displayItems = dropItem(n) } else { - displayItems[n].value = result + item.value = result } saveItems() } diff --git a/plugins/recruit-resources/src/components/EditVacancy.svelte b/plugins/recruit-resources/src/components/EditVacancy.svelte index 09300f88f8..3c21ac3dd9 100644 --- a/plugins/recruit-resources/src/components/EditVacancy.svelte +++ b/plugins/recruit-resources/src/components/EditVacancy.svelte @@ -59,7 +59,6 @@ showPopup(ContextMenu, { object }, (ev as MouseEvent).target as HTMLElement) } } - let isCreateIssue = false {#if object} @@ -150,19 +149,13 @@ kind={'transparent'} size={'small'} on:click={() => { - isCreateIssue = true + showPopup(tracker.component.CreateIssue, { relatedTo: object, space: object.space }, 'top') }} />
- { - isCreateIssue = false - }} - /> +
diff --git a/plugins/tracker-assets/lang/ru.json b/plugins/tracker-assets/lang/ru.json index 1e9737e5d6..81dd13ad9c 100644 --- a/plugins/tracker-assets/lang/ru.json +++ b/plugins/tracker-assets/lang/ru.json @@ -222,6 +222,7 @@ "IssueTemplate": "Процесс", "IssueTemplates": "Процессы", "NewProcess": "Новый процесс", + "SaveProcess": "Сохранить процесс", "NoIssueTemplate": "Без процесса", "TemplateReplace": "Вы хотите заменить выбранный процесс?", "TemplateReplaceConfirm": "Все внесенные изменения в задачу будут потеряны" diff --git a/plugins/tracker-resources/src/components/CreateIssue.svelte b/plugins/tracker-resources/src/components/CreateIssue.svelte index 4dedc606d8..eebae157d3 100644 --- a/plugins/tracker-resources/src/components/CreateIssue.svelte +++ b/plugins/tracker-resources/src/components/CreateIssue.svelte @@ -94,6 +94,8 @@ } function resetObject (): void { + templateId = undefined + template = undefined object = { title: '', description: '', diff --git a/plugins/tracker-resources/src/components/issues/edit/ControlPanel.svelte b/plugins/tracker-resources/src/components/issues/edit/ControlPanel.svelte index ec79be790b..ae670cbd99 100644 --- a/plugins/tracker-resources/src/components/issues/edit/ControlPanel.svelte +++ b/plugins/tracker-resources/src/components/issues/edit/ControlPanel.svelte @@ -18,6 +18,7 @@ import tags from '@hcengineering/tags' import type { Issue, IssueStatus } from '@hcengineering/tracker' import { Component, Label } from '@hcengineering/ui' + import { ObjectBox } from '@hcengineering/view-resources' import { getFiltredKeys, isCollectionAttr } from '@hcengineering/view-resources/src/utils' import tracker from '../../../plugin' import ProjectEditor from '../../projects/ProjectEditor.svelte' @@ -53,6 +54,26 @@
+ {#if issue.template?.template} + + + + {/if} + diff --git a/plugins/tracker-resources/src/components/issues/edit/SubIssueList.svelte b/plugins/tracker-resources/src/components/issues/edit/SubIssueList.svelte index 4ab1354f97..c93b64af3c 100644 --- a/plugins/tracker-resources/src/components/issues/edit/SubIssueList.svelte +++ b/plugins/tracker-resources/src/components/issues/edit/SubIssueList.svelte @@ -75,12 +75,7 @@ showPopup(ContextMenu, { object }, getEventPositionElement(ev)) } - const listProvider = new ListSelectionProvider((offset: 1 | -1 | 0, of?: Doc, dir?: SelectDirection) => { - // if (dir === 'vertical') { - // // Select next - // table.select(offset, of) - // } - }) + const listProvider = new ListSelectionProvider((offset: 1 | -1 | 0, of?: Doc, dir?: SelectDirection) => {}) let varsStyle: string = '' const propsWidth: Record = { issue: 0 } diff --git a/plugins/tracker-resources/src/components/issues/related/CreateRelatedIssue.svelte b/plugins/tracker-resources/src/components/issues/related/CreateRelatedIssue.svelte deleted file mode 100644 index 67e2da8ce0..0000000000 --- a/plugins/tracker-resources/src/components/issues/related/CreateRelatedIssue.svelte +++ /dev/null @@ -1,261 +0,0 @@ - - - -
-
-
- (newIssue.status = detail)} - /> -
-
- -
- {#key newIssue.description} - - {/key} -
-
-
-
-
- - (newIssue.priority = detail)} - /> - {#key newIssue.assignee} - (newIssue.assignee = detail)} - /> - {/key} - { - addTagRef(evt.detail) - }} - on:delete={(evt) => { - labels = labels.filter((it) => it._id !== evt.detail) - }} - /> - -
-
-
-
-
- - diff --git a/plugins/tracker-resources/src/components/issues/related/RelatedIssues.svelte b/plugins/tracker-resources/src/components/issues/related/RelatedIssues.svelte index 7d13c0a6a4..624bf42dbf 100644 --- a/plugins/tracker-resources/src/components/issues/related/RelatedIssues.svelte +++ b/plugins/tracker-resources/src/components/issues/related/RelatedIssues.svelte @@ -17,20 +17,16 @@ import presentation, { createQuery, getClient } from '@hcengineering/presentation' import { calcRank, Issue, IssueStatus, Team } from '@hcengineering/tracker' import { Label, Spinner } from '@hcengineering/ui' - import { createEventDispatcher } from 'svelte' import tracker from '../../../plugin' import SubIssueList from '../edit/SubIssueList.svelte' - import CreateRelatedIssue from './CreateRelatedIssue.svelte' export let object: Doc - export let isCreating = false let query: DocumentQuery $: query = { 'relations._id': object._id, 'relations._class': object._class } const subIssuesQuery = createQuery() const client = getClient() - const dispatch = createEventDispatcher() let subIssues: Issue[] = [] @@ -87,20 +83,6 @@
{/if} - - {#if isCreating} -
- { - isCreating = false - dispatch('close') - }} - /> -
- {/if} {:else}
diff --git a/plugins/tracker-resources/src/components/myissues/MyIssues.svelte b/plugins/tracker-resources/src/components/myissues/MyIssues.svelte index 297c80269c..fa9bc2a7b1 100644 --- a/plugins/tracker-resources/src/components/myissues/MyIssues.svelte +++ b/plugins/tracker-resources/src/components/myissues/MyIssues.svelte @@ -36,7 +36,7 @@ let created = { _id: { $in: [] as Ref[] } } let subscribed = { _id: { $in: [] as Ref[] } } - const viewOptionsConfig: ViewOptionModel[] = getDefaultViewOptionsConfig(false) + const viewOptionsConfig: ViewOptionModel[] = getDefaultViewOptionsConfig(true) const createdQuery = createQuery() $: createdQuery.query>( diff --git a/plugins/tracker-resources/src/plugin.ts b/plugins/tracker-resources/src/plugin.ts index 0275a643b0..fca4e5f01e 100644 --- a/plugins/tracker-resources/src/plugin.ts +++ b/plugins/tracker-resources/src/plugin.ts @@ -283,7 +283,6 @@ export default mergeIds(trackerId, tracker, { TeamProjects: '' as AnyComponent, IssuePreview: '' as AnyComponent, RelationsPopup: '' as AnyComponent, - CreateIssue: '' as AnyComponent, Sprints: '' as AnyComponent, SprintPresenter: '' as AnyComponent, diff --git a/plugins/tracker-resources/src/utils.ts b/plugins/tracker-resources/src/utils.ts index d8fef0a9b9..86bd36a98f 100644 --- a/plugins/tracker-resources/src/utils.ts +++ b/plugins/tracker-resources/src/utils.ts @@ -510,7 +510,7 @@ export async function getPriorityStates (): Promise { ) } -export function getDefaultViewOptionsConfig (enableSubIssues = true): ViewOptionModel[] { +export function getDefaultViewOptionsConfig (subIssuesValue = false): ViewOptionModel[] { const groupByCategory: ViewOptionModel = { key: 'groupBy', label: tracker.string.Grouping, @@ -541,7 +541,7 @@ export function getDefaultViewOptionsConfig (enableSubIssues = true): ViewOption const showSubIssuesCategory: ViewOptionModel = { key: 'shouldShowSubIssues', label: tracker.string.SubIssues, - defaultValue: false, + defaultValue: subIssuesValue, type: 'toggle' } const showEmptyGroups: ViewOptionModel = { @@ -552,9 +552,9 @@ export function getDefaultViewOptionsConfig (enableSubIssues = true): ViewOption hidden: ({ groupBy }) => !['status', 'priority'].includes(groupBy) } const result: ViewOptionModel[] = [groupByCategory, orderByCategory] - if (enableSubIssues) { - result.push(showSubIssuesCategory) - } + + result.push(showSubIssuesCategory) + result.push(showEmptyGroups) return result } diff --git a/plugins/tracker/src/index.ts b/plugins/tracker/src/index.ts index f4510ad438..a6d5def902 100644 --- a/plugins/tracker/src/index.ts +++ b/plugins/tracker/src/index.ts @@ -344,7 +344,8 @@ export default plugin(trackerId, { Tracker: '' as AnyComponent, TrackerApp: '' as AnyComponent, RelatedIssues: '' as AnyComponent, - EditIssue: '' as AnyComponent + EditIssue: '' as AnyComponent, + CreateIssue: '' as AnyComponent }, issueStatusCategory: { Backlog: '' as Ref,