mirror of
https://github.com/hcengineering/platform.git
synced 2025-04-13 03:40:48 +00:00
Use default space if no space is selected (#1670)
Signed-off-by: Sergei Ogorelkov <sergei.ogorelkov@xored.com>
This commit is contained in:
parent
8588404964
commit
472ee0537b
@ -14,13 +14,32 @@
|
||||
-->
|
||||
<script lang="ts">
|
||||
import { Ref, Space } from '@anticrm/core'
|
||||
import { getClient } from '@anticrm/presentation'
|
||||
import { Button, showPopup } from '@anticrm/ui'
|
||||
import tracker from '../plugin'
|
||||
import CreateIssue from './CreateIssue.svelte'
|
||||
export let currentSpace: Ref<Space>
|
||||
|
||||
export let currentSpace: Ref<Space> | undefined
|
||||
|
||||
const client = getClient()
|
||||
|
||||
let space: Ref<Space> | undefined
|
||||
$: updateSpace(currentSpace)
|
||||
|
||||
async function updateSpace (spaceId: Ref<Space> | undefined): Promise<void> {
|
||||
if (space) {
|
||||
space = spaceId
|
||||
return
|
||||
}
|
||||
|
||||
const team = await client.findOne(tracker.class.Team, {})
|
||||
space = team?._id
|
||||
}
|
||||
|
||||
async function newIssue (): Promise<void> {
|
||||
showPopup(CreateIssue, { space: currentSpace }, 'top')
|
||||
if (space) {
|
||||
showPopup(CreateIssue, { space }, 'top')
|
||||
}
|
||||
}
|
||||
</script>
|
||||
|
||||
@ -31,7 +50,7 @@
|
||||
label={tracker.string.NewIssue}
|
||||
justify={'left'}
|
||||
width={'100%'}
|
||||
on:click={() => newIssue()}
|
||||
on:click={newIssue}
|
||||
/>
|
||||
</div>
|
||||
<Button icon={tracker.icon.Magnifier} on:click={async () => {}} />
|
||||
|
Loading…
Reference in New Issue
Block a user