Fix TSK-101 navigation (#2068)

Signed-off-by: Andrey Sobolev <haiodo@gmail.com>
This commit is contained in:
Andrey Sobolev
2022-06-14 23:54:25 +07:00
committed by GitHub
parent 5d33062176
commit 665ef78199
14 changed files with 244 additions and 151 deletions
@@ -69,7 +69,11 @@
const options: FindOptions<Issue> = {
lookup: {
assignee: contact.class.Employee
assignee: contact.class.Employee,
space: tracker.class.Team,
_id: {
subIssues: tracker.class.Issue
}
}
}
@@ -157,7 +161,7 @@
}}
>
<div class="flex-col mr-6">
<IssuePresenter value={object} {currentTeam} />
<IssuePresenter value={object} />
<span class="fs-bold caption-color mt-1 lines-limit-2">
{object.title}
</span>
@@ -13,40 +13,29 @@
// limitations under the License.
-->
<script lang="ts">
import { createQuery, getClient } from '@anticrm/presentation'
import { WithLookup } from '@anticrm/core'
import type { Issue, Team } from '@anticrm/tracker'
import { Icon, showPanel } from '@anticrm/ui'
import tracker from '../../plugin'
import { getIssueId } from '../../utils'
export let value: Issue
export let currentTeam: Team | undefined
export let value: WithLookup<Issue>
export let inline: boolean = false
const client = getClient()
const spaceQuery = createQuery()
const shortLabel = client.getHierarchy().getClass(value._class).shortLabel
function handleIssueEditorOpened () {
showPanel(tracker.component.EditIssue, value._id, value._class, 'content')
}
$: if (!currentTeam) {
spaceQuery.query(tracker.class.Team, { _id: value.space }, (res) => ([currentTeam] = res))
} else {
spaceQuery.unsubscribe()
}
$: issueName = currentTeam && getIssueId(currentTeam, value)
$: title = `${(value?.$lookup?.space as Team)?.identifier}-${value.number}`
</script>
{#if value && shortLabel}
{#if value}
<div class="flex-presenter issuePresenterRoot" class:inline-presenter={inline} on:click={handleIssueEditorOpened}>
<div class="icon">
<Icon icon={tracker.icon.Issue} size={'small'} />
</div>
{#if issueName !== undefined}
<span title={issueName} class="label nowrap issueLabel">{issueName}</span>
{/if}
<span title="title" class="label nowrap issueLabel">
{title}
</span>
</div>
{/if}
@@ -91,7 +91,11 @@
const options: FindOptions<Issue> = {
sort: { [issuesOrderKeyMap[orderingKey]]: issuesSortOrderMap[issuesOrderKeyMap[orderingKey]] },
limit: ENTRIES_LIMIT,
lookup: { assignee: contact.class.Employee, status: tracker.class.IssueStatus }
lookup: {
assignee: contact.class.Employee,
status: tracker.class.IssueStatus,
space: tracker.class.Team
}
}
$: baseQuery = {
@@ -57,7 +57,8 @@
const baseOptions: FindOptions<Issue> = {
lookup: {
assignee: contact.class.Employee,
status: tracker.class.IssueStatus
status: tracker.class.IssueStatus,
space: tracker.class.Team
}
}
@@ -54,7 +54,11 @@
{
sort: { [orderByKey]: issuesSortOrderMap[orderByKey] },
limit: 200,
lookup: { assignee: contact.class.Employee, status: tracker.class.IssueStatus }
lookup: {
assignee: contact.class.Employee,
status: tracker.class.IssueStatus,
space: tracker.class.Team
}
}
)
</script>
@@ -13,15 +13,14 @@
// limitations under the License.
-->
<script lang="ts">
import { SortingOrder, WithLookup, Ref, Doc } from '@anticrm/core'
import { createQuery } from '@anticrm/presentation'
import { Doc, Ref, WithLookup } from '@anticrm/core'
import { Issue, IssueStatus, Team } from '@anticrm/tracker'
import { Button, ProgressCircle, showPopup, SelectPopup, closeTooltip, showPanel } from '@anticrm/ui'
import type { ButtonKind, ButtonSize } from '@anticrm/ui'
import { Button, closeTooltip, ProgressCircle, SelectPopup, showPanel, showPopup } from '@anticrm/ui'
import tracker from '../../../plugin'
import { getIssueId } from '../../../utils'
export let issue: Issue
export let issue: WithLookup<Issue>
export let currentTeam: Team | undefined
export let issueStatuses: WithLookup<IssueStatus>[] | undefined
@@ -30,7 +29,6 @@
export let justify: 'left' | 'center' = 'left'
export let width: string | undefined = 'min-contet'
const subIssuesQuery = createQuery()
let btn: HTMLElement
let subIssues: Issue[] | undefined
@@ -38,9 +36,10 @@
let countComplate: number = 0
$: hasSubIssues = issue.subIssues > 0
$: subIssuesQuery.query(tracker.class.Issue, { attachedTo: issue._id }, async (result) => (subIssues = result), {
sort: { rank: SortingOrder.Ascending }
})
$: if (issue.$lookup?.subIssues !== undefined) {
subIssues = issue.$lookup.subIssues as Issue[]
subIssues.sort((a, b) => a.rank.localeCompare(b.rank))
}
$: if (issueStatuses && subIssues) {
doneStatus = issueStatuses.find((s) => s.category === tracker.issueStatusCategory.Completed)?._id ?? undefined
if (doneStatus) countComplate = subIssues.filter((si) => si.status === doneStatus).length