From f1fad745bdfad5ddb3a7e5e1719199acb8c8fe06 Mon Sep 17 00:00:00 2001 From: Andrey Sobolev Date: Tue, 23 Aug 2022 01:55:45 +0700 Subject: [PATCH] Tracker fixes (#2255) Signed-off-by: Andrey Sobolev --- .../workspace/avatar_2021-11-09-17-00.json | 10 --- models/tracker/src/index.ts | 2 + models/tracker/src/plugin.ts | 3 +- packages/core/package.json | 2 +- .../components/issues/GrowPresenter.svelte | 16 +++++ .../src/components/issues/IssuesList.svelte | 35 +++++++--- .../src/components/issues/KanbanView.svelte | 2 +- .../src/components/issues/ListView.svelte | 5 +- .../components/issues/TitlePresenter.svelte | 4 +- .../issues/edit/SubIssuesSelector.svelte | 22 +++--- .../issues/timereport/EstimationEditor.svelte | 2 +- .../EstimationProgressCircle.svelte | 24 ++++--- .../timereport/TimeSpendReportPopup.svelte | 2 +- .../components/projects/EditProject.svelte | 6 +- .../components/projects/ProjectEditor.svelte | 2 +- .../src/components/projects/Projects.svelte | 13 ++-- .../components/sprints/SprintEditor.svelte | 67 +++++++++++++------ plugins/tracker-resources/src/index.ts | 6 +- plugins/tracker-resources/src/plugin.ts | 3 +- .../src/components/FixedColumn.svelte | 2 +- .../src/components/Table.svelte | 4 +- server-plugins/tracker-resources/src/index.ts | 47 +++++++++---- server/mongo/src/storage.ts | 25 +++++-- 23 files changed, 202 insertions(+), 102 deletions(-) delete mode 100644 common/changes/@anticrm/workspace/avatar_2021-11-09-17-00.json create mode 100644 plugins/tracker-resources/src/components/issues/GrowPresenter.svelte diff --git a/common/changes/@anticrm/workspace/avatar_2021-11-09-17-00.json b/common/changes/@anticrm/workspace/avatar_2021-11-09-17-00.json deleted file mode 100644 index 999c4c9f6f..0000000000 --- a/common/changes/@anticrm/workspace/avatar_2021-11-09-17-00.json +++ /dev/null @@ -1,10 +0,0 @@ -{ - "changes": [ - { - "packageName": "@anticrm/workspace", - "comment": "", - "type": "none" - } - ], - "packageName": "@anticrm/workspace" -} \ No newline at end of file diff --git a/models/tracker/src/index.ts b/models/tracker/src/index.ts index 73641929b2..9295c22f1e 100644 --- a/models/tracker/src/index.ts +++ b/models/tracker/src/index.ts @@ -394,6 +394,8 @@ export function createModel (builder: Builder): void { props: { kind: 'list', size: 'small', justify: 'center' } }, { key: '', presenter: tracker.component.TitlePresenter, props: { shouldUseMargin: true, fixed: 'left' } }, + { key: '', presenter: tracker.component.SubIssuesSelector, props: {} }, + { key: '', presenter: tracker.component.GrowPresenter, props: {} }, { key: '', presenter: tracker.component.DueDatePresenter, props: { kind: 'list' } }, { key: '', diff --git a/models/tracker/src/plugin.ts b/models/tracker/src/plugin.ts index d9def947ad..0a0e07fb1a 100644 --- a/models/tracker/src/plugin.ts +++ b/models/tracker/src/plugin.ts @@ -38,7 +38,8 @@ export default mergeIds(trackerId, tracker, { component: { // Required to pass build without errorsF Nope: '' as AnyComponent, - SprintSelector: '' as AnyComponent + SprintSelector: '' as AnyComponent, + SubIssuesSelector: '' as AnyComponent }, app: { Tracker: '' as Ref diff --git a/packages/core/package.json b/packages/core/package.json index ad2b24c628..65dc7ea897 100644 --- a/packages/core/package.json +++ b/packages/core/package.json @@ -1,6 +1,6 @@ { "name": "@anticrm/core", - "version": "0.6.16", + "version": "0.6.17", "main": "lib/index.js", "author": "Anticrm Platform Contributors", "license": "EPL-2.0", diff --git a/plugins/tracker-resources/src/components/issues/GrowPresenter.svelte b/plugins/tracker-resources/src/components/issues/GrowPresenter.svelte new file mode 100644 index 0000000000..178464dd6a --- /dev/null +++ b/plugins/tracker-resources/src/components/issues/GrowPresenter.svelte @@ -0,0 +1,16 @@ + + + diff --git a/plugins/tracker-resources/src/components/issues/IssuesList.svelte b/plugins/tracker-resources/src/components/issues/IssuesList.svelte index a24cc41bcd..4c964cd838 100644 --- a/plugins/tracker-resources/src/components/issues/IssuesList.svelte +++ b/plugins/tracker-resources/src/components/issues/IssuesList.svelte @@ -16,7 +16,7 @@ import contact, { Employee } from '@anticrm/contact' import { Class, Doc, FindOptions, getObjectValue, Ref, WithLookup } from '@anticrm/core' import notification from '@anticrm/notification' - import { getClient } from '@anticrm/presentation' + import { createQuery, getClient } from '@anticrm/presentation' import { Issue, IssueStatus, Team } from '@anticrm/tracker' import { Button, @@ -36,6 +36,7 @@ import tracker from '../../plugin' import { IssuesGroupByKeys, issuesGroupEditorMap, IssuesOrderByKeys, issuesSortOrderMap } from '../../utils' import CreateIssue from '../CreateIssue.svelte' + import GrowPresenter from './GrowPresenter.svelte' export let _class: Ref> export let currentSpace: Ref | undefined = undefined @@ -59,10 +60,19 @@ lookup: { assignee: contact.class.Employee, status: tracker.class.IssueStatus, - space: tracker.class.Team + space: tracker.class.Team, + _id: { + subIssues: tracker.class.Issue + } } } + const spaceQuery = createQuery() + let currentTeam: Team | undefined + $: spaceQuery.query(tracker.class.Team, { _id: currentSpace }, (res) => { + currentTeam = res.shift() + }) + let personPresenter: AttributeModel $: isCollapsedMap = Object.fromEntries(categories.map((category) => [category, false])) @@ -175,6 +185,7 @@ shouldShowPlaceholder={true} isInteractive={false} avatarSize={'x-small'} + {currentSpace} /> {:else if headerComponent} {/if} @@ -244,6 +256,8 @@ value={getObjectValue(attributeModel.key, docObject) ?? ''} groupBy={groupByKey} {...attributeModel.props} + {statuses} + {currentTeam} /> {:else if attributeModelIndex === 1} @@ -259,10 +273,12 @@ value={getObjectValue(attributeModel.key, docObject) ?? ''} groupBy={groupByKey} {...attributeModel.props} + {statuses} + {currentTeam} /> - {:else if attributeModelIndex === 3} + {:else if attributeModelIndex === 3 || attributeModel.presenter === GrowPresenter} {:else} @@ -291,6 +309,8 @@ issueId={docObject._id} groupBy={groupByKey} {...attributeModel.props} + {statuses} + {currentTeam} /> {/if} @@ -367,12 +387,7 @@ .priorityPresenter, .issuePresenter { - min-width: 0; + // min-width: 0; min-height: 0; } - // .grow-cell { - // flex-grow: 1; - // flex-shrink: 0; - // min-width: 0; - // } diff --git a/plugins/tracker-resources/src/components/issues/KanbanView.svelte b/plugins/tracker-resources/src/components/issues/KanbanView.svelte index e1806deb4e..3a13cd56b8 100644 --- a/plugins/tracker-resources/src/components/issues/KanbanView.svelte +++ b/plugins/tracker-resources/src/components/issues/KanbanView.svelte @@ -252,7 +252,7 @@
{#if issue && issueStatuses && issue.subIssues > 0} - + {/if} .root { display: flex; - flex-grow: 1; - min-width: 0; + flex-grow: 0; + min-width: 7rem; white-space: nowrap; overflow: hidden; flex-shrink: 10; diff --git a/plugins/tracker-resources/src/components/issues/edit/SubIssuesSelector.svelte b/plugins/tracker-resources/src/components/issues/edit/SubIssuesSelector.svelte index b8e7d3309f..ca1502ff03 100644 --- a/plugins/tracker-resources/src/components/issues/edit/SubIssuesSelector.svelte +++ b/plugins/tracker-resources/src/components/issues/edit/SubIssuesSelector.svelte @@ -21,9 +21,9 @@ import tracker from '../../../plugin' import { getIssueId } from '../../../issues' - export let issue: WithLookup + export let value: WithLookup export let currentTeam: Team | undefined - export let issueStatuses: WithLookup[] | undefined + export let statuses: WithLookup[] | undefined export let kind: ButtonKind = 'link-bordered' export let size: ButtonSize = 'inline' @@ -36,18 +36,18 @@ let doneStatus: Ref | undefined let countComplate: number = 0 - $: if (issue.$lookup?.subIssues !== undefined) { - subIssues = issue.$lookup.subIssues as Issue[] - subIssues.sort((a, b) => a.rank.localeCompare(b.rank)) + $: if (value.$lookup?.subIssues !== undefined) { + subIssues = value.$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 (statuses && subIssues) { + doneStatus = statuses.find((s) => s.category === tracker.issueStatusCategory.Completed)?._id ?? undefined if (doneStatus) countComplate = subIssues.filter((si) => si.status === doneStatus).length } $: hasSubIssues = (subIssues?.length ?? 0) > 0 function getIssueStatusIcon (issue: Issue) { - const status = issueStatuses?.find((s) => issue.status === s._id) + const status = statuses?.find((s) => issue.status === s._id) const category = status?.$lookup?.category const color = status?.color ?? category?.color @@ -58,8 +58,8 @@ } function openIssue (target: Ref) { - if (target !== issue._id) { - showPanel(tracker.component.EditIssue, target, issue._class, 'content') + if (target !== value._id) { + showPanel(tracker.component.EditIssue, target, value._class, 'content') } } function showSubIssues () { @@ -71,7 +71,7 @@ value: subIssues.map((iss) => { const text = currentTeam ? `${getIssueId(currentTeam, iss)} ${iss.title}` : iss.title - return { id: iss._id, text, isSelected: iss._id === issue._id, ...getIssueStatusIcon(iss) } + return { id: iss._id, text, isSelected: iss._id === value._id, ...getIssueStatusIcon(iss) } }), width: 'large' }, diff --git a/plugins/tracker-resources/src/components/issues/timereport/EstimationEditor.svelte b/plugins/tracker-resources/src/components/issues/timereport/EstimationEditor.svelte index 464ee20999..1373e23723 100644 --- a/plugins/tracker-resources/src/components/issues/timereport/EstimationEditor.svelte +++ b/plugins/tracker-resources/src/components/issues/timereport/EstimationEditor.svelte @@ -82,7 +82,7 @@ function hourFloor (value: number): number { const days = Math.ceil(value) const hours = value - days - return days + Math.floor(hours * 10) / 10 + return days + Math.floor(hours * 100) / 100 } diff --git a/plugins/tracker-resources/src/components/issues/timereport/EstimationProgressCircle.svelte b/plugins/tracker-resources/src/components/issues/timereport/EstimationProgressCircle.svelte index 5141ab1431..af4e3638b1 100644 --- a/plugins/tracker-resources/src/components/issues/timereport/EstimationProgressCircle.svelte +++ b/plugins/tracker-resources/src/components/issues/timereport/EstimationProgressCircle.svelte @@ -44,17 +44,19 @@ style:stroke-dasharray={lenghtC} style:stroke-dashoffset={dashOffset === 0 ? 0 : dashOffset + 3} /> - + {#if min !== max && min !== value} + + {/if}