From 1b3840537a4de2237644a30ab9c2953528494a5e Mon Sep 17 00:00:00 2001 From: Sergei Ogorelkov Date: Thu, 9 Jun 2022 21:49:57 +0700 Subject: [PATCH] Add issue-id to sub-issue list (#2035) Signed-off-by: Sergei Ogorelkov --- .../SetParentIssueActionPopup.svelte | 3 +- .../components/issues/IssuePresenter.svelte | 3 +- .../src/components/issues/ParentIssue.svelte | 3 +- .../components/issues/edit/EditIssue.svelte | 3 +- .../issues/edit/SubIssueList.svelte | 35 ++++++++++++++----- .../issues/edit/SubIssueSelector.svelte | 9 ++--- .../components/issues/edit/SubIssues.svelte | 2 +- .../issues/edit/SubIssuesSelector.svelte | 16 ++++----- plugins/tracker-resources/src/utils.ts | 4 +++ 9 files changed, 48 insertions(+), 30 deletions(-) diff --git a/plugins/tracker-resources/src/components/SetParentIssueActionPopup.svelte b/plugins/tracker-resources/src/components/SetParentIssueActionPopup.svelte index d7bce7e922..56edfa975a 100644 --- a/plugins/tracker-resources/src/components/SetParentIssueActionPopup.svelte +++ b/plugins/tracker-resources/src/components/SetParentIssueActionPopup.svelte @@ -20,6 +20,7 @@ import ObjectPopup from '@anticrm/presentation/src/components/ObjectPopup.svelte' import { createEventDispatcher } from 'svelte' import tracker from '../plugin' + import { getIssueId } from '../utils' export let value: Issue export let shouldSaveOnChange = true @@ -81,7 +82,7 @@ > {@const { icon } = statusCategoryById?.get(issue.$lookup?.status.category) ?? {}} - {@const issueId = team && `${team.identifier}-${issue.number}`} + {@const issueId = team && getIssueId(team, issue)} {#if issueId && icon}
diff --git a/plugins/tracker-resources/src/components/issues/IssuePresenter.svelte b/plugins/tracker-resources/src/components/issues/IssuePresenter.svelte index e61f82eee9..2968fed47b 100644 --- a/plugins/tracker-resources/src/components/issues/IssuePresenter.svelte +++ b/plugins/tracker-resources/src/components/issues/IssuePresenter.svelte @@ -17,6 +17,7 @@ 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 @@ -33,7 +34,7 @@ $: if (!currentTeam) { spaceQuery.query(tracker.class.Team, { _id: value.space }, (res) => ([currentTeam] = res)) } - $: issueName = currentTeam && `${currentTeam.identifier}-${value.number}` + $: issueName = currentTeam && getIssueId(currentTeam, value) {#if value && shortLabel} diff --git a/plugins/tracker-resources/src/components/issues/ParentIssue.svelte b/plugins/tracker-resources/src/components/issues/ParentIssue.svelte index 9b0a0e8f6d..ee0dd30106 100644 --- a/plugins/tracker-resources/src/components/issues/ParentIssue.svelte +++ b/plugins/tracker-resources/src/components/issues/ParentIssue.svelte @@ -18,6 +18,7 @@ import { Spinner, IconClose, Tooltip } from '@anticrm/ui' import { createEventDispatcher } from 'svelte' import tracker from '../../plugin' + import { getIssueId } from '../../utils' export let issue: Issue @@ -27,7 +28,7 @@ let team: Team | undefined $: spaceQuery.query(tracker.class.Team, { _id: issue.space }, (res) => ([team] = res)) - $: issueId = team && `${team.identifier}-${issue.number}` + $: issueId = team && getIssueId(team, issue)
diff --git a/plugins/tracker-resources/src/components/issues/edit/EditIssue.svelte b/plugins/tracker-resources/src/components/issues/edit/EditIssue.svelte index f3dc1febc6..c8ac6cfc86 100644 --- a/plugins/tracker-resources/src/components/issues/edit/EditIssue.svelte +++ b/plugins/tracker-resources/src/components/issues/edit/EditIssue.svelte @@ -35,6 +35,7 @@ import { StyledTextArea } from '@anticrm/text-editor' import { createEventDispatcher, onMount } from 'svelte' import tracker from '../../../plugin' + import { getIssueId } from '../../../utils' import ControlPanel from './ControlPanel.svelte' import CopyToClipboard from './CopyToClipboard.svelte' import SubIssueSelector from './SubIssueSelector.svelte' @@ -84,7 +85,7 @@ } ) - $: issueId = currentTeam && issue && `${currentTeam.identifier}-${issue.number}` + $: issueId = currentTeam && issue && getIssueId(currentTeam, issue) $: canSave = title.trim().length > 0 $: isDescriptionEmpty = !new DOMParser().parseFromString(description, 'text/html').documentElement.innerText?.trim() diff --git a/plugins/tracker-resources/src/components/issues/edit/SubIssueList.svelte b/plugins/tracker-resources/src/components/issues/edit/SubIssueList.svelte index 46360234e5..f780171780 100644 --- a/plugins/tracker-resources/src/components/issues/edit/SubIssueList.svelte +++ b/plugins/tracker-resources/src/components/issues/edit/SubIssueList.svelte @@ -16,18 +16,20 @@ import { createEventDispatcher } from 'svelte' import { flip } from 'svelte/animate' import { WithLookup } from '@anticrm/core' - import { Issue, IssueStatus } from '@anticrm/tracker' + import { Issue, IssueStatus, Team } from '@anticrm/tracker' + import { ContextMenu } from '@anticrm/view-resources' import { showPanel, showPopup } from '@anticrm/ui' import tracker from '../../../plugin' + import { getIssueId } from '../../../utils' + import Circles from '../../icons/Circles.svelte' import ProjectEditor from '../../projects/ProjectEditor.svelte' import AssigneeEditor from '../AssigneeEditor.svelte' import DueDateEditor from '../DueDateEditor.svelte' import StatusEditor from '../StatusEditor.svelte' - import Circles from '../../icons/Circles.svelte' - import { ContextMenu } from '@anticrm/view-resources' export let issues: Issue[] export let issueStatuses: WithLookup[] + export let currentTeam: Team const dispatch = createEventDispatcher() @@ -89,20 +91,29 @@
-
- - openIssue(issue)}> +
+ openIssue(issue)}> + {getIssueId(currentTeam, issue)} + + + openIssue(issue)}> {issue.title}
-
+
{#if issue.project !== null} {/if} {#if issue.dueDate !== null} {/if} - +
{/each} @@ -112,11 +123,17 @@ position: relative; border-bottom: 1px solid var(--divider-color); - .name { + .text { font-weight: 500; color: var(--theme-caption-color); } + .name { + white-space: nowrap; + text-overflow: ellipsis; + overflow: hidden; + } + .draggable-container { position: absolute; display: flex; diff --git a/plugins/tracker-resources/src/components/issues/edit/SubIssueSelector.svelte b/plugins/tracker-resources/src/components/issues/edit/SubIssueSelector.svelte index 3016db0f97..f5e6c41cda 100644 --- a/plugins/tracker-resources/src/components/issues/edit/SubIssueSelector.svelte +++ b/plugins/tracker-resources/src/components/issues/edit/SubIssueSelector.svelte @@ -28,6 +28,7 @@ Spinner } from '@anticrm/ui' import tracker from '../../../plugin' + import { getIssueId } from '../../../utils' export let issue: WithLookup export let team: Team @@ -42,10 +43,6 @@ return issueStatuses.find((s) => issue.status === s._id)?.$lookup?.category?.icon ?? null } - function getIssueId (issue: Issue) { - return `${team.identifier}-${issue.number}` - } - function openIssue (target: Ref) { if (target !== issue._id) { showPanel(tracker.component.EditIssue, target, issue._class, 'content') @@ -68,7 +65,7 @@ value: subIssues.map((iss) => ({ id: iss._id, icon: getIssueStatusIcon(iss), - text: `${getIssueId(iss)} ${iss.title}`, + text: `${getIssueId(team, iss)} ${iss.title}`, isSelected: iss._id === issue._id })), width: 'large' @@ -109,7 +106,7 @@
{/if} - {getIssueId(parentIssue)} + {getIssueId(team, parentIssue)} {parentIssue.title}
diff --git a/plugins/tracker-resources/src/components/issues/edit/SubIssues.svelte b/plugins/tracker-resources/src/components/issues/edit/SubIssues.svelte index c461fbda2e..7d0bdb8145 100644 --- a/plugins/tracker-resources/src/components/issues/edit/SubIssues.svelte +++ b/plugins/tracker-resources/src/components/issues/edit/SubIssues.svelte @@ -90,7 +90,7 @@ {#if hasSubIssues}
- +
{/if}
diff --git a/plugins/tracker-resources/src/components/issues/edit/SubIssuesSelector.svelte b/plugins/tracker-resources/src/components/issues/edit/SubIssuesSelector.svelte index 7e9fc5466f..1ecf54cba5 100644 --- a/plugins/tracker-resources/src/components/issues/edit/SubIssuesSelector.svelte +++ b/plugins/tracker-resources/src/components/issues/edit/SubIssuesSelector.svelte @@ -19,6 +19,7 @@ import { Button, ProgressCircle, showPopup, SelectPopup, closeTooltip, showPanel } from '@anticrm/ui' import type { ButtonKind, ButtonSize } from '@anticrm/ui' import tracker from '../../../plugin' + import { getIssueId } from '../../../utils' export let issue: Issue export let currentTeam: Team | undefined @@ -49,10 +50,6 @@ return issueStatuses?.find((s) => issue.status === s._id)?.$lookup?.category?.icon ?? null } - function getIssueId (issue: Issue) { - return `${currentTeam?.identifier}-${issue.number}` - } - function openIssue (target: Ref) { if (target !== issue._id) { showPanel(tracker.component.EditIssue, target, issue._class, 'content') @@ -65,12 +62,11 @@ showPopup( SelectPopup, { - value: subIssues.map((iss) => ({ - id: iss._id, - icon: getIssueStatusIcon(iss), - text: `${getIssueId(iss)} ${iss.title}`, - isSelected: iss._id === issue._id - })), + value: subIssues.map((iss) => { + const text = currentTeam ? `${getIssueId(currentTeam, iss)} ${iss.title}` : iss.title + + return { id: iss._id, icon: getIssueStatusIcon(iss), text, isSelected: iss._id === issue._id } + }), width: 'large' }, { diff --git a/plugins/tracker-resources/src/utils.ts b/plugins/tracker-resources/src/utils.ts index 7fead2fed8..dbdb768309 100644 --- a/plugins/tracker-resources/src/utils.ts +++ b/plugins/tracker-resources/src/utils.ts @@ -378,3 +378,7 @@ export function getCategories ( return existingCategories } + +export function getIssueId (team: Team, issue: Issue): string { + return `${team.identifier}-${issue.number}` +}