mirror of
https://github.com/hcengineering/platform.git
synced 2024-12-23 11:31:57 +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}
|
value={object}
|
||||||
kind={'secondary'}
|
kind={'secondary'}
|
||||||
size={'large'}
|
size={'large'}
|
||||||
|
defaultIssueStatus={draft ? undefined : currentProject?.defaultIssueStatus}
|
||||||
shouldShowLabel={true}
|
shouldShowLabel={true}
|
||||||
on:change={({ detail }) => (object.status = detail)}
|
on:change={({ detail }) => (object.status = detail)}
|
||||||
/>
|
/>
|
||||||
|
@ -38,6 +38,7 @@
|
|||||||
export let size: ButtonSize = 'large'
|
export let size: ButtonSize = 'large'
|
||||||
export let justify: 'left' | 'center' = 'left'
|
export let justify: 'left' | 'center' = 'left'
|
||||||
export let width: string | undefined = undefined
|
export let width: string | undefined = undefined
|
||||||
|
export let defaultIssueStatus: Ref<IssueStatus> | undefined = undefined
|
||||||
|
|
||||||
const client = getClient()
|
const client = getClient()
|
||||||
const dispatch = createEventDispatcher()
|
const dispatch = createEventDispatcher()
|
||||||
@ -75,15 +76,21 @@
|
|||||||
|
|
||||||
function getSelectedStatus (
|
function getSelectedStatus (
|
||||||
statuses: WithLookup<IssueStatus>[] | undefined,
|
statuses: WithLookup<IssueStatus>[] | undefined,
|
||||||
value: ValueType
|
value: ValueType,
|
||||||
|
defaultStatus: Ref<IssueStatus> | undefined
|
||||||
): WithLookup<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)
|
const current = statuses?.find((status) => status._id === value.status)
|
||||||
if (current) return current
|
if (current) return current
|
||||||
changeStatus(statuses?.[0]?._id)
|
changeStatus(statuses?.[0]?._id)
|
||||||
return statuses?.[0]
|
return statuses?.[0]
|
||||||
}
|
}
|
||||||
|
|
||||||
$: selectedStatus = getSelectedStatus(statuses, value)
|
$: selectedStatus = getSelectedStatus(statuses, value, defaultIssueStatus)
|
||||||
$: selectedStatusLabel = shouldShowLabel ? selectedStatus?.name : undefined
|
$: selectedStatusLabel = shouldShowLabel ? selectedStatus?.name : undefined
|
||||||
$: statusesInfo = statuses?.map((s) => {
|
$: statusesInfo = statuses?.map((s) => {
|
||||||
return {
|
return {
|
||||||
|
Loading…
Reference in New Issue
Block a user