mirror of
https://github.com/hcengineering/platform.git
synced 2025-04-23 16:56:07 +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">
|
<script lang="ts">
|
||||||
import { Ref, Space } from '@anticrm/core'
|
import { Ref, Space } from '@anticrm/core'
|
||||||
|
import { getClient } from '@anticrm/presentation'
|
||||||
import { Button, showPopup } from '@anticrm/ui'
|
import { Button, showPopup } from '@anticrm/ui'
|
||||||
import tracker from '../plugin'
|
import tracker from '../plugin'
|
||||||
import CreateIssue from './CreateIssue.svelte'
|
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> {
|
async function newIssue (): Promise<void> {
|
||||||
showPopup(CreateIssue, { space: currentSpace }, 'top')
|
if (space) {
|
||||||
|
showPopup(CreateIssue, { space }, 'top')
|
||||||
|
}
|
||||||
}
|
}
|
||||||
</script>
|
</script>
|
||||||
|
|
||||||
@ -31,7 +50,7 @@
|
|||||||
label={tracker.string.NewIssue}
|
label={tracker.string.NewIssue}
|
||||||
justify={'left'}
|
justify={'left'}
|
||||||
width={'100%'}
|
width={'100%'}
|
||||||
on:click={() => newIssue()}
|
on:click={newIssue}
|
||||||
/>
|
/>
|
||||||
</div>
|
</div>
|
||||||
<Button icon={tracker.icon.Magnifier} on:click={async () => {}} />
|
<Button icon={tracker.icon.Magnifier} on:click={async () => {}} />
|
||||||
|
Loading…
Reference in New Issue
Block a user