Skip to content

Commit

Permalink
TSK-915: Tracker status
Browse files Browse the repository at this point in the history
Signed-off-by: Andrey Sobolev <haiodo@gmail.com>
  • Loading branch information
haiodo committed Mar 22, 2023
1 parent d7265f0 commit b6483a5
Show file tree
Hide file tree
Showing 29 changed files with 263 additions and 486 deletions.
13 changes: 5 additions & 8 deletions models/tracker/src/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -73,8 +73,7 @@ import {
Project,
TimeReportDayType,
TimeSpendReport,
trackerId,
WorkDayLength
trackerId
} from '@hcengineering/tracker'
import { KeyBinding, ViewOptionsModel } from '@hcengineering/view'
import tracker from './plugin'
Expand All @@ -92,11 +91,14 @@ export const DOMAIN_TRACKER = 'tracker' as Domain
*/
@Model(tracker.class.IssueStatus, core.class.AttachedDoc, DOMAIN_TRACKER)
export class TIssueStatus extends TAttachedDoc implements IssueStatus {
name!: string
@Index(IndexKind.Indexed)
name!: string

description?: string
color?: number

@Prop(TypeRef(tracker.class.IssueStatusCategory), tracker.string.StatusCategory)
@Index(IndexKind.Indexed)
category!: Ref<IssueStatusCategory>

@Prop(TypeString(), tracker.string.Rank)
Expand Down Expand Up @@ -161,10 +163,6 @@ export class TTypeSprintStatus extends TType {}
@Model(tracker.class.Project, core.class.Space, DOMAIN_SPACE)
@UX(tracker.string.Project, tracker.icon.Project, 'Project')
export class TProject extends TSpace implements Project {
@Prop(TypeString(), tracker.string.Title)
@Index(IndexKind.FullText)
reamLogo!: IntlString

@Prop(TypeString(), tracker.string.Identifier)
@Index(IndexKind.FullText)
identifier!: IntlString
Expand All @@ -182,7 +180,6 @@ export class TProject extends TSpace implements Project {
@Prop(TypeRef(contact.class.Employee), tracker.string.DefaultAssignee)
defaultAssignee!: Ref<Employee>

declare workDayLength: WorkDayLength
declare defaultTimeReportDay: TimeReportDayType
}

Expand Down
12 changes: 4 additions & 8 deletions models/tracker/src/migration.ts
Original file line number Diff line number Diff line change
Expand Up @@ -39,8 +39,7 @@ import {
IssueTemplate,
IssueTemplateChild,
Project,
TimeReportDayType,
WorkDayLength
TimeReportDayType
} from '@hcengineering/tracker'
import { DOMAIN_TRACKER } from '.'
import tracker from './plugin'
Expand Down Expand Up @@ -126,8 +125,7 @@ async function createDefaultProject (tx: TxOperations): Promise<void> {
issueStatuses: 0,
defaultIssueStatus: defaultStatusId,
defaultTimeReportDay: TimeReportDayType.PreviousWorkDay,
defaultAssignee: undefined,
workDayLength: WorkDayLength.EIGHT_HOURS
defaultAssignee: undefined
},
tracker.project.DefaultProject
)
Expand Down Expand Up @@ -157,14 +155,12 @@ async function fixProjectsIssueStatusesOrder (tx: TxOperations): Promise<void> {

async function upgradeProjectSettings (tx: TxOperations): Promise<void> {
const projects = await tx.findAll(tracker.class.Project, {
defaultTimeReportDay: { $exists: false },
workDayLength: { $exists: false }
defaultTimeReportDay: { $exists: false }
})
await Promise.all(
projects.map((project) =>
tx.update(project, {
defaultTimeReportDay: TimeReportDayType.PreviousWorkDay,
workDayLength: WorkDayLength.EIGHT_HOURS
defaultTimeReportDay: TimeReportDayType.PreviousWorkDay
})
)
)
Expand Down
1 change: 0 additions & 1 deletion plugins/tracker-assets/lang/en.json
Original file line number Diff line number Diff line change
Expand Up @@ -280,7 +280,6 @@
"DefaultTimeReportDay": "Select default day for time report",
"DefaultAssignee": "Select default assignee for issues",

"WorkDayLength": "Select length of working day",
"SevenHoursLength": "Seven Hours",
"EightHoursLength": "Eight Hours",
"CreatedOn": "Created on",
Expand Down
1 change: 0 additions & 1 deletion plugins/tracker-assets/lang/ru.json
Original file line number Diff line number Diff line change
Expand Up @@ -280,7 +280,6 @@
"DefaultTimeReportDay": "Выберите день для временного отчета по умолчанию",
"DefaultAssignee": "Выберите исполнителя по умолчанию",

"WorkDayLength": "Выберите длину рабочего дня",
"SevenHoursLength": "Семь Часов",
"EightHoursLength": "Восемь Часов",
"CreatedOn": "Создана",
Expand Down
162 changes: 72 additions & 90 deletions plugins/tracker-resources/src/components/CreateIssue.svelte
Original file line number Diff line number Diff line change
Expand Up @@ -24,8 +24,7 @@
fillDefaults,
generateId,
Ref,
SortingOrder,
WithLookup
SortingOrder
} from '@hcengineering/core'
import { getResource, translate } from '@hcengineering/platform'
import {
Expand All @@ -41,15 +40,15 @@
import tags, { TagElement, TagReference } from '@hcengineering/tags'
import {
calcRank,
Component as ComponentType,
DraftIssueChild,
Issue,
IssueDraft,
IssuePriority,
IssueStatus,
IssueTemplate,
Component as ComponentType,
Sprint,
Project
Project,
Sprint
} from '@hcengineering/tracker'
import {
ActionIcon,
Expand All @@ -62,22 +61,21 @@
IconMoreH,
Label,
Menu,
showPopup,
Spinner
showPopup
} from '@hcengineering/ui'
import view from '@hcengineering/view'
import { ObjectBox } from '@hcengineering/view-resources'
import { deepEqual } from 'fast-equals'
import { createEventDispatcher } from 'svelte'
import { activeComponent, activeSprint, generateIssueShortLink, getIssueId, updateIssueRelation } from '../issues'
import tracker from '../plugin'
import ComponentSelector from './ComponentSelector.svelte'
import AssigneeEditor from './issues/AssigneeEditor.svelte'
import IssueNotification from './issues/IssueNotification.svelte'
import ParentIssue from './issues/ParentIssue.svelte'
import PriorityEditor from './issues/PriorityEditor.svelte'
import StatusEditor from './issues/StatusEditor.svelte'
import EstimationEditor from './issues/timereport/EstimationEditor.svelte'
import ComponentSelector from './ComponentSelector.svelte'
import SetDueDateActionPopup from './SetDueDateActionPopup.svelte'
import SetParentIssueActionPopup from './SetParentIssueActionPopup.svelte'
import SprintSelector from './sprints/SprintSelector.svelte'
Expand All @@ -101,7 +99,6 @@
let subIssuesComponent: SubIssues
let issueStatuses: WithLookup<IssueStatus>[] | undefined
let labels: TagReference[] = draft?.labels || []
let objectId: Ref<Issue> = draft?.issueId || generateId()
let saveTimer: number | undefined
Expand Down Expand Up @@ -137,6 +134,15 @@
createOn: Date.now()
}
$: _space = draft?.project || space
$: !originalIssue && !draft && updateIssueStatusId(currentProject, status)
$: !originalIssue && !draft && updateAssigneeId(currentProject)
$: canSave = getTitle(object.title ?? '').length > 0
$: if (object.space !== _space) {
object.space = _space
}
let object = originalIssue
? {
...originalIssue,
Expand All @@ -145,15 +151,16 @@
attachments: 0,
reportedTime: 0,
reports: 0,
childInfo: []
childInfo: [],
space: _space
}
: toIssue(defaultIssue, draft)
: { ...toIssue(defaultIssue, draft), space: _space }
fillDefaults(hierarchy, object, tracker.class.Issue)
function resetObject (): void {
templateId = undefined
template = undefined
object = { ...defaultIssue }
object = { ...defaultIssue, space: _space }
subIssues = []
labels = []
if (!originalIssue && !draft) {
Expand Down Expand Up @@ -228,7 +235,6 @@
$: updateTemplate(template)
const dispatch = createEventDispatcher()
const statusesQuery = createQuery()
const spaceQuery = createQuery()
let descriptionBox: AttachmentStyledBox
Expand All @@ -238,22 +244,6 @@
attr: client.getHierarchy().getAttribute(tracker.class.Issue, 'labels')
}
$: _space = draft?.project || space
$: !originalIssue && !draft && updateIssueStatusId(currentProject, status)
$: !originalIssue && !draft && updateAssigneeId(currentProject)
$: canSave = getTitle(object.title ?? '').length > 0
$: statusesQuery.query(
tracker.class.IssueStatus,
{ attachedTo: _space },
(statuses) => {
issueStatuses = statuses
},
{
lookup: { category: tracker.class.IssueStatusCategory },
sort: { rank: SortingOrder.Ascending }
}
)
$: spaceQuery.query(tracker.class.Project, { _id: _space }, (res) => {
currentProject = res.shift()
})
Expand Down Expand Up @@ -706,72 +696,64 @@
}}
/>
{/key}
{#if issueStatuses}
<SubIssues
bind:this={subIssuesComponent}
projectId={_space}
parent={objectId}
statuses={issueStatuses ?? []}
project={currentProject}
sprint={object.sprint}
component={object.component}
/>
{/if}
<SubIssues
bind:this={subIssuesComponent}
projectId={_space}
parent={objectId}
project={currentProject}
sprint={object.sprint}
component={object.component}
/>
<svelte:fragment slot="pool">
{#if issueStatuses}
<div id="status-editor">
<StatusEditor
value={object}
statuses={issueStatuses}
kind="no-border"
size="small"
shouldShowLabel={true}
on:change={({ detail }) => (object.status = detail)}
/>
</div>
<PriorityEditor
<div id="status-editor">
<StatusEditor
value={object}
shouldShowLabel
isEditable
kind="no-border"
size="small"
justify="center"
on:change={({ detail }) => (object.priority = detail)}
/>
<AssigneeEditor
value={object}
size="small"
kind="no-border"
width={'min-content'}
on:change={({ detail }) => (object.assignee = detail)}
/>
<Component
is={tags.component.TagsDropdownEditor}
props={{
items: labels,
key,
targetClass: tracker.class.Issue,
countLabel: tracker.string.NumberLabels
}}
on:open={(evt) => {
addTagRef(evt.detail)
}}
on:delete={(evt) => {
labels = labels.filter((it) => it._id !== evt.detail)
}}
/>
<EstimationEditor kind={'no-border'} size={'small'} value={object} {currentProject} />
<ComponentSelector value={object.component} onChange={handleComponentIdChanged} isEditable={true} />
<SprintSelector
value={object.sprint}
onChange={handleSprintIdChanged}
useComponent={(!originalIssue && object.component) || undefined}
shouldShowLabel={true}
on:change={({ detail }) => (object.status = detail)}
/>
{#if object.dueDate !== null}
<DatePresenter bind:value={object.dueDate} editable />
{/if}
{:else}
<Spinner size="small" />
</div>
<PriorityEditor
value={object}
shouldShowLabel
isEditable
kind="no-border"
size="small"
justify="center"
on:change={({ detail }) => (object.priority = detail)}
/>
<AssigneeEditor
value={object}
size="small"
kind="no-border"
width={'min-content'}
on:change={({ detail }) => (object.assignee = detail)}
/>
<Component
is={tags.component.TagsDropdownEditor}
props={{
items: labels,
key,
targetClass: tracker.class.Issue,
countLabel: tracker.string.NumberLabels
}}
on:open={(evt) => {
addTagRef(evt.detail)
}}
on:delete={(evt) => {
labels = labels.filter((it) => it._id !== evt.detail)
}}
/>
<EstimationEditor kind={'no-border'} size={'small'} value={object} {currentProject} />
<ComponentSelector value={object.component} onChange={handleComponentIdChanged} isEditable={true} />
<SprintSelector
value={object.sprint}
onChange={handleSprintIdChanged}
useComponent={(!originalIssue && object.component) || undefined}
/>
{#if object.dueDate !== null}
<DatePresenter bind:value={object.dueDate} editable />
{/if}
<ActionIcon icon={IconMoreH} size={'medium'} action={showMoreActions} />
</svelte:fragment>
Expand Down
16 changes: 2 additions & 14 deletions plugins/tracker-resources/src/components/SubIssues.svelte
Original file line number Diff line number Diff line change
Expand Up @@ -15,19 +15,10 @@
<script lang="ts">
import attachment, { Attachment } from '@hcengineering/attachment'
import { deleteFile } from '@hcengineering/attachment-resources/src/utils'
import core, { AttachedData, Ref, SortingOrder, WithLookup } from '@hcengineering/core'
import core, { AttachedData, Ref, SortingOrder } from '@hcengineering/core'
import { draftStore, getClient, updateDraftStore } from '@hcengineering/presentation'
import tags from '@hcengineering/tags'
import {
calcRank,
DraftIssueChild,
Issue,
IssueParentInfo,
IssueStatus,
Component,
Sprint,
Project
} from '@hcengineering/tracker'
import { calcRank, Component, DraftIssueChild, Issue, IssueParentInfo, Project, Sprint } from '@hcengineering/tracker'
import { Button, closeTooltip, ExpandCollapse, IconAdd, Scroller } from '@hcengineering/ui'
import { onDestroy } from 'svelte'
import tracker from '../plugin'
Expand All @@ -42,7 +33,6 @@
export let sprint: Ref<Sprint> | null = null
export let component: Ref<Component> | null = null
export let subIssues: DraftIssueChild[] = []
export let statuses: WithLookup<IssueStatus>[]
let isCollapsed = false
let isCreating = false
Expand Down Expand Up @@ -208,7 +198,6 @@
<div class="flex-col flex-no-shrink max-h-30 list clear-mins" class:collapsed={isCollapsed}>
<Scroller>
<DraftIssueChildList
{statuses}
{component}
{sprint}
bind:issues={subIssues}
Expand All @@ -224,7 +213,6 @@
<ExpandCollapse isExpanded={!isCollapsed} on:changeContent>
<DraftIssueChildEditor
{project}
{statuses}
{component}
{sprint}
on:close={() => {
Expand Down
Loading

0 comments on commit b6483a5

Please sign in to comment.