[TSK-1491] Fix empty sprint status on popup close (#3175)

Signed-off-by: Sergei Ogorelkov <sergei.ogorelkov@icloud.com>
This commit is contained in:
Sergei Ogorelkov 2023-05-12 21:01:04 +04:00 committed by GitHub
parent dd712fcdd7
commit ee0a120450
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
2 changed files with 22 additions and 2 deletions

View File

@ -40,6 +40,8 @@ import {
IssueTemplate,
IssueTemplateChild,
Project,
Sprint,
SprintStatus,
TimeReportDayType
} from '@hcengineering/tracker'
import { DOMAIN_TRACKER } from '.'
@ -730,6 +732,14 @@ async function setCreate (client: MigrationClient): Promise<void> {
}
}
async function fixSprintEmptyStatuses (client: MigrationClient): Promise<void> {
await client.update<Sprint>(
DOMAIN_TRACKER,
{ _class: tracker.class.Sprint, $or: [{ status: null }, { status: undefined }] },
{ status: SprintStatus.Planned }
)
}
export const trackerOperation: MigrateOperation = {
async migrate (client: MigrationClient): Promise<void> {
await client.update(
@ -762,6 +772,8 @@ export const trackerOperation: MigrateOperation = {
ofAttribute: tracker.attribute.IssueStatus
}
)
await fixSprintEmptyStatuses(client)
},
async upgrade (client: MigrationUpgradeClient): Promise<void> {
const tx = new TxOperations(client, core.account.System)

View File

@ -20,12 +20,20 @@
import SprintStatusSelector from './SprintStatusSelector.svelte'
export let value: SprintStatus
export let onChange: ((value: SprintStatus | undefined) => void) | undefined = undefined
export let onChange: ((value: SprintStatus) => void) | undefined = undefined
export let kind: ButtonKind = 'link'
export let size: ButtonSize = 'large'
export let justify: 'left' | 'center' = 'left'
export let width: string | undefined = '100%'
function handleComponentStatusChange (newSprintStatus: SprintStatus | undefined) {
if (newSprintStatus === undefined || onChange === undefined) {
return
}
onChange(newSprintStatus)
}
$: isEditable = onChange !== undefined
</script>
@ -37,5 +45,5 @@
{isEditable}
showTooltip={isEditable ? { label: tracker.string.SetStatus } : undefined}
selectedSprintStatus={value}
onSprintStatusChange={onChange}
onSprintStatusChange={handleComponentStatusChange}
/>