TSK-761: team default assignee (#2706)

Signed-off-by: Vyacheslav Tumanov <me@slavatumanov.me>
This commit is contained in:
Vyacheslav Tumanov 2023-03-02 16:46:47 +05:00 committed by GitHub
parent f0bcbd1c82
commit 5320b6378c
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
8 changed files with 44 additions and 4 deletions

View File

@ -179,6 +179,9 @@ export class TTeam extends TSpace implements Team {
@Prop(TypeRef(tracker.class.IssueStatus), tracker.string.DefaultIssueStatus)
defaultIssueStatus!: Ref<IssueStatus>
@Prop(TypeRef(contact.class.Employee), tracker.string.DefaultAssignee)
defaultAssignee!: Ref<Employee>
declare workDayLength: WorkDayLength
declare defaultTimeReportDay: TimeReportDayType
}

View File

@ -121,6 +121,7 @@ async function createDefaultTeam (tx: TxOperations): Promise<void> {
issueStatuses: 0,
defaultIssueStatus: defaultStatusId,
defaultTimeReportDay: TimeReportDayType.PreviousWorkDay,
defaultAssignee: undefined,
workDayLength: WorkDayLength.EIGHT_HOURS
},
tracker.team.DefaultTeam

View File

@ -279,6 +279,7 @@
"PreviousWorkDay": "Previous Working Day",
"TimeReportDayTypeLabel": "Select time report day type",
"DefaultTimeReportDay": "Select default day for time report",
"DefaultAssignee": "Select default assignee for issues",
"WorkDayLength": "Select length of working day",
"SevenHoursLength": "Seven Hours",

View File

@ -278,7 +278,8 @@
"CurrentWorkDay": "Текущий Рабочий День",
"PreviousWorkDay": "Предыдущий Рабочий День",
"TimeReportDayTypeLabel": "Выберите тип дня для временного отчета",
"DefaultTimeReportDay": "Выберите дeнь для временного отчета по умолчанию",
"DefaultTimeReportDay": "Выберите день для временного отчета по умолчанию",
"DefaultAssignee": "Выберите исполнителя по умолчанию",
"WorkDayLength": "Выберите длину рабочего дня",
"SevenHoursLength": "Семь Часов",

View File

@ -115,7 +115,7 @@
const defaultIssue = {
title: '',
description: '',
assignee,
assignee: '' as Ref<Employee>,
project,
sprint,
number: 0,
@ -153,6 +153,7 @@
labels = []
if (!originalIssue && !draft) {
updateIssueStatusId(currentTeam, status)
updateAssigneeId(currentTeam)
}
}
@ -232,6 +233,7 @@
$: _space = draft?.team || space
$: !originalIssue && !draft && updateIssueStatusId(currentTeam, status)
$: !originalIssue && !draft && updateAssigneeId(currentTeam)
$: canSave = getTitle(object.title ?? '').length > 0
$: statusesQuery.query(
@ -316,6 +318,13 @@
}
}
function updateAssigneeId (currentTeam: Team | undefined) {
if (currentTeam?.defaultAssignee !== undefined) {
object.assignee = currentTeam.defaultAssignee
} else {
object.assignee = null
}
}
function clearParentIssue () {
parentIssue = undefined
}
@ -326,7 +335,6 @@
async function isDraftEmpty (draft: Data<IssueDraft>): Promise<boolean> {
const emptyDraft: Partial<IssueDraft> = {
assignee: null,
description: '',
dueDate: null,
estimation: 0,
@ -365,6 +373,14 @@
return draft.status === currentTeam.defaultIssueStatus
}
if (draft.assignee === null) {
return true
}
if (currentTeam?.defaultAssignee) {
return draft.assignee === currentTeam.defaultAssignee
}
return false
}

View File

@ -15,7 +15,7 @@
<script lang="ts">
import core, { generateId, getCurrentAccount, Ref, SortingOrder } from '@hcengineering/core'
import { Asset } from '@hcengineering/platform'
import presentation, { Card, getClient } from '@hcengineering/presentation'
import presentation, { AssigneeBox, Card, getClient } from '@hcengineering/presentation'
import { StyledTextBox } from '@hcengineering/text-editor'
import { genRanks, IssueStatus, Team, TimeReportDayType, WorkDayLength } from '@hcengineering/tracker'
import {
@ -32,6 +32,7 @@
import tracker from '../../plugin'
import TimeReportDayDropdown from '../issues/timereport/TimeReportDayDropdown.svelte'
import TeamIconChooser from './TeamIconChooser.svelte'
import { Employee } from '@hcengineering/contact'
export let team: Team | undefined = undefined
@ -42,6 +43,7 @@
let selectedWorkDayType: TimeReportDayType | undefined =
team?.defaultTimeReportDay ?? TimeReportDayType.PreviousWorkDay
let selectedWorkDayLength: WorkDayLength | undefined = team?.workDayLength ?? WorkDayLength.EIGHT_HOURS
let defaultAssignee: Ref<Employee> | null | undefined = null
const dispatch = createEventDispatcher()
const client = getClient()
@ -78,6 +80,7 @@
sequence: 0,
issueStatuses: 0,
defaultIssueStatus: defaultStatusId,
defaultAssignee: defaultAssignee ?? undefined,
icon,
defaultTimeReportDay: selectedWorkDayType ?? TimeReportDayType.PreviousWorkDay,
workDayLength: selectedWorkDayLength ?? WorkDayLength.EIGHT_HOURS
@ -195,4 +198,17 @@
bind:selected={selectedWorkDayLength}
/>
</div>
<div class="flex-between">
<div class="caption">
<Label label={tracker.string.DefaultAssignee} />
</div>
<AssigneeBox
label={tracker.string.Assignee}
placeholder={tracker.string.Assignee}
bind:value={defaultAssignee}
titleDeselect={tracker.string.Unassigned}
showTooltip={{ label: tracker.string.DefaultAssignee }}
/>
</div>
</Card>

View File

@ -300,6 +300,7 @@ export default mergeIds(trackerId, tracker, {
PreviousWorkDay: '' as IntlString,
TimeReportDayTypeLabel: '' as IntlString,
DefaultTimeReportDay: '' as IntlString,
DefaultAssignee: '' as IntlString,
WorkDayLength: '' as IntlString,
SevenHoursLength: '' as IntlString,

View File

@ -52,6 +52,7 @@ export interface Team extends Space {
sequence: number
issueStatuses: number
defaultIssueStatus: Ref<IssueStatus>
defaultAssignee?: Ref<Employee>
icon?: Asset
workDayLength: WorkDayLength
defaultTimeReportDay: TimeReportDayType