mirror of
https://github.com/hcengineering/platform.git
synced 2024-12-23 03:22:19 +03:00
TSK-1114: fix default issue status (#3044)
Signed-off-by: Vyacheslav Tumanov <me@slavatumanov.me>
This commit is contained in:
parent
3cd606ad21
commit
40d13681d6
@ -624,6 +624,7 @@
|
||||
value={object}
|
||||
kind={'secondary'}
|
||||
size={'large'}
|
||||
defaultIssueStatus={draft ? undefined : currentProject?.defaultIssueStatus}
|
||||
shouldShowLabel={true}
|
||||
on:change={({ detail }) => (object.status = detail)}
|
||||
/>
|
||||
|
@ -38,6 +38,7 @@
|
||||
export let size: ButtonSize = 'large'
|
||||
export let justify: 'left' | 'center' = 'left'
|
||||
export let width: string | undefined = undefined
|
||||
export let defaultIssueStatus: Ref<IssueStatus> | undefined = undefined
|
||||
|
||||
const client = getClient()
|
||||
const dispatch = createEventDispatcher()
|
||||
@ -75,15 +76,21 @@
|
||||
|
||||
function getSelectedStatus (
|
||||
statuses: WithLookup<IssueStatus>[] | undefined,
|
||||
value: ValueType
|
||||
value: ValueType,
|
||||
defaultStatus: Ref<IssueStatus> | undefined
|
||||
): WithLookup<IssueStatus> | undefined {
|
||||
if (defaultStatus !== undefined) {
|
||||
defaultIssueStatus = undefined
|
||||
changeStatus(defaultStatus)
|
||||
return statuses?.find((status) => status._id === defaultStatus)
|
||||
}
|
||||
const current = statuses?.find((status) => status._id === value.status)
|
||||
if (current) return current
|
||||
changeStatus(statuses?.[0]?._id)
|
||||
return statuses?.[0]
|
||||
}
|
||||
|
||||
$: selectedStatus = getSelectedStatus(statuses, value)
|
||||
$: selectedStatus = getSelectedStatus(statuses, value, defaultIssueStatus)
|
||||
$: selectedStatusLabel = shouldShowLabel ? selectedStatus?.name : undefined
|
||||
$: statusesInfo = statuses?.map((s) => {
|
||||
return {
|
||||
|
Loading…
Reference in New Issue
Block a user