mirror of
https://github.com/hcengineering/platform.git
synced 2025-04-14 20:39:03 +00:00
Tracker: add "Show Sub-issues" toggle into issue list (#2033)
Signed-off-by: Sergei Ogorelkov <sergei.ogorelkov@xored.com>
This commit is contained in:
parent
7561ea0c42
commit
e7b5d0e9b3
@ -63,6 +63,7 @@
|
|||||||
export let groupingKey: IssuesGrouping = IssuesGrouping.Status
|
export let groupingKey: IssuesGrouping = IssuesGrouping.Status
|
||||||
export let orderingKey: IssuesOrdering = IssuesOrdering.LastUpdated
|
export let orderingKey: IssuesOrdering = IssuesOrdering.LastUpdated
|
||||||
export let completedIssuesPeriod: IssuesDateModificationPeriod | null = IssuesDateModificationPeriod.All
|
export let completedIssuesPeriod: IssuesDateModificationPeriod | null = IssuesDateModificationPeriod.All
|
||||||
|
export let shouldShowSubIssues: boolean | undefined = true
|
||||||
export let shouldShowEmptyGroups: boolean | undefined = false
|
export let shouldShowEmptyGroups: boolean | undefined = false
|
||||||
export let includedGroups: Partial<Record<IssuesGroupByKeys, Array<any>>> = {}
|
export let includedGroups: Partial<Record<IssuesGroupByKeys, Array<any>>> = {}
|
||||||
export let label: string | undefined = undefined
|
export let label: string | undefined = undefined
|
||||||
@ -122,13 +123,14 @@
|
|||||||
|
|
||||||
return includedGroups[groupByKey]?.includes(x)
|
return includedGroups[groupByKey]?.includes(x)
|
||||||
})
|
})
|
||||||
$: includedIssuesQuery = getIncludedIssuesQuery(includedGroups, statuses)
|
$: includedIssuesQuery = getIncludedIssuesQuery(includedGroups, statuses, shouldShowSubIssues)
|
||||||
$: modifiedOnIssuesQuery = getModifiedOnIssuesFilterQuery(issues, completedIssuesPeriod)
|
$: modifiedOnIssuesQuery = getModifiedOnIssuesFilterQuery(issues, completedIssuesPeriod)
|
||||||
$: statuses = [...statusesById.values()]
|
$: statuses = [...statusesById.values()]
|
||||||
|
|
||||||
const getIncludedIssuesQuery = (
|
const getIncludedIssuesQuery = (
|
||||||
groups: Partial<Record<IssuesGroupByKeys, Array<any>>>,
|
groups: Partial<Record<IssuesGroupByKeys, Array<any>>>,
|
||||||
issueStatuses: IssueStatus[]
|
issueStatuses: IssueStatus[],
|
||||||
|
withSubIssues?: boolean
|
||||||
) => {
|
) => {
|
||||||
const resultMap: { [p: string]: { $in: any[] } } = {}
|
const resultMap: { [p: string]: { $in: any[] } } = {}
|
||||||
|
|
||||||
@ -137,7 +139,7 @@
|
|||||||
resultMap[key] = { $in: includedCategories }
|
resultMap[key] = { $in: includedCategories }
|
||||||
}
|
}
|
||||||
|
|
||||||
return resultMap
|
return { ...resultMap, ...(withSubIssues ? {} : { attachedTo: tracker.ids.NoParent }) }
|
||||||
}
|
}
|
||||||
|
|
||||||
const getModifiedOnIssuesFilterQuery = (
|
const getModifiedOnIssuesFilterQuery = (
|
||||||
@ -289,6 +291,7 @@
|
|||||||
orderBy: IssuesOrdering
|
orderBy: IssuesOrdering
|
||||||
groupBy: IssuesGrouping
|
groupBy: IssuesGrouping
|
||||||
completedIssuesPeriod: IssuesDateModificationPeriod
|
completedIssuesPeriod: IssuesDateModificationPeriod
|
||||||
|
shouldShowSubIssues: boolean
|
||||||
shouldShowEmptyGroups: boolean
|
shouldShowEmptyGroups: boolean
|
||||||
}
|
}
|
||||||
| undefined
|
| undefined
|
||||||
@ -304,6 +307,7 @@
|
|||||||
groupingKey = result.groupBy
|
groupingKey = result.groupBy
|
||||||
orderingKey = result.orderBy
|
orderingKey = result.orderBy
|
||||||
completedIssuesPeriod = result.completedIssuesPeriod
|
completedIssuesPeriod = result.completedIssuesPeriod
|
||||||
|
shouldShowSubIssues = result.shouldShowSubIssues
|
||||||
shouldShowEmptyGroups = result.shouldShowEmptyGroups
|
shouldShowEmptyGroups = result.shouldShowEmptyGroups
|
||||||
|
|
||||||
if (result.groupBy === IssuesGrouping.Assignee || result.groupBy === IssuesGrouping.NoGrouping) {
|
if (result.groupBy === IssuesGrouping.Assignee || result.groupBy === IssuesGrouping.NoGrouping) {
|
||||||
@ -318,7 +322,7 @@
|
|||||||
|
|
||||||
showPopup(
|
showPopup(
|
||||||
ViewOptionsPopup,
|
ViewOptionsPopup,
|
||||||
{ groupBy: groupingKey, orderBy: orderingKey, completedIssuesPeriod, shouldShowEmptyGroups },
|
{ groupBy: groupingKey, orderBy: orderingKey, completedIssuesPeriod, shouldShowSubIssues, shouldShowEmptyGroups },
|
||||||
eventToHTMLElement(event),
|
eventToHTMLElement(event),
|
||||||
undefined,
|
undefined,
|
||||||
handleOptionsUpdated
|
handleOptionsUpdated
|
||||||
|
@ -25,13 +25,14 @@
|
|||||||
export let groupBy: IssuesGrouping | undefined = undefined
|
export let groupBy: IssuesGrouping | undefined = undefined
|
||||||
export let orderBy: IssuesOrdering | undefined = undefined
|
export let orderBy: IssuesOrdering | undefined = undefined
|
||||||
export let completedIssuesPeriod: IssuesDateModificationPeriod | null = null
|
export let completedIssuesPeriod: IssuesDateModificationPeriod | null = null
|
||||||
|
export let shouldShowSubIssues: boolean | undefined = false
|
||||||
export let shouldShowEmptyGroups: boolean | undefined = false
|
export let shouldShowEmptyGroups: boolean | undefined = false
|
||||||
|
|
||||||
const groupByItems = issuesGroupByOptions
|
const groupByItems = issuesGroupByOptions
|
||||||
const orderByItems = issuesOrderByOptions
|
const orderByItems = issuesOrderByOptions
|
||||||
const dateModificationPeriodItems = issuesDateModificationPeriodOptions
|
const dateModificationPeriodItems = issuesDateModificationPeriodOptions
|
||||||
|
|
||||||
$: dispatch('update', { groupBy, orderBy, completedIssuesPeriod, shouldShowEmptyGroups })
|
$: dispatch('update', { groupBy, orderBy, completedIssuesPeriod, shouldShowSubIssues, shouldShowEmptyGroups })
|
||||||
</script>
|
</script>
|
||||||
|
|
||||||
<div class="root">
|
<div class="root">
|
||||||
@ -64,6 +65,14 @@
|
|||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
{/if}
|
{/if}
|
||||||
|
<div class="viewOption">
|
||||||
|
<div class="label">
|
||||||
|
<Label label={tracker.string.SubIssues} />
|
||||||
|
</div>
|
||||||
|
<div class="optionContainer">
|
||||||
|
<MiniToggle bind:on={shouldShowSubIssues} />
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
{#if groupBy === IssuesGrouping.Status || groupBy === IssuesGrouping.Priority}
|
{#if groupBy === IssuesGrouping.Status || groupBy === IssuesGrouping.Priority}
|
||||||
<div class="viewOption">
|
<div class="viewOption">
|
||||||
<div class="label">
|
<div class="label">
|
||||||
|
Loading…
Reference in New Issue
Block a user