2022-06-09 14:49:10 +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.
|
|
|
|
-->
|
|
|
|
<script lang="ts">
|
2022-09-21 08:08:25 +00:00
|
|
|
import attachment from '@hcengineering/attachment'
|
|
|
|
import { AttachmentDocList } from '@hcengineering/attachment-resources'
|
|
|
|
import chunter from '@hcengineering/chunter'
|
|
|
|
import { CommentPopup } from '@hcengineering/chunter-resources'
|
2023-03-24 10:23:44 +00:00
|
|
|
import { Ref } from '@hcengineering/core'
|
2023-05-17 09:47:21 +00:00
|
|
|
import { createQuery, getClient, MessageViewer, IconForward } from '@hcengineering/presentation'
|
2023-03-24 10:23:44 +00:00
|
|
|
import { Issue, Project } from '@hcengineering/tracker'
|
2023-05-17 09:47:21 +00:00
|
|
|
import { Label, Scroller, resizeObserver } from '@hcengineering/ui'
|
2022-06-09 14:49:10 +00:00
|
|
|
import tracker from '../../plugin'
|
|
|
|
import AssigneeEditor from './AssigneeEditor.svelte'
|
2023-03-22 10:08:19 +00:00
|
|
|
import IssueStatusActivity from './IssueStatusActivity.svelte'
|
2022-06-09 14:49:10 +00:00
|
|
|
import PriorityEditor from './PriorityEditor.svelte'
|
|
|
|
import StatusEditor from './StatusEditor.svelte'
|
|
|
|
|
|
|
|
export let object: Issue
|
|
|
|
let issue: Issue | undefined
|
|
|
|
|
|
|
|
const client = getClient()
|
|
|
|
$: space = object.space
|
|
|
|
const issueQuery = createQuery()
|
|
|
|
const spaceQuery = createQuery()
|
|
|
|
|
2022-06-18 08:11:10 +00:00
|
|
|
$: issueQuery.query(
|
2022-06-09 14:49:10 +00:00
|
|
|
object._class,
|
|
|
|
{ _id: object._id },
|
|
|
|
(res) => {
|
|
|
|
issue = res[0]
|
|
|
|
},
|
|
|
|
{ limit: 1 }
|
|
|
|
)
|
|
|
|
|
2023-03-17 06:17:53 +00:00
|
|
|
let currentProject: Project | undefined
|
2022-06-09 14:49:10 +00:00
|
|
|
|
2023-03-17 06:17:53 +00:00
|
|
|
$: spaceQuery.query(tracker.class.Project, { _id: space }, (res) => ([currentProject] = res))
|
|
|
|
$: issueName = currentProject && issue && `${currentProject.identifier}-${issue.number}`
|
2022-06-09 14:49:10 +00:00
|
|
|
|
|
|
|
const limit: number = 350
|
2023-05-17 09:47:21 +00:00
|
|
|
let cHeight: number = 0
|
2022-06-09 14:49:10 +00:00
|
|
|
|
|
|
|
let parent: Issue | undefined
|
|
|
|
|
|
|
|
async function getParent (attachedTo: Ref<Issue> | undefined): Promise<void> {
|
|
|
|
if (attachedTo === undefined || attachedTo === tracker.ids.NoParent) {
|
|
|
|
parent = undefined
|
|
|
|
} else {
|
|
|
|
parent = await client.findOne(tracker.class.Issue, { _id: attachedTo })
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
$: getParent(issue?.attachedTo as Ref<Issue>)
|
|
|
|
</script>
|
|
|
|
|
2023-05-17 09:47:21 +00:00
|
|
|
{#if issue}
|
|
|
|
<div class="ap-header flex-between">
|
|
|
|
<div class="flex-col">
|
|
|
|
<div class="flex-row-center gap-1">
|
|
|
|
{#if parent}
|
|
|
|
<span class="overflow-label content-color">{parent.title}</span>
|
|
|
|
<IconForward size={'x-small'} />
|
2022-07-05 05:41:03 +00:00
|
|
|
{/if}
|
2023-05-17 09:47:21 +00:00
|
|
|
<span class="content-dark-color">{issueName}</span>
|
|
|
|
</div>
|
|
|
|
<span class="overflow-label text-xl caption-color">{issue.title}</span>
|
|
|
|
</div>
|
|
|
|
</div>
|
2023-06-07 17:44:14 +00:00
|
|
|
<Scroller padding={'0.75rem 1.75rem 0'} noFade>
|
2023-05-17 09:47:21 +00:00
|
|
|
<div class="flex-row-center gap-2 mb-2">
|
|
|
|
<StatusEditor value={issue} shouldShowLabel kind={'secondary'} />
|
|
|
|
<PriorityEditor value={issue} shouldShowLabel kind={'secondary'} />
|
|
|
|
{#if issue.assignee}
|
2023-06-01 16:38:53 +00:00
|
|
|
<AssigneeEditor object={issue} kind={'secondary'} />
|
2022-07-05 05:41:03 +00:00
|
|
|
{/if}
|
2022-06-18 08:11:10 +00:00
|
|
|
</div>
|
2023-05-17 09:47:21 +00:00
|
|
|
|
|
|
|
<div class="grid-preview">
|
|
|
|
<IssueStatusActivity {issue} accentHeader />
|
|
|
|
</div>
|
|
|
|
|
|
|
|
<div class="mt-6 mb-2 overflow-label fs-bold content-dark-color">
|
|
|
|
<Label label={tracker.string.Description} />:
|
|
|
|
</div>
|
|
|
|
{#if issue.description}
|
|
|
|
<div class="description-container" class:masked={cHeight > limit} style:max-height={`${limit}px`}>
|
|
|
|
<div class="description-content" use:resizeObserver={(element) => (cHeight = element.clientHeight)}>
|
|
|
|
<MessageViewer message={issue.description} />
|
|
|
|
</div>
|
|
|
|
</div>
|
|
|
|
{:else}
|
|
|
|
<div class="overflow-label content-darker-color">
|
|
|
|
<Label label={tracker.string.NoDescription} />
|
|
|
|
</div>
|
|
|
|
{/if}
|
|
|
|
{#if issue.attachments}
|
|
|
|
<div class="mt-6 mb-2 overflow-label fs-bold content-dark-color">
|
|
|
|
<Label label={attachment.string.Attachments} />:
|
|
|
|
</div>
|
|
|
|
<AttachmentDocList value={issue} />
|
|
|
|
{/if}
|
|
|
|
{#if issue.comments}
|
|
|
|
<div class="mt-6 mb-2 overflow-label fs-bold content-dark-color">
|
|
|
|
<Label label={chunter.string.Comments} />:
|
|
|
|
</div>
|
|
|
|
<CommentPopup objectId={issue._id} object={issue} />
|
|
|
|
{/if}
|
|
|
|
<div class="h-3 flex-no-shrink" />
|
2022-07-05 05:41:03 +00:00
|
|
|
</Scroller>
|
2023-05-17 09:47:21 +00:00
|
|
|
<div class="h-3 flex-no-shrink" />
|
|
|
|
{/if}
|
2022-06-09 14:49:10 +00:00
|
|
|
|
|
|
|
<style lang="scss">
|
2023-05-17 09:47:21 +00:00
|
|
|
.description-container {
|
2022-06-09 14:49:10 +00:00
|
|
|
overflow: hidden;
|
2023-05-17 09:47:21 +00:00
|
|
|
height: auto;
|
|
|
|
min-height: 0;
|
2022-06-09 14:49:10 +00:00
|
|
|
|
2023-05-17 09:47:21 +00:00
|
|
|
&.masked {
|
|
|
|
mask-image: linear-gradient(0deg, #0000 0, #000f 4rem);
|
|
|
|
}
|
|
|
|
.description-content {
|
|
|
|
width: 100%;
|
|
|
|
min-width: 0;
|
|
|
|
height: max-content;
|
|
|
|
min-height: 0;
|
2022-06-09 14:49:10 +00:00
|
|
|
}
|
|
|
|
}
|
2023-05-17 09:47:21 +00:00
|
|
|
.grid-preview {
|
|
|
|
display: grid;
|
|
|
|
grid-template-columns: 1fr 2fr;
|
|
|
|
grid-auto-rows: minmax(2rem, max-content);
|
|
|
|
justify-content: start;
|
|
|
|
align-items: center;
|
|
|
|
row-gap: 0.25rem;
|
|
|
|
column-gap: 1rem;
|
|
|
|
margin-top: 0.5rem;
|
2022-07-05 05:41:03 +00:00
|
|
|
}
|
2022-06-09 14:49:10 +00:00
|
|
|
</style>
|