Signed-off-by: Denis Bykhov <bykhov.denis@gmail.com>
This commit is contained in:
Denis Bykhov
2023-06-07 18:52:04 +06:00
committed by GitHub
parent aa09fa62c9
commit a4a756d3c2
2 changed files with 6 additions and 25 deletions
@@ -14,7 +14,7 @@
-->
<script lang="ts">
import { Ref, Space } from '@hcengineering/core'
import { MultipleDraftController, getClient } from '@hcengineering/presentation'
import { MultipleDraftController } from '@hcengineering/presentation'
import { Button, IconAdd, showPopup } from '@hcengineering/ui'
import { onDestroy } from 'svelte'
import tracker from '../plugin'
@@ -22,11 +22,7 @@
export let currentSpace: Ref<Space> | undefined
const client = getClient()
let space: Ref<Space> | undefined
let closed = true
$: updateSpace(currentSpace)
let draftExists = false
@@ -36,24 +32,9 @@
draftExists = res
})
)
async function updateSpace (spaceId: Ref<Space> | undefined): Promise<void> {
if (spaceId !== undefined) {
space = spaceId
return
}
const project = await client.findOne(tracker.class.Project, {})
space = project?._id
}
async function newIssue (): Promise<void> {
if (!space) {
const project = await client.findOne(tracker.class.Project, {})
space = project?._id
}
closed = false
showPopup(CreateIssue, { space, shouldSaveDraft: true }, 'top', () => {
showPopup(CreateIssue, { space: currentSpace, shouldSaveDraft: true }, 'top', () => {
closed = true
})
}