mirror of
https://github.com/hcengineering/platform.git
synced 2024-11-22 21:50:34 +03:00
TSK-761: team default assignee (#2706)
Signed-off-by: Vyacheslav Tumanov <me@slavatumanov.me>
This commit is contained in:
parent
f0bcbd1c82
commit
5320b6378c
@ -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
|
||||
}
|
||||
|
@ -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
|
||||
|
@ -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",
|
||||
|
@ -278,7 +278,8 @@
|
||||
"CurrentWorkDay": "Текущий Рабочий День",
|
||||
"PreviousWorkDay": "Предыдущий Рабочий День",
|
||||
"TimeReportDayTypeLabel": "Выберите тип дня для временного отчета",
|
||||
"DefaultTimeReportDay": "Выберите дeнь для временного отчета по умолчанию",
|
||||
"DefaultTimeReportDay": "Выберите день для временного отчета по умолчанию",
|
||||
"DefaultAssignee": "Выберите исполнителя по умолчанию",
|
||||
|
||||
"WorkDayLength": "Выберите длину рабочего дня",
|
||||
"SevenHoursLength": "Семь Часов",
|
||||
|
@ -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
|
||||
}
|
||||
|
||||
|
@ -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>
|
||||
|
@ -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,
|
||||
|
@ -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
|
||||
|
Loading…
Reference in New Issue
Block a user