2022-04-23 16:59:57 +00:00
|
|
|
<!--
|
|
|
|
// Copyright © 2022 Hardcore Engineering Inc.
|
|
|
|
//
|
|
|
|
// Licensed under the Eclipse Public License, Version 2.0 (the "License");
|
|
|
|
// you may not use this file except in compliance with the License. You may
|
|
|
|
// obtain a copy of the License at https://www.eclipse.org/legal/epl-2.0
|
|
|
|
//
|
|
|
|
// Unless required by applicable law or agreed to in writing, software
|
|
|
|
// distributed under the License is distributed on an "AS IS" BASIS,
|
|
|
|
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
|
|
//
|
|
|
|
// See the License for the specific language governing permissions and
|
|
|
|
// limitations under the License.
|
|
|
|
-->
|
2022-03-31 08:32:42 +00:00
|
|
|
<script lang="ts">
|
|
|
|
import { Ref, Space } from '@anticrm/core'
|
2022-05-06 06:42:45 +00:00
|
|
|
import { getClient } from '@anticrm/presentation'
|
2022-04-19 09:38:31 +00:00
|
|
|
import { Button, showPopup } from '@anticrm/ui'
|
2022-03-31 08:32:42 +00:00
|
|
|
import tracker from '../plugin'
|
|
|
|
import CreateIssue from './CreateIssue.svelte'
|
2022-05-06 06:42:45 +00:00
|
|
|
|
|
|
|
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
|
|
|
|
}
|
2022-03-31 08:32:42 +00:00
|
|
|
|
2022-04-28 09:53:35 +00:00
|
|
|
async function newIssue (): Promise<void> {
|
2022-05-06 06:42:45 +00:00
|
|
|
if (space) {
|
|
|
|
showPopup(CreateIssue, { space }, 'top')
|
|
|
|
}
|
2022-03-31 08:32:42 +00:00
|
|
|
}
|
|
|
|
</script>
|
|
|
|
|
2022-04-02 04:06:48 +00:00
|
|
|
<div class="antiNav-subheader gap-2">
|
|
|
|
<div class="flex-grow text-md">
|
2022-03-31 08:32:42 +00:00
|
|
|
<Button
|
2022-04-02 04:06:48 +00:00
|
|
|
icon={tracker.icon.NewIssue}
|
2022-03-31 08:32:42 +00:00
|
|
|
label={tracker.string.NewIssue}
|
2022-04-02 04:06:48 +00:00
|
|
|
justify={'left'}
|
2022-03-31 08:32:42 +00:00
|
|
|
width={'100%'}
|
2022-05-06 06:42:45 +00:00
|
|
|
on:click={newIssue}
|
2022-03-31 08:32:42 +00:00
|
|
|
/>
|
|
|
|
</div>
|
2022-04-02 04:06:48 +00:00
|
|
|
<Button icon={tracker.icon.Magnifier} on:click={async () => {}} />
|
2022-03-31 08:32:42 +00:00
|
|
|
</div>
|