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) @Prop(TypeRef(tracker.class.IssueStatus), tracker.string.DefaultIssueStatus)
defaultIssueStatus!: Ref<IssueStatus> defaultIssueStatus!: Ref<IssueStatus>
@Prop(TypeRef(contact.class.Employee), tracker.string.DefaultAssignee)
defaultAssignee!: Ref<Employee>
declare workDayLength: WorkDayLength declare workDayLength: WorkDayLength
declare defaultTimeReportDay: TimeReportDayType declare defaultTimeReportDay: TimeReportDayType
} }

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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