UBERF-9264: Fix set/unset parent issue (#7799)

Signed-off-by: Andrey Sobolev <haiodo@gmail.com>
This commit is contained in:
Andrey Sobolev
2025-01-27 15:14:54 +05:00
committed by GitHub
parent 83a912d716
commit 331aa7f78f
20 changed files with 133 additions and 51 deletions
@@ -66,24 +66,13 @@
$: selected = !Array.isArray(value) ? ('attachedTo' in value ? value.attachedTo : undefined) : undefined
$: ignoreObjects = !Array.isArray(value) ? ('_id' in value ? [value._id] : []) : undefined
$: docQuery = {
'parents.parentId': {
$nin: [
...new Set(
(Array.isArray(value) ? value : [value])
.map((issue) => ('_id' in issue ? issue._id : null))
.filter((x): x is Ref<Issue> => x !== null)
)
]
}
}
</script>
<ObjectPopup
_class={tracker.class.Issue}
{options}
{docQuery}
{selected}
category={tracker.completion.IssueCategory}
multiSelect={false}
allowDeselect={true}
placeholder={tracker.string.SetParent}
@@ -91,7 +80,7 @@
{ignoreObjects}
shadows={true}
{width}
searchMode={'fulltext'}
searchMode={'spotlight'}
on:update
on:close={onClose}
>
@@ -175,6 +175,13 @@
$: taskType = issue?.kind !== undefined ? $taskTypeStore.get(issue?.kind) : undefined
$: projectType = taskType?.parent !== undefined ? $typeStore.get(taskType.parent) : undefined
async function unsetParentIssue (): Promise<void> {
if (issue === undefined || readonly) return
await client.update(issue, { attachedTo: tracker.ids.NoParent })
Analytics.handleEvent(TrackerEvents.IssueParentUnset, { issue: issue.identifier ?? issue._id })
}
</script>
{#if !embedded}
@@ -276,8 +283,22 @@
</svelte:fragment>
{#if hasParentIssue}
<div class="mb-6">
<div class="mb-6 flex-row-center">
<SubIssueSelector {issue} />
{#if !readonly}
<div class="ml-2">
<Button
icon={tracker.icon.UnsetParent}
iconProps={{ size: 'medium' }}
kind={'regular'}
showTooltip={{ label: tracker.string.UnsetParentIssue }}
dataId={'btnUnsetParent'}
on:click={() => {
void unsetParentIssue()
}}
/>
</div>
{/if}
</div>
{/if}
<EditBox