mirror of
https://github.com/hcengineering/platform.git
synced 2025-05-05 23:12:42 +00:00
Minor tracker fixes (#2582)
Signed-off-by: Denis Bykhov <bykhov.denis@gmail.com>
This commit is contained in:
parent
8b12b64340
commit
7f05cbe497
@ -553,8 +553,7 @@
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
addNotification(await translate(tracker.string.IssueCreated, {}), getTitle(object.title), IssueNotification, {
|
||||||
addNotification(tracker.string.IssueCreated, getTitle(object.title), IssueNotification, {
|
|
||||||
issueId: objectId,
|
issueId: objectId,
|
||||||
subTitlePostfix: (await translate(tracker.string.Created, { value: 1 })).toLowerCase(),
|
subTitlePostfix: (await translate(tracker.string.Created, { value: 1 })).toLowerCase(),
|
||||||
issueUrl: currentTeam && generateIssueShortLink(getIssueId(currentTeam, value as Issue))
|
issueUrl: currentTeam && generateIssueShortLink(getIssueId(currentTeam, value as Issue))
|
||||||
@ -707,6 +706,9 @@
|
|||||||
<ObjectBox
|
<ObjectBox
|
||||||
_class={tracker.class.IssueTemplate}
|
_class={tracker.class.IssueTemplate}
|
||||||
value={templateId}
|
value={templateId}
|
||||||
|
docQuery={{
|
||||||
|
space: _space
|
||||||
|
}}
|
||||||
on:change={handleTemplateChange}
|
on:change={handleTemplateChange}
|
||||||
size={'small'}
|
size={'small'}
|
||||||
label={tracker.string.NoIssueTemplate}
|
label={tracker.string.NoIssueTemplate}
|
||||||
|
@ -135,7 +135,7 @@
|
|||||||
})
|
})
|
||||||
}
|
}
|
||||||
|
|
||||||
addNotification(tracker.string.IssueCreated, getTitle(newIssue.title), IssueNotification, {
|
addNotification(await translate(tracker.string.IssueCreated, {}), getTitle(newIssue.title), IssueNotification, {
|
||||||
issueId: objectId,
|
issueId: objectId,
|
||||||
subTitlePostfix: (await translate(tracker.string.Created, { value: 1 })).toLowerCase()
|
subTitlePostfix: (await translate(tracker.string.Created, { value: 1 })).toLowerCase()
|
||||||
})
|
})
|
||||||
|
@ -25,8 +25,8 @@
|
|||||||
ToggleWithLabel
|
ToggleWithLabel
|
||||||
} from '@hcengineering/ui'
|
} from '@hcengineering/ui'
|
||||||
import presentation, { Card, getClient } from '@hcengineering/presentation'
|
import presentation, { Card, getClient } from '@hcengineering/presentation'
|
||||||
import core, { getCurrentAccount, Ref } from '@hcengineering/core'
|
import core, { generateId, getCurrentAccount, Ref, SortingOrder } from '@hcengineering/core'
|
||||||
import { IssueStatus, Team, TimeReportDayType, WorkDayLength } from '@hcengineering/tracker'
|
import { genRanks, IssueStatus, Team, TimeReportDayType, WorkDayLength } from '@hcengineering/tracker'
|
||||||
import { StyledTextBox } from '@hcengineering/text-editor'
|
import { StyledTextBox } from '@hcengineering/text-editor'
|
||||||
import { Asset } from '@hcengineering/platform'
|
import { Asset } from '@hcengineering/platform'
|
||||||
import tracker from '../../plugin'
|
import tracker from '../../plugin'
|
||||||
@ -62,6 +62,8 @@
|
|||||||
isNew ? createTeam() : updateTeam()
|
isNew ? createTeam() : updateTeam()
|
||||||
}
|
}
|
||||||
|
|
||||||
|
const defaultStatusId: Ref<IssueStatus> = generateId()
|
||||||
|
|
||||||
function getTeamData () {
|
function getTeamData () {
|
||||||
return {
|
return {
|
||||||
name,
|
name,
|
||||||
@ -72,7 +74,7 @@
|
|||||||
identifier: name.toUpperCase().replaceAll(' ', '_'),
|
identifier: name.toUpperCase().replaceAll(' ', '_'),
|
||||||
sequence: 0,
|
sequence: 0,
|
||||||
issueStatuses: 0,
|
issueStatuses: 0,
|
||||||
defaultIssueStatus: '' as Ref<IssueStatus>,
|
defaultIssueStatus: defaultStatusId,
|
||||||
icon,
|
icon,
|
||||||
defaultTimeReportDay: selectedWorkDayType ?? TimeReportDayType.PreviousWorkDay,
|
defaultTimeReportDay: selectedWorkDayType ?? TimeReportDayType.PreviousWorkDay,
|
||||||
workDayLength: selectedWorkDayLength ?? WorkDayLength.EIGHT_HOURS
|
workDayLength: selectedWorkDayLength ?? WorkDayLength.EIGHT_HOURS
|
||||||
@ -97,7 +99,36 @@
|
|||||||
}
|
}
|
||||||
|
|
||||||
async function createTeam () {
|
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) {
|
function chooseIcon (ev: MouseEvent) {
|
||||||
|
@ -1,5 +1,5 @@
|
|||||||
<script lang="ts">
|
<script lang="ts">
|
||||||
import { DocumentQuery, WithLookup } from '@hcengineering/core'
|
import { DocumentQuery, Ref, Space, WithLookup } from '@hcengineering/core'
|
||||||
import { IssueTemplate } from '@hcengineering/tracker'
|
import { IssueTemplate } from '@hcengineering/tracker'
|
||||||
import { Component } from '@hcengineering/ui'
|
import { Component } from '@hcengineering/ui'
|
||||||
import { Viewlet, ViewOptions } from '@hcengineering/view'
|
import { Viewlet, ViewOptions } from '@hcengineering/view'
|
||||||
@ -9,6 +9,7 @@
|
|||||||
export let viewlet: WithLookup<Viewlet>
|
export let viewlet: WithLookup<Viewlet>
|
||||||
export let viewOptions: ViewOptions
|
export let viewOptions: ViewOptions
|
||||||
export let query: DocumentQuery<IssueTemplate> = {}
|
export let query: DocumentQuery<IssueTemplate> = {}
|
||||||
|
export let space: Ref<Space> | undefined
|
||||||
|
|
||||||
const createItemDialog = CreateIssueTemplate
|
const createItemDialog = CreateIssueTemplate
|
||||||
const createItemLabel = tracker.string.IssueTemplate
|
const createItemLabel = tracker.string.IssueTemplate
|
||||||
@ -26,6 +27,7 @@
|
|||||||
viewOptions,
|
viewOptions,
|
||||||
viewOptionsConfig: viewlet.viewOptions?.other,
|
viewOptionsConfig: viewlet.viewOptions?.other,
|
||||||
viewlet,
|
viewlet,
|
||||||
|
space,
|
||||||
query
|
query
|
||||||
}}
|
}}
|
||||||
/>
|
/>
|
||||||
|
@ -68,7 +68,7 @@
|
|||||||
$: if (docWidth > 900 && docSize) docSize = false
|
$: if (docWidth > 900 && docSize) docSize = false
|
||||||
|
|
||||||
const showCreateDialog = async () => {
|
const showCreateDialog = async () => {
|
||||||
showPopup(CreateIssueTemplate, { targetElement: null }, 'top')
|
showPopup(CreateIssueTemplate, { targetElement: null, space }, 'top')
|
||||||
}
|
}
|
||||||
|
|
||||||
$: viewOptions = getViewOptions(viewlet)
|
$: viewOptions = getViewOptions(viewlet)
|
||||||
@ -114,7 +114,7 @@
|
|||||||
/>
|
/>
|
||||||
<div class="flex w-full h-full clear-mins">
|
<div class="flex w-full h-full clear-mins">
|
||||||
{#if viewlet && viewOptions}
|
{#if viewlet && viewOptions}
|
||||||
<IssueTemplatesContent {viewOptions} {viewlet} query={resultQuery} />
|
<IssueTemplatesContent {viewOptions} {viewlet} {space} query={resultQuery} />
|
||||||
{/if}
|
{/if}
|
||||||
{#if $$slots.aside !== undefined && asideShown}
|
{#if $$slots.aside !== undefined && asideShown}
|
||||||
<div class="popupPanel-body__aside flex" class:float={asideFloat} class:shown={asideShown}>
|
<div class="popupPanel-body__aside flex" class:float={asideFloat} class:shown={asideShown}>
|
||||||
|
Loading…
Reference in New Issue
Block a user