UBER-1182: Fix github task types support (#4215)

Signed-off-by: Andrey Sobolev <haiodo@gmail.com>
This commit is contained in:
Andrey Sobolev
2023-12-19 12:08:10 +06:00
committed by GitHub
parent 89706eb350
commit 5413031df0
11 changed files with 195 additions and 85 deletions
@@ -14,7 +14,7 @@
-->
<script lang="ts">
import { IdMap, Ref, Status, WithLookup } from '@hcengineering/core'
import { ProjectType } from '@hcengineering/task'
import { ProjectType, TaskType } from '@hcengineering/task'
import { typeStore } from '@hcengineering/task-resources'
import { IssueStatus } from '@hcengineering/tracker'
import {
@@ -36,6 +36,7 @@
export let value: Ref<IssueStatus> | undefined
export let type: Ref<ProjectType> | undefined
export let taskType: Ref<TaskType> | undefined = undefined
let statuses: WithLookup<IssueStatus>[] | undefined = undefined
@@ -70,7 +71,14 @@
if (typeId === undefined) return []
const type = types.get(typeId)
if (type === undefined) return []
return type.statuses.map((p) => statuses.get(p._id)).filter((p) => p !== undefined) as IssueStatus[]
let vals = type.statuses
if (taskType !== undefined) {
vals = vals.filter((it) => it.taskType === taskType)
}
return vals
.filter((it, idx, arr) => arr.findIndex((q) => q._id === it._id) === idx)
.map((p) => statuses.get(p._id))
.filter((p) => p !== undefined) as IssueStatus[]
}
function getSelectedStatus (
@@ -42,7 +42,7 @@
import tracker from '../../plugin'
import StatusSelector from '../issues/StatusSelector.svelte'
import ChangeIdentity from './ChangeIdentity.svelte'
import { typeStore } from '@hcengineering/task-resources'
import { typeStore, taskTypeStore } from '@hcengineering/task-resources'
export let project: Project | undefined = undefined
@@ -70,7 +70,7 @@
const dispatch = createEventDispatcher()
$: isNew = !project
$: isNew = project == null
async function handleSave (): Promise<void> {
if (isNew) {
@@ -239,12 +239,13 @@
<div class="antiGrid-row__header">
<Label label={task.string.ProjectType} />
</div>
<Component
is={task.component.ProjectTypeSelector}
disabled={!isNew}
props={{
descriptors: [tracker.descriptors.ProjectType],
type: typeId,
disabled: !isNew,
focusIndex: 4,
kind: 'regular',
size: 'large'
@@ -379,7 +380,15 @@
<div class="antiGrid-row__header">
<Label label={tracker.string.DefaultIssueStatus} />
</div>
<StatusSelector bind:value={defaultStatus} type={typeId} kind={'regular'} size={'large'} />
<StatusSelector
taskType={Array.from($taskTypeStore.values()).filter(
(it) => it.parent === typeId && it.ofClass === tracker.class.Issue
)[0]?._id}
bind:value={defaultStatus}
type={typeId}
kind={'regular'}
size={'large'}
/>
</div>
</div>
</Card>