Minor states fixes (#3693)

Signed-off-by: Denis Bykhov <bykhov.denis@gmail.com>
This commit is contained in:
Denis Bykhov 2023-09-14 22:24:29 +06:00 committed by GitHub
parent c7fe158dfd
commit 243befe81d
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
3 changed files with 14 additions and 6 deletions

View File

@ -15,10 +15,13 @@
-->
<script lang="ts">
import { Ref, Status, StatusValue } from '@hcengineering/core'
import { DoneState, SpaceWithStates } from '@hcengineering/task'
import { Label } from '@hcengineering/ui'
import { statusStore } from '@hcengineering/view-resources'
import type { DoneState, SpaceWithStates } from '@hcengineering/task'
import DoneStatePresenter from './DoneStatePresenter.svelte'
import task from '../../plugin'
import Unknown from '../icons/Unknown.svelte'
import DoneStateEditor from './DoneStateEditor.svelte'
import DoneStatePresenter from './DoneStatePresenter.svelte'
export let value: Ref<DoneState> | StatusValue
export let space: Ref<SpaceWithStates> | undefined
@ -34,4 +37,9 @@
{:else}
<DoneStatePresenter value={state} {showTitle} />
{/if}
{:else}
<div class="flex-row-center pointer-events-none">
<div class="content-dark-color mr-2"><Unknown size={'small'} /></div>
<span class="overflow-label"><Label label={task.string.NoDoneState} /></span>
</div>
{/if}

View File

@ -74,12 +74,12 @@
for (const object of filter.value) {
targets.add(object)
}
const isDone = hierarchy.isDerived(targetClass, task.class.DoneState)
if (space !== undefined) {
const _space = await client.findOne(task.class.SpaceWithStates, { _id: space as Ref<SpaceWithStates> })
if (_space) {
const targetClass = (filter.key.attribute.type as RefTo<Status>).to
const key = hierarchy.isDerived(targetClass, task.class.DoneState) ? 'doneStates' : 'states'
const key = isDone ? 'doneStates' : 'states'
values = (_space as any)[key].map((p: Ref<Status>) => statusStore.get(p)).filter((p: Status) => p !== undefined)
for (const value of values) {
targets.add(value?._id)
@ -98,7 +98,7 @@
}
values = await sort(statuses)
}
if (targets.has(undefined)) {
if (targets.has(undefined) || isDone) {
values.unshift(undefined)
}
if (values.length !== targets.size) {

View File

@ -33,7 +33,7 @@
if (attribute.attribute?.type._class === core.class.EnumOf) {
return { ...clearAttributeProps, type: attribute.attribute.type, ...props }
}
return { object, ...clearAttributeProps, ...props }
return { object, ...clearAttributeProps, space: object.space, ...props }
}
</script>