Minor tracker fixes ()

Signed-off-by: Denis Bykhov <bykhov.denis@gmail.com>
This commit is contained in:
Denis Bykhov 2023-02-03 10:06:59 +06:00 committed by GitHub
parent 8b12b64340
commit 7f05cbe497
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
5 changed files with 45 additions and 10 deletions

View File

@ -553,8 +553,7 @@
}
}
}
addNotification(tracker.string.IssueCreated, getTitle(object.title), IssueNotification, {
addNotification(await translate(tracker.string.IssueCreated, {}), getTitle(object.title), IssueNotification, {
issueId: objectId,
subTitlePostfix: (await translate(tracker.string.Created, { value: 1 })).toLowerCase(),
issueUrl: currentTeam && generateIssueShortLink(getIssueId(currentTeam, value as Issue))
@ -707,6 +706,9 @@
<ObjectBox
_class={tracker.class.IssueTemplate}
value={templateId}
docQuery={{
space: _space
}}
on:change={handleTemplateChange}
size={'small'}
label={tracker.string.NoIssueTemplate}

View File

@ -135,7 +135,7 @@
})
}
addNotification(tracker.string.IssueCreated, getTitle(newIssue.title), IssueNotification, {
addNotification(await translate(tracker.string.IssueCreated, {}), getTitle(newIssue.title), IssueNotification, {
issueId: objectId,
subTitlePostfix: (await translate(tracker.string.Created, { value: 1 })).toLowerCase()
})

View File

@ -25,8 +25,8 @@
ToggleWithLabel
} from '@hcengineering/ui'
import presentation, { Card, getClient } from '@hcengineering/presentation'
import core, { getCurrentAccount, Ref } from '@hcengineering/core'
import { IssueStatus, Team, TimeReportDayType, WorkDayLength } from '@hcengineering/tracker'
import core, { generateId, getCurrentAccount, Ref, SortingOrder } from '@hcengineering/core'
import { genRanks, IssueStatus, Team, TimeReportDayType, WorkDayLength } from '@hcengineering/tracker'
import { StyledTextBox } from '@hcengineering/text-editor'
import { Asset } from '@hcengineering/platform'
import tracker from '../../plugin'
@ -62,6 +62,8 @@
isNew ? createTeam() : updateTeam()
}
const defaultStatusId: Ref<IssueStatus> = generateId()
function getTeamData () {
return {
name,
@ -72,7 +74,7 @@
identifier: name.toUpperCase().replaceAll(' ', '_'),
sequence: 0,
issueStatuses: 0,
defaultIssueStatus: '' as Ref<IssueStatus>,
defaultIssueStatus: defaultStatusId,
icon,
defaultTimeReportDay: selectedWorkDayType ?? TimeReportDayType.PreviousWorkDay,
workDayLength: selectedWorkDayLength ?? WorkDayLength.EIGHT_HOURS
@ -97,7 +99,36 @@
}
async function createTeam () {
await client.createDoc(tracker.class.Team, core.space.Space, getTeamData())
const id = await client.createDoc(tracker.class.Team, core.space.Space, getTeamData())
await createTeamIssueStatuses(id, defaultStatusId)
}
async function createTeamIssueStatuses (
teamId: Ref<Team>,
defaultStatusId: Ref<IssueStatus>,
defaultCategoryId = tracker.issueStatusCategory.Backlog
): Promise<void> {
const categories = await client.findAll(
tracker.class.IssueStatusCategory,
{},
{ sort: { order: SortingOrder.Ascending } }
)
const issueStatusRanks = [...genRanks(categories.length)]
for (const [i, statusCategory] of categories.entries()) {
const { _id: category, defaultStatusName } = statusCategory
const rank = issueStatusRanks[i]
await client.addCollection(
tracker.class.IssueStatus,
teamId,
teamId,
tracker.class.Team,
'issueStatuses',
{ name: defaultStatusName, category, rank },
category === defaultCategoryId ? defaultStatusId : undefined
)
}
}
function chooseIcon (ev: MouseEvent) {

View File

@ -1,5 +1,5 @@
<script lang="ts">
import { DocumentQuery, WithLookup } from '@hcengineering/core'
import { DocumentQuery, Ref, Space, WithLookup } from '@hcengineering/core'
import { IssueTemplate } from '@hcengineering/tracker'
import { Component } from '@hcengineering/ui'
import { Viewlet, ViewOptions } from '@hcengineering/view'
@ -9,6 +9,7 @@
export let viewlet: WithLookup<Viewlet>
export let viewOptions: ViewOptions
export let query: DocumentQuery<IssueTemplate> = {}
export let space: Ref<Space> | undefined
const createItemDialog = CreateIssueTemplate
const createItemLabel = tracker.string.IssueTemplate
@ -26,6 +27,7 @@
viewOptions,
viewOptionsConfig: viewlet.viewOptions?.other,
viewlet,
space,
query
}}
/>

View File

@ -68,7 +68,7 @@
$: if (docWidth > 900 && docSize) docSize = false
const showCreateDialog = async () => {
showPopup(CreateIssueTemplate, { targetElement: null }, 'top')
showPopup(CreateIssueTemplate, { targetElement: null, space }, 'top')
}
$: viewOptions = getViewOptions(viewlet)
@ -114,7 +114,7 @@
/>
<div class="flex w-full h-full clear-mins">
{#if viewlet && viewOptions}
<IssueTemplatesContent {viewOptions} {viewlet} query={resultQuery} />
<IssueTemplatesContent {viewOptions} {viewlet} {space} query={resultQuery} />
{/if}
{#if $$slots.aside !== undefined && asideShown}
<div class="popupPanel-body__aside flex" class:float={asideFloat} class:shown={asideShown}>