2022-05-18 04:04:54 +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">
|
2023-04-14 17:18:23 +00:00
|
|
|
import { EmployeeAccount } from '@hcengineering/contact'
|
|
|
|
import { EmployeeBox, employeeAccountByIdStore, employeeByIdStore } from '@hcengineering/contact-resources'
|
2023-03-22 10:08:19 +00:00
|
|
|
import core, { ClassifierKind, Doc, Mixin, Ref } from '@hcengineering/core'
|
2023-04-14 17:18:23 +00:00
|
|
|
import { AttributeBarEditor, KeyedAttribute, createQuery, getClient } from '@hcengineering/presentation'
|
2023-03-16 03:15:35 +00:00
|
|
|
|
2022-09-21 08:08:25 +00:00
|
|
|
import tags from '@hcengineering/tags'
|
2023-03-22 10:08:19 +00:00
|
|
|
import type { Issue } from '@hcengineering/tracker'
|
2022-09-21 08:08:25 +00:00
|
|
|
import { Component, Label } from '@hcengineering/ui'
|
2023-04-14 17:18:23 +00:00
|
|
|
import { ObjectBox, getFiltredKeys, isCollectionAttr } from '@hcengineering/view-resources'
|
2022-05-18 04:04:54 +00:00
|
|
|
import tracker from '../../../plugin'
|
2023-03-17 06:17:53 +00:00
|
|
|
import ComponentEditor from '../../components/ComponentEditor.svelte'
|
2022-08-03 07:05:19 +00:00
|
|
|
import SprintEditor from '../../sprints/SprintEditor.svelte'
|
2022-05-18 04:04:54 +00:00
|
|
|
import AssigneeEditor from '../AssigneeEditor.svelte'
|
|
|
|
import DueDateEditor from '../DueDateEditor.svelte'
|
2022-08-03 07:05:19 +00:00
|
|
|
import PriorityEditor from '../PriorityEditor.svelte'
|
2022-07-01 06:14:31 +00:00
|
|
|
import RelationEditor from '../RelationEditor.svelte'
|
2022-08-03 07:05:19 +00:00
|
|
|
import StatusEditor from '../StatusEditor.svelte'
|
2022-05-18 04:04:54 +00:00
|
|
|
|
|
|
|
export let issue: Issue
|
2023-02-17 15:16:36 +00:00
|
|
|
export let showAllMixins: boolean = false
|
2022-07-01 06:14:31 +00:00
|
|
|
|
|
|
|
const query = createQuery()
|
|
|
|
let showIsBlocking = false
|
2022-09-09 03:44:33 +00:00
|
|
|
let blockedBy: Doc[]
|
|
|
|
$: query.query(tracker.class.Issue, { blockedBy: { _id: issue._id, _class: issue._class } }, (result) => {
|
|
|
|
blockedBy = result
|
2022-07-01 06:14:31 +00:00
|
|
|
showIsBlocking = result.length > 0
|
|
|
|
})
|
2022-08-03 07:05:19 +00:00
|
|
|
|
|
|
|
const client = getClient()
|
|
|
|
const hierarchy = client.getHierarchy()
|
|
|
|
|
|
|
|
let keys: KeyedAttribute[] = []
|
|
|
|
|
|
|
|
function updateKeys (ignoreKeys: string[]): void {
|
|
|
|
const filtredKeys = getFiltredKeys(hierarchy, issue._class, ignoreKeys)
|
|
|
|
keys = filtredKeys.filter((key) => !isCollectionAttr(hierarchy, key))
|
|
|
|
}
|
|
|
|
|
2023-02-17 15:16:36 +00:00
|
|
|
let mixins: Mixin<Doc>[] = []
|
|
|
|
|
|
|
|
$: getMixins(issue, showAllMixins)
|
|
|
|
|
|
|
|
function getMixins (object: Issue, showAllMixins: boolean): void {
|
2023-03-29 09:18:59 +00:00
|
|
|
const descendants = hierarchy.getDescendants(core.class.Doc).map((p) => hierarchy.getClass(p))
|
2023-02-17 15:16:36 +00:00
|
|
|
|
|
|
|
mixins = descendants.filter(
|
|
|
|
(m) =>
|
|
|
|
m.kind === ClassifierKind.MIXIN &&
|
|
|
|
(hierarchy.hasMixin(object, m._id) ||
|
|
|
|
(showAllMixins && hierarchy.isDerived(tracker.class.Issue, hierarchy.getBaseClass(m._id))))
|
|
|
|
)
|
|
|
|
}
|
|
|
|
|
|
|
|
function getMixinKeys (mixin: Ref<Mixin<Doc>>): KeyedAttribute[] {
|
|
|
|
const filtredKeys = getFiltredKeys(hierarchy, mixin, [], issue._class)
|
|
|
|
const res = filtredKeys.filter((key) => !isCollectionAttr(hierarchy, key))
|
|
|
|
return res
|
|
|
|
}
|
|
|
|
|
2023-03-28 11:42:21 +00:00
|
|
|
$: updateKeys([
|
|
|
|
'title',
|
|
|
|
'description',
|
|
|
|
'priority',
|
|
|
|
'status',
|
|
|
|
'number',
|
|
|
|
'assignee',
|
|
|
|
'component',
|
|
|
|
'dueDate',
|
|
|
|
'sprint',
|
|
|
|
'relations',
|
|
|
|
'blockedBy'
|
|
|
|
])
|
2023-03-16 03:15:35 +00:00
|
|
|
|
|
|
|
let account: EmployeeAccount | undefined
|
2023-03-17 16:05:22 +00:00
|
|
|
$: employee = account && $employeeByIdStore.get(account.employee)
|
2023-03-16 03:15:35 +00:00
|
|
|
|
2023-04-14 17:18:23 +00:00
|
|
|
$: account = $employeeAccountByIdStore.get(issue.createdBy as Ref<EmployeeAccount>)
|
2022-05-18 04:04:54 +00:00
|
|
|
</script>
|
|
|
|
|
|
|
|
<div class="content">
|
2022-10-10 06:35:27 +00:00
|
|
|
{#if issue.template?.template}
|
|
|
|
<span class="label">
|
|
|
|
<Label label={tracker.string.IssueTemplate} />
|
|
|
|
</span>
|
|
|
|
<ObjectBox
|
|
|
|
_class={tracker.class.IssueTemplate}
|
|
|
|
value={issue.template?.template}
|
|
|
|
size={'small'}
|
|
|
|
kind={'link'}
|
|
|
|
width={'100%'}
|
|
|
|
label={tracker.string.NoIssueTemplate}
|
|
|
|
icon={tracker.icon.Issues}
|
|
|
|
searchField={'title'}
|
|
|
|
allowDeselect={true}
|
|
|
|
showNavigate={false}
|
|
|
|
readonly
|
|
|
|
docProps={{ disableClick: true }}
|
|
|
|
/>
|
|
|
|
{/if}
|
|
|
|
|
2022-05-18 04:04:54 +00:00
|
|
|
<span class="label">
|
|
|
|
<Label label={tracker.string.Status} />
|
|
|
|
</span>
|
2022-08-03 07:05:19 +00:00
|
|
|
|
2023-03-22 10:08:19 +00:00
|
|
|
<StatusEditor value={issue} shouldShowLabel />
|
2022-05-18 04:04:54 +00:00
|
|
|
|
2022-07-01 06:14:31 +00:00
|
|
|
{#if issue.blockedBy?.length}
|
|
|
|
<span class="labelTop">
|
|
|
|
<Label label={tracker.string.BlockedBy} />
|
|
|
|
</span>
|
|
|
|
<RelationEditor value={issue} type="blockedBy" />
|
|
|
|
{/if}
|
|
|
|
{#if showIsBlocking}
|
|
|
|
<span class="labelTop">
|
|
|
|
<Label label={tracker.string.Blocks} />
|
|
|
|
</span>
|
2022-09-09 03:44:33 +00:00
|
|
|
<RelationEditor value={issue} type="isBlocking" {blockedBy} />
|
2022-07-01 06:14:31 +00:00
|
|
|
{/if}
|
2022-09-09 03:44:33 +00:00
|
|
|
{#if issue.relations?.length}
|
2022-07-01 06:14:31 +00:00
|
|
|
<span class="labelTop">
|
|
|
|
<Label label={tracker.string.Related} />
|
|
|
|
</span>
|
2022-09-09 03:44:33 +00:00
|
|
|
<RelationEditor value={issue} type="relations" />
|
2022-07-01 06:14:31 +00:00
|
|
|
{/if}
|
|
|
|
|
2022-05-18 04:04:54 +00:00
|
|
|
<span class="label">
|
|
|
|
<Label label={tracker.string.Priority} />
|
|
|
|
</span>
|
|
|
|
<PriorityEditor value={issue} shouldShowLabel />
|
|
|
|
|
2023-03-16 03:15:35 +00:00
|
|
|
<span class="label">
|
|
|
|
<Label label={core.string.CreatedBy} />
|
|
|
|
</span>
|
2023-03-22 15:55:08 +00:00
|
|
|
<EmployeeBox
|
|
|
|
value={employee?._id}
|
|
|
|
label={core.string.CreatedBy}
|
|
|
|
kind={'link'}
|
|
|
|
size={'large'}
|
|
|
|
width={'100%'}
|
|
|
|
showNavigate={false}
|
|
|
|
readonly
|
|
|
|
/>
|
2023-03-16 03:15:35 +00:00
|
|
|
|
2022-05-18 04:04:54 +00:00
|
|
|
<span class="label">
|
|
|
|
<Label label={tracker.string.Assignee} />
|
|
|
|
</span>
|
|
|
|
<AssigneeEditor value={issue} />
|
|
|
|
|
2022-06-29 05:55:11 +00:00
|
|
|
<span class="labelTop">
|
2022-05-18 04:04:54 +00:00
|
|
|
<Label label={tracker.string.Labels} />
|
|
|
|
</span>
|
2022-06-29 05:55:11 +00:00
|
|
|
<Component is={tags.component.TagsAttributeEditor} props={{ object: issue, label: tracker.string.AddLabel }} />
|
2022-05-18 04:04:54 +00:00
|
|
|
|
|
|
|
<div class="divider" />
|
|
|
|
|
|
|
|
<span class="label">
|
2023-03-17 06:17:53 +00:00
|
|
|
<Label label={tracker.string.Component} />
|
2022-05-18 04:04:54 +00:00
|
|
|
</span>
|
2023-03-17 06:17:53 +00:00
|
|
|
<ComponentEditor value={issue} />
|
2022-05-18 04:04:54 +00:00
|
|
|
|
2022-08-03 07:05:19 +00:00
|
|
|
{#if issue.sprint}
|
|
|
|
<span class="label">
|
|
|
|
<Label label={tracker.string.Sprint} />
|
|
|
|
</span>
|
|
|
|
<SprintEditor value={issue} />
|
|
|
|
{/if}
|
|
|
|
|
2022-05-18 04:04:54 +00:00
|
|
|
{#if issue.dueDate !== null}
|
|
|
|
<div class="divider" />
|
|
|
|
|
|
|
|
<span class="label">
|
|
|
|
<Label label={tracker.string.DueDate} />
|
|
|
|
</span>
|
|
|
|
<DueDateEditor value={issue} />
|
|
|
|
{/if}
|
2022-08-03 07:05:19 +00:00
|
|
|
|
|
|
|
{#if keys.length > 0}
|
|
|
|
<div class="divider" />
|
|
|
|
{#each keys as key (typeof key === 'string' ? key : key.key)}
|
2023-04-06 04:51:13 +00:00
|
|
|
<AttributeBarEditor {key} _class={issue._class} object={issue} showHeader={true} size={'large'} />
|
2022-08-03 07:05:19 +00:00
|
|
|
{/each}
|
|
|
|
{/if}
|
2023-02-17 15:16:36 +00:00
|
|
|
|
|
|
|
{#each mixins as mixin}
|
|
|
|
<div class="divider" />
|
|
|
|
{#each getMixinKeys(mixin._id) as key (typeof key === 'string' ? key : key.key)}
|
2023-04-06 04:51:13 +00:00
|
|
|
<AttributeBarEditor
|
|
|
|
{key}
|
|
|
|
_class={mixin._id}
|
|
|
|
object={hierarchy.as(issue, mixin._id)}
|
|
|
|
showHeader={true}
|
|
|
|
size={'large'}
|
|
|
|
/>
|
2023-02-17 15:16:36 +00:00
|
|
|
{/each}
|
|
|
|
{/each}
|
2022-05-18 04:04:54 +00:00
|
|
|
</div>
|
|
|
|
|
|
|
|
<style lang="scss">
|
|
|
|
.content {
|
|
|
|
display: grid;
|
|
|
|
grid-template-columns: 1fr 1.5fr;
|
|
|
|
grid-auto-flow: row;
|
|
|
|
justify-content: start;
|
|
|
|
align-items: center;
|
|
|
|
gap: 1rem;
|
|
|
|
margin-top: 1rem;
|
|
|
|
width: 100%;
|
|
|
|
height: min-content;
|
|
|
|
}
|
|
|
|
|
|
|
|
.divider {
|
|
|
|
grid-column: 1 / 3;
|
|
|
|
height: 1px;
|
|
|
|
background-color: var(--divider-color);
|
|
|
|
}
|
2022-06-29 05:55:11 +00:00
|
|
|
.labelTop {
|
|
|
|
align-self: start;
|
|
|
|
margin-top: 0.385rem;
|
|
|
|
}
|
2022-05-18 04:04:54 +00:00
|
|
|
</style>
|