UBERF-5335 (#4655)

Signed-off-by: Denis Bykhov <bykhov.denis@gmail.com>
This commit is contained in:
Denis Bykhov
2024-02-16 01:24:03 +07:00
committed by GitHub
parent e8dd69dcef
commit 9b0e67b0ee
5 changed files with 55 additions and 23 deletions
@@ -50,6 +50,7 @@
Component as ComponentType,
Issue,
IssueDraft,
IssueParentInfo,
IssuePriority,
IssueStatus,
IssueTemplate,
@@ -422,6 +423,8 @@
const number = (incResult as any).object.sequence
const identifier = `${currentProject?.identifier}-${number}`
const value: DocData<Issue> = {
title: getTitle(object.title),
description: object.description,
@@ -438,7 +441,7 @@
parents:
parentIssue != null
? [
{ parentId: parentIssue._id, parentTitle: parentIssue.title, space: parentIssue.space },
{ parentId: parentIssue._id, parentTitle: parentIssue.title, space: parentIssue.space, identifier },
...parentIssue.parents
]
: [],
@@ -449,7 +452,7 @@
relations: relatedTo !== undefined ? [{ _id: relatedTo._id, _class: relatedTo._class }] : [],
childInfo: [],
kind,
identifier: `${currentProject?.identifier}-${number}`
identifier
}
await docCreateManager.commit(operations, _id, _space, value)
@@ -486,13 +489,13 @@
await operations.commit()
await descriptionBox.createAttachments(_id)
const parents = parentIssue
const parents: IssueParentInfo[] = parentIssue
? [
{ parentId: _id, parentTitle: value.title, space: parentIssue.space },
{ parentId: parentIssue._id, parentTitle: parentIssue.title, space: parentIssue.space },
{ parentId: _id, parentTitle: value.title, space: parentIssue.space, identifier },
{ parentId: parentIssue._id, parentTitle: parentIssue.title, space: parentIssue.space, identifier },
...parentIssue.parents
]
: [{ parentId: _id, parentTitle: value.title, space: _space }]
: [{ parentId: _id, parentTitle: value.title, space: _space, identifier }]
await subIssuesComponent.save(parents, _id)
addNotification(
await translate(tracker.string.IssueCreated, {}, $themeStore.language),
@@ -13,17 +13,20 @@
// limitations under the License.
-->
<script lang="ts">
import type { Issue, IssueParentInfo } from '@hcengineering/tracker'
import { showPanel } from '@hcengineering/ui'
import tracker from '../../plugin'
import { NavLink } from '@hcengineering/presentation'
import { trackerId, type Issue, type IssueParentInfo } from '@hcengineering/tracker'
import { getCurrentLocation, locationToUrl } from '@hcengineering/ui'
export let value: Issue | undefined
export let maxWidth = ''
function handleIssueEditorOpened (parent: IssueParentInfo) {
if (value === undefined) return
showPanel(tracker.component.EditIssue, parent.parentId, value._class, 'content')
function getHref (parentInfo: IssueParentInfo) {
const loc = getCurrentLocation()
loc.path[2] = trackerId
loc.path[3] = parentInfo.identifier
loc.path.length = 4
return `${window.location.origin}${locationToUrl(loc)}`
}
</script>
@@ -33,15 +36,11 @@
{#each value.parents as parentInfo}
<!-- svelte-ignore a11y-click-events-have-key-events -->
<!-- svelte-ignore a11y-no-static-element-interactions -->
<span
class="parent-label overflow-label cursor-pointer"
title={parentInfo.parentTitle}
on:click={() => {
handleIssueEditorOpened(parentInfo)
}}
>
{parentInfo.parentTitle}
</span>
<NavLink href={getHref(parentInfo)}>
<span class="parent-label overflow-label cursor-pointer" title={parentInfo.parentTitle}>
{parentInfo.parentTitle}
</span>
</NavLink>
{/each}
</span>
</div>
@@ -61,6 +60,7 @@
.parent-label {
flex-shrink: 5;
color: var(--theme-dark-color);
&:hover {
color: var(--theme-caption-color);