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">
|
|
|
|
import { WithLookup } from '@anticrm/core'
|
2022-08-03 07:05:19 +00:00
|
|
|
import { AttributeBarEditor, createQuery, getClient, KeyedAttribute } from '@anticrm/presentation'
|
|
|
|
import tags from '@anticrm/tags'
|
2022-05-18 04:04:54 +00:00
|
|
|
import type { Issue, IssueStatus } from '@anticrm/tracker'
|
2022-06-19 16:27:47 +00:00
|
|
|
import { Component, Label } from '@anticrm/ui'
|
2022-08-03 07:05:19 +00:00
|
|
|
import { getFiltredKeys, isCollectionAttr } from '@anticrm/view-resources/src/utils'
|
2022-05-18 04:04:54 +00:00
|
|
|
import tracker from '../../../plugin'
|
|
|
|
import ProjectEditor from '../../projects/ProjectEditor.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
|
|
|
|
export let issueStatuses: WithLookup<IssueStatus>[]
|
2022-07-01 06:14:31 +00:00
|
|
|
|
|
|
|
const query = createQuery()
|
|
|
|
let showIsBlocking = false
|
|
|
|
query.query(tracker.class.Issue, { blockedBy: issue._id }, (result) => {
|
|
|
|
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))
|
|
|
|
}
|
|
|
|
|
|
|
|
$: updateKeys(['title', 'description', 'priority', 'status', 'number', 'assignee', 'project', 'dueDate', 'sprint'])
|
2022-05-18 04:04:54 +00:00
|
|
|
</script>
|
|
|
|
|
|
|
|
<div class="content">
|
|
|
|
<span class="label">
|
|
|
|
<Label label={tracker.string.Status} />
|
|
|
|
</span>
|
2022-08-03 07:05:19 +00:00
|
|
|
|
2022-05-18 04:04:54 +00:00
|
|
|
<StatusEditor value={issue} statuses={issueStatuses} shouldShowLabel />
|
|
|
|
|
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>
|
|
|
|
<RelationEditor value={issue} type="isBlocking" />
|
|
|
|
{/if}
|
|
|
|
{#if issue.relatedIssue?.length}
|
|
|
|
<span class="labelTop">
|
|
|
|
<Label label={tracker.string.Related} />
|
|
|
|
</span>
|
|
|
|
<RelationEditor value={issue} type="relatedIssue" />
|
|
|
|
{/if}
|
|
|
|
|
2022-05-18 04:04:54 +00:00
|
|
|
<span class="label">
|
|
|
|
<Label label={tracker.string.Priority} />
|
|
|
|
</span>
|
|
|
|
<PriorityEditor value={issue} shouldShowLabel />
|
|
|
|
|
|
|
|
<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">
|
|
|
|
<Label label={tracker.string.Project} />
|
|
|
|
</span>
|
|
|
|
<ProjectEditor value={issue} />
|
|
|
|
|
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)}
|
|
|
|
<AttributeBarEditor {key} _class={issue._class} object={issue} showHeader={true} />
|
|
|
|
{/each}
|
|
|
|
{/if}
|
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>
|