2022-06-15 04:59:43 +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-05-24 16:53:06 +00:00
|
|
|
import { AttachmentsPresenter } from '@hcengineering/attachment-resources'
|
|
|
|
import { CommentsPresenter } from '@hcengineering/chunter-resources'
|
2023-04-04 06:11:49 +00:00
|
|
|
import {
|
|
|
|
CategoryType,
|
|
|
|
Class,
|
|
|
|
Doc,
|
|
|
|
DocumentQuery,
|
|
|
|
DocumentUpdate,
|
|
|
|
generateId,
|
|
|
|
Lookup,
|
|
|
|
Ref,
|
|
|
|
WithLookup
|
|
|
|
} from '@hcengineering/core'
|
|
|
|
import { Item, Kanban } from '@hcengineering/kanban'
|
2022-09-21 08:08:25 +00:00
|
|
|
import notification from '@hcengineering/notification'
|
2023-01-14 10:54:54 +00:00
|
|
|
import { getResource } from '@hcengineering/platform'
|
2023-09-30 16:52:27 +00:00
|
|
|
import { ActionContext, createQuery, getClient } from '@hcengineering/presentation'
|
2022-09-21 08:08:25 +00:00
|
|
|
import tags from '@hcengineering/tags'
|
2023-04-04 06:11:49 +00:00
|
|
|
import { Issue, IssuesGrouping, IssuesOrdering, Project } from '@hcengineering/tracker'
|
2022-08-05 07:48:31 +00:00
|
|
|
import {
|
|
|
|
Button,
|
2023-05-24 16:53:06 +00:00
|
|
|
ColorDefinition,
|
2022-08-05 07:48:31 +00:00
|
|
|
Component,
|
2023-05-24 16:53:06 +00:00
|
|
|
defaultBackground,
|
2022-08-05 07:48:31 +00:00
|
|
|
getEventPositionElement,
|
|
|
|
IconAdd,
|
2023-04-04 06:11:49 +00:00
|
|
|
Label,
|
2022-08-05 07:48:31 +00:00
|
|
|
Loading,
|
|
|
|
showPopup,
|
2023-07-03 12:15:48 +00:00
|
|
|
themeStore
|
2022-09-21 08:08:25 +00:00
|
|
|
} from '@hcengineering/ui'
|
2023-04-04 06:11:49 +00:00
|
|
|
import {
|
|
|
|
AttributeModel,
|
2023-05-31 08:40:47 +00:00
|
|
|
BuildModelKey,
|
2023-04-04 06:11:49 +00:00
|
|
|
CategoryOption,
|
|
|
|
Viewlet,
|
|
|
|
ViewOptionModel,
|
|
|
|
ViewOptions,
|
|
|
|
ViewQueryOption
|
|
|
|
} from '@hcengineering/view'
|
2023-01-14 10:54:54 +00:00
|
|
|
import {
|
2023-05-31 08:40:47 +00:00
|
|
|
enabledConfig,
|
2023-01-14 10:54:54 +00:00
|
|
|
focusStore,
|
2023-03-22 02:48:57 +00:00
|
|
|
getCategories,
|
2023-04-14 14:34:03 +00:00
|
|
|
getCategorySpaces,
|
2023-04-04 06:11:49 +00:00
|
|
|
getGroupByValues,
|
|
|
|
getPresenter,
|
|
|
|
groupBy,
|
2023-01-14 10:54:54 +00:00
|
|
|
ListSelectionProvider,
|
2023-03-22 02:48:57 +00:00
|
|
|
Menu,
|
2023-01-14 10:54:54 +00:00
|
|
|
noCategory,
|
2023-09-30 16:52:27 +00:00
|
|
|
openDoc,
|
2023-01-14 10:54:54 +00:00
|
|
|
SelectDirection,
|
2023-11-01 13:55:11 +00:00
|
|
|
setGroupByValues,
|
|
|
|
statusStore
|
2023-01-14 10:54:54 +00:00
|
|
|
} from '@hcengineering/view-resources'
|
2023-04-04 06:11:49 +00:00
|
|
|
import view from '@hcengineering/view-resources/src/plugin'
|
2022-06-15 04:59:43 +00:00
|
|
|
import { onMount } from 'svelte'
|
|
|
|
import tracker from '../../plugin'
|
2023-10-16 11:20:23 +00:00
|
|
|
import { activeProjects } from '../../utils'
|
2023-03-17 06:17:53 +00:00
|
|
|
import ComponentEditor from '../components/ComponentEditor.svelte'
|
2023-03-17 16:05:22 +00:00
|
|
|
import CreateIssue from '../CreateIssue.svelte'
|
2023-06-01 16:38:53 +00:00
|
|
|
import AssigneeEditor from './AssigneeEditor.svelte'
|
2023-05-24 16:53:06 +00:00
|
|
|
import DueDatePresenter from './DueDatePresenter.svelte'
|
2022-06-16 04:24:17 +00:00
|
|
|
import SubIssuesSelector from './edit/SubIssuesSelector.svelte'
|
2022-06-15 04:59:43 +00:00
|
|
|
import IssuePresenter from './IssuePresenter.svelte'
|
2022-06-27 06:04:26 +00:00
|
|
|
import ParentNamesPresenter from './ParentNamesPresenter.svelte'
|
2022-06-15 04:59:43 +00:00
|
|
|
import PriorityEditor from './PriorityEditor.svelte'
|
2022-07-04 18:14:53 +00:00
|
|
|
import StatusEditor from './StatusEditor.svelte'
|
2022-10-11 11:50:56 +00:00
|
|
|
import EstimationEditor from './timereport/EstimationEditor.svelte'
|
2023-11-01 13:55:11 +00:00
|
|
|
import { getStates } from '@hcengineering/task'
|
|
|
|
import { typeStore } from '@hcengineering/task-resources'
|
2022-06-15 04:59:43 +00:00
|
|
|
|
2023-03-17 06:17:53 +00:00
|
|
|
export let space: Ref<Project> | undefined = undefined
|
2022-06-15 04:59:43 +00:00
|
|
|
export let baseMenuClass: Ref<Class<Doc>> | undefined = undefined
|
2022-06-23 11:09:18 +00:00
|
|
|
export let query: DocumentQuery<Issue> = {}
|
2023-01-18 05:14:59 +00:00
|
|
|
export let viewOptionsConfig: ViewOptionModel[] | undefined
|
|
|
|
export let viewOptions: ViewOptions
|
2023-03-23 05:41:27 +00:00
|
|
|
export let viewlet: Viewlet
|
2023-05-31 08:40:47 +00:00
|
|
|
export let config: (string | BuildModelKey)[]
|
2022-06-15 04:59:43 +00:00
|
|
|
|
2023-03-17 06:17:53 +00:00
|
|
|
$: currentSpace = space || tracker.project.DefaultProject
|
2023-04-04 06:11:49 +00:00
|
|
|
$: groupByKey = (viewOptions.groupBy[0] ?? noCategory) as IssuesGrouping
|
2023-01-18 05:14:59 +00:00
|
|
|
$: orderBy = viewOptions.orderBy
|
2023-01-14 10:54:54 +00:00
|
|
|
$: sort = { [orderBy[0]]: orderBy[1] }
|
2023-04-04 06:11:49 +00:00
|
|
|
|
2023-05-24 16:53:06 +00:00
|
|
|
let accentColors: Map<string, ColorDefinition> = new Map()
|
|
|
|
const setAccentColor = (n: number, ev: CustomEvent<ColorDefinition>) => {
|
|
|
|
accentColors.set(`${n}${$themeStore.dark}${groupByKey}`, ev.detail)
|
|
|
|
accentColors = accentColors
|
|
|
|
}
|
2023-04-04 06:11:49 +00:00
|
|
|
|
2023-01-14 10:54:54 +00:00
|
|
|
$: dontUpdateRank = orderBy[0] !== IssuesOrdering.Manual
|
2022-06-15 04:59:43 +00:00
|
|
|
|
2023-03-17 06:17:53 +00:00
|
|
|
let currentProject: Project | undefined
|
2023-10-16 11:20:23 +00:00
|
|
|
$: currentProject = $activeProjects.get(currentSpace)
|
2022-06-16 04:24:17 +00:00
|
|
|
|
2023-01-14 10:54:54 +00:00
|
|
|
let resultQuery: DocumentQuery<any> = query
|
2023-01-18 05:14:59 +00:00
|
|
|
$: getResultQuery(query, viewOptionsConfig, viewOptions).then((p) => (resultQuery = p))
|
2023-01-14 10:54:54 +00:00
|
|
|
|
|
|
|
const client = getClient()
|
|
|
|
const hierarchy = client.getHierarchy()
|
|
|
|
|
|
|
|
async function getResultQuery (
|
|
|
|
query: DocumentQuery<Issue>,
|
|
|
|
viewOptions: ViewOptionModel[] | undefined,
|
|
|
|
viewOptionsStore: ViewOptions
|
|
|
|
): Promise<DocumentQuery<Issue>> {
|
|
|
|
if (viewOptions === undefined) return query
|
|
|
|
let result = hierarchy.clone(query)
|
|
|
|
for (const viewOption of viewOptions) {
|
2023-03-23 05:41:27 +00:00
|
|
|
if (viewOption.actionTarget !== 'query') continue
|
2023-01-14 10:54:54 +00:00
|
|
|
const queryOption = viewOption as ViewQueryOption
|
|
|
|
const f = await getResource(queryOption.action)
|
|
|
|
result = f(viewOptionsStore[queryOption.key] ?? queryOption.defaultValue, query)
|
|
|
|
}
|
|
|
|
return result
|
|
|
|
}
|
|
|
|
|
2022-06-15 04:59:43 +00:00
|
|
|
function toIssue (object: any): WithLookup<Issue> {
|
|
|
|
return object as WithLookup<Issue>
|
|
|
|
}
|
|
|
|
|
2022-06-28 06:53:39 +00:00
|
|
|
const lookup: Lookup<Issue> = {
|
2023-03-17 06:17:53 +00:00
|
|
|
space: tracker.class.Project,
|
2023-04-04 06:11:49 +00:00
|
|
|
status: tracker.class.IssueStatus,
|
|
|
|
component: tracker.class.Component,
|
2023-05-16 11:56:29 +00:00
|
|
|
milestone: tracker.class.Milestone,
|
2022-06-28 06:53:39 +00:00
|
|
|
_id: {
|
2023-04-04 06:11:49 +00:00
|
|
|
subIssues: tracker.class.Issue,
|
|
|
|
labels: tags.class.TagReference
|
2022-06-15 04:59:43 +00:00
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
let kanbanUI: Kanban
|
|
|
|
const listProvider = new ListSelectionProvider((offset: 1 | -1 | 0, of?: Doc, dir?: SelectDirection) => {
|
2023-04-23 03:50:41 +00:00
|
|
|
kanbanUI?.select(offset, of, dir)
|
2022-06-15 04:59:43 +00:00
|
|
|
})
|
2023-10-19 05:55:28 +00:00
|
|
|
const selection = listProvider.selection
|
|
|
|
|
2022-06-15 04:59:43 +00:00
|
|
|
onMount(() => {
|
|
|
|
;(document.activeElement as HTMLElement)?.blur()
|
|
|
|
})
|
|
|
|
|
|
|
|
const showMenu = async (ev: MouseEvent, items: Doc[]): Promise<void> => {
|
|
|
|
ev.preventDefault()
|
2023-04-28 14:31:06 +00:00
|
|
|
showPopup(Menu, { object: items, baseMenuClass }, getEventPositionElement(ev))
|
2022-06-15 04:59:43 +00:00
|
|
|
}
|
2022-07-06 06:11:32 +00:00
|
|
|
const issuesQuery = createQuery()
|
2023-02-08 06:42:26 +00:00
|
|
|
let issues: Issue[] = []
|
2023-04-04 06:11:49 +00:00
|
|
|
|
|
|
|
$: groupByDocs = groupBy(issues, groupByKey, categories)
|
|
|
|
|
2022-07-06 06:11:32 +00:00
|
|
|
$: issuesQuery.query(
|
|
|
|
tracker.class.Issue,
|
|
|
|
resultQuery,
|
2023-02-08 06:42:26 +00:00
|
|
|
(result) => {
|
|
|
|
issues = result
|
2022-07-06 06:11:32 +00:00
|
|
|
},
|
|
|
|
{
|
2023-04-04 06:11:49 +00:00
|
|
|
lookup,
|
|
|
|
sort
|
2023-02-08 06:42:26 +00:00
|
|
|
}
|
|
|
|
)
|
|
|
|
|
2023-04-23 03:50:41 +00:00
|
|
|
$: listProvider.update(issues)
|
|
|
|
|
2023-04-04 06:11:49 +00:00
|
|
|
let categories: CategoryType[] = []
|
2023-02-08 06:42:26 +00:00
|
|
|
|
2023-02-08 15:37:50 +00:00
|
|
|
const queryId = generateId()
|
|
|
|
|
2023-04-04 06:11:49 +00:00
|
|
|
$: updateCategories(tracker.class.Issue, issues, groupByKey, viewOptions, viewOptionsConfig)
|
2023-02-08 06:42:26 +00:00
|
|
|
|
2023-02-08 15:37:50 +00:00
|
|
|
function update () {
|
2023-04-04 06:11:49 +00:00
|
|
|
updateCategories(tracker.class.Issue, issues, groupByKey, viewOptions, viewOptionsConfig)
|
2023-02-08 15:37:50 +00:00
|
|
|
}
|
|
|
|
|
2023-02-08 06:42:26 +00:00
|
|
|
async function updateCategories (
|
|
|
|
_class: Ref<Class<Doc>>,
|
|
|
|
docs: Doc[],
|
|
|
|
groupByKey: string,
|
|
|
|
viewOptions: ViewOptions,
|
2023-04-04 06:11:49 +00:00
|
|
|
viewOptionsModel: ViewOptionModel[] | undefined
|
2022-07-06 06:11:32 +00:00
|
|
|
) {
|
2023-09-04 17:06:34 +00:00
|
|
|
categories = await getCategories(client, _class, space, docs, groupByKey, viewlet.descriptor)
|
2023-02-08 06:42:26 +00:00
|
|
|
for (const viewOption of viewOptionsModel ?? []) {
|
2023-03-23 05:41:27 +00:00
|
|
|
if (viewOption.actionTarget !== 'category') continue
|
2023-02-08 06:42:26 +00:00
|
|
|
const categoryFunc = viewOption as CategoryOption
|
|
|
|
if (viewOptions[viewOption.key] ?? viewOption.defaultValue) {
|
2023-04-04 06:11:49 +00:00
|
|
|
const categoryAction = await getResource(categoryFunc.action)
|
2023-04-14 14:34:03 +00:00
|
|
|
|
|
|
|
const spaces = getCategorySpaces(categories)
|
|
|
|
if (space !== undefined) {
|
|
|
|
spaces.push(space)
|
|
|
|
}
|
2023-04-10 07:55:22 +00:00
|
|
|
const res = await categoryAction(
|
|
|
|
_class,
|
2023-04-14 14:34:03 +00:00
|
|
|
spaces.length > 0 ? { space: { $in: Array.from(spaces.values()) } } : {},
|
2023-09-04 17:06:34 +00:00
|
|
|
space,
|
2023-04-10 07:55:22 +00:00
|
|
|
groupByKey,
|
|
|
|
update,
|
|
|
|
queryId,
|
|
|
|
viewlet.descriptor
|
|
|
|
)
|
2023-02-08 06:42:26 +00:00
|
|
|
if (res !== undefined) {
|
2023-04-04 06:11:49 +00:00
|
|
|
categories = res
|
2023-02-08 06:42:26 +00:00
|
|
|
break
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
2022-07-06 06:11:32 +00:00
|
|
|
}
|
2022-07-07 02:21:30 +00:00
|
|
|
|
|
|
|
const fullFilled: { [key: string]: boolean } = {}
|
2023-04-04 06:11:49 +00:00
|
|
|
|
|
|
|
function getHeader (_class: Ref<Class<Doc>>, groupByKey: string): void {
|
|
|
|
if (groupByKey === noCategory) {
|
|
|
|
headerComponent = undefined
|
|
|
|
} else {
|
|
|
|
getPresenter(client, _class, { key: groupByKey }, { key: groupByKey }).then((p) => (headerComponent = p))
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
let headerComponent: AttributeModel | undefined
|
|
|
|
$: getHeader(tracker.class.Issue, groupByKey)
|
|
|
|
|
|
|
|
const getUpdateProps = (doc: Doc, category: CategoryType): DocumentUpdate<Item> | undefined => {
|
|
|
|
const groupValue =
|
|
|
|
typeof category === 'object' ? category.values.find((it) => it.space === doc.space)?._id : category
|
|
|
|
if (groupValue === undefined) {
|
|
|
|
return undefined
|
|
|
|
}
|
2023-08-03 04:32:40 +00:00
|
|
|
if ((doc as any)[groupByKey] === groupValue && viewOptions.orderBy[0] !== 'rank') {
|
2023-04-18 08:22:02 +00:00
|
|
|
return
|
|
|
|
}
|
2023-04-04 06:11:49 +00:00
|
|
|
return {
|
|
|
|
[groupByKey]: groupValue,
|
|
|
|
space: doc.space
|
|
|
|
}
|
|
|
|
}
|
2023-05-31 08:40:47 +00:00
|
|
|
|
|
|
|
function shouldShowFooter (
|
|
|
|
config: (string | BuildModelKey)[],
|
|
|
|
reports: number,
|
|
|
|
estimations: number,
|
|
|
|
issue: WithLookup<Issue>
|
|
|
|
): boolean {
|
|
|
|
if (enabledConfig(config, 'estimation') && (reports > 0 || estimations > 0)) return true
|
|
|
|
if (enabledConfig(config, 'comments')) {
|
|
|
|
if ((issue.comments ?? 0) > 0) return true
|
|
|
|
if ((issue.$lookup?.attachedTo?.comments ?? 0) > 0) return true
|
|
|
|
}
|
|
|
|
if (enabledConfig(config, 'attachments') && (issue.attachments ?? 0) > 0) return true
|
|
|
|
return false
|
|
|
|
}
|
2023-11-01 13:55:11 +00:00
|
|
|
|
|
|
|
const getAvailableCategories = async (doc: Doc): Promise<CategoryType[]> => {
|
|
|
|
const issue = toIssue(doc)
|
|
|
|
|
|
|
|
if ([IssuesGrouping.Component, IssuesGrouping.Milestone].includes(groupByKey)) {
|
|
|
|
const availableCategories = []
|
|
|
|
const clazz = hierarchy.getAttribute(tracker.class.Issue, groupByKey)
|
|
|
|
|
|
|
|
for (const category of categories) {
|
|
|
|
if (!category || (issue as any)[groupByKey] === category) {
|
|
|
|
availableCategories.push(category)
|
|
|
|
} else if (clazz !== undefined && 'to' in clazz.type) {
|
|
|
|
const categoryDoc = await client.findOne(clazz.type.to as Ref<Class<Doc>>, {
|
|
|
|
_id: category as Ref<Doc>,
|
|
|
|
space: issue.space
|
|
|
|
})
|
|
|
|
|
|
|
|
if (categoryDoc) {
|
|
|
|
availableCategories.push(category)
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
return availableCategories
|
|
|
|
}
|
|
|
|
|
|
|
|
if (groupByKey === IssuesGrouping.Status) {
|
|
|
|
const space = await client.findOne(tracker.class.Project, { _id: issue.space })
|
|
|
|
return getStates(space, $typeStore, $statusStore.byId).map(({ _id }) => _id)
|
|
|
|
}
|
|
|
|
|
|
|
|
return categories
|
|
|
|
}
|
2022-06-15 04:59:43 +00:00
|
|
|
</script>
|
|
|
|
|
2023-04-11 13:39:23 +00:00
|
|
|
{#if categories.length === 0}
|
2022-07-06 06:11:32 +00:00
|
|
|
<Loading />
|
|
|
|
{:else}
|
2022-06-15 04:59:43 +00:00
|
|
|
<ActionContext
|
|
|
|
context={{
|
|
|
|
mode: 'browser'
|
|
|
|
}}
|
|
|
|
/>
|
2023-01-18 05:14:59 +00:00
|
|
|
<!-- svelte-ignore a11y-click-events-have-key-events -->
|
2022-06-15 04:59:43 +00:00
|
|
|
<Kanban
|
|
|
|
bind:this={kanbanUI}
|
2023-04-04 06:11:49 +00:00
|
|
|
{categories}
|
2023-01-14 10:54:54 +00:00
|
|
|
{dontUpdateRank}
|
2023-04-04 06:11:49 +00:00
|
|
|
objects={issues}
|
|
|
|
getGroupByValues={(groupByDocs, category) =>
|
|
|
|
groupByKey === noCategory ? issues : getGroupByValues(groupByDocs, category)}
|
|
|
|
{setGroupByValues}
|
|
|
|
{getUpdateProps}
|
|
|
|
{groupByDocs}
|
2022-06-15 04:59:43 +00:00
|
|
|
on:obj-focus={(evt) => {
|
|
|
|
listProvider.updateFocus(evt.detail)
|
|
|
|
}}
|
2023-11-01 13:55:11 +00:00
|
|
|
{getAvailableCategories}
|
2022-06-15 04:59:43 +00:00
|
|
|
selection={listProvider.current($focusStore)}
|
2023-10-19 05:55:28 +00:00
|
|
|
checked={$selection ?? []}
|
2022-06-15 04:59:43 +00:00
|
|
|
on:check={(evt) => {
|
|
|
|
listProvider.updateSelection(evt.detail.docs, evt.detail.value)
|
|
|
|
}}
|
|
|
|
on:contextmenu={(evt) => showMenu(evt.detail.evt, evt.detail.objects)}
|
|
|
|
>
|
2023-05-02 03:46:47 +00:00
|
|
|
<svelte:fragment slot="header" let:state let:count let:index>
|
2023-05-24 16:53:06 +00:00
|
|
|
{@const color = accentColors.get(`${index}${$themeStore.dark}${groupByKey}`)}
|
|
|
|
{@const headerBGColor = color?.background ?? defaultBackground($themeStore.dark)}
|
|
|
|
<div style:background={headerBGColor} class="header flex-between">
|
|
|
|
<div class="flex-row-center gap-1">
|
|
|
|
<span
|
|
|
|
class="clear-mins fs-bold overflow-label pointer-events-none"
|
|
|
|
style:color={color?.title ?? 'var(--theme-caption-color)'}
|
|
|
|
>
|
|
|
|
{#if groupByKey === noCategory}
|
|
|
|
<Label label={view.string.NoGrouping} />
|
|
|
|
{:else if headerComponent}
|
|
|
|
<svelte:component
|
|
|
|
this={headerComponent.presenter}
|
|
|
|
value={state}
|
|
|
|
{space}
|
|
|
|
size={'small'}
|
|
|
|
kind={'list-header'}
|
2023-05-29 18:17:14 +00:00
|
|
|
display={'kanban'}
|
2023-05-24 16:53:06 +00:00
|
|
|
colorInherit={!$themeStore.dark}
|
|
|
|
accent
|
|
|
|
on:accent-color={(ev) => setAccentColor(index, ev)}
|
|
|
|
/>
|
|
|
|
{/if}
|
|
|
|
</span>
|
|
|
|
<span class="counter">
|
|
|
|
{count}
|
|
|
|
</span>
|
2022-06-15 04:59:43 +00:00
|
|
|
</div>
|
2023-05-24 16:53:06 +00:00
|
|
|
<div class="tools gap-1">
|
|
|
|
<Button
|
|
|
|
icon={IconAdd}
|
2023-07-06 07:01:27 +00:00
|
|
|
kind={'ghost'}
|
2023-05-24 16:53:06 +00:00
|
|
|
showTooltip={{ label: tracker.string.AddIssueTooltip, direction: 'left' }}
|
|
|
|
on:click={() => {
|
|
|
|
showPopup(CreateIssue, { space: currentSpace, [groupByKey]: state._id }, 'top')
|
|
|
|
}}
|
|
|
|
/>
|
|
|
|
</div>
|
|
|
|
</div>
|
2022-06-15 04:59:43 +00:00
|
|
|
</svelte:fragment>
|
|
|
|
<svelte:fragment slot="card" let:object>
|
|
|
|
{@const issue = toIssue(object)}
|
2022-07-07 02:21:30 +00:00
|
|
|
{@const issueId = object._id}
|
2023-05-03 05:47:38 +00:00
|
|
|
{@const reports =
|
|
|
|
issue.reportedTime + (issue.childInfo ?? []).map((it) => it.reportedTime).reduce((a, b) => a + b, 0)}
|
|
|
|
{@const estimations = (issue.childInfo ?? []).map((it) => it.estimation).reduce((a, b) => a + b, 0)}
|
2023-04-04 06:11:49 +00:00
|
|
|
{#key issueId}
|
|
|
|
<div
|
|
|
|
class="tracker-card"
|
|
|
|
on:click={() => {
|
2023-09-30 16:52:27 +00:00
|
|
|
openDoc(hierarchy, issue)
|
2023-04-04 06:11:49 +00:00
|
|
|
}}
|
|
|
|
>
|
2023-05-02 03:46:47 +00:00
|
|
|
<div class="card-header flex-between">
|
|
|
|
<div class="flex-row-center text-sm">
|
|
|
|
<!-- {#if groupByKey !== 'status'} -->
|
|
|
|
<div class="mr-1">
|
|
|
|
<StatusEditor value={issue} kind="list" isEditable={false} />
|
|
|
|
</div>
|
|
|
|
<!-- {/if} -->
|
2023-04-04 06:11:49 +00:00
|
|
|
<IssuePresenter value={issue} />
|
|
|
|
<ParentNamesPresenter value={issue} />
|
|
|
|
</div>
|
2023-05-02 03:46:47 +00:00
|
|
|
<div class="flex-row-center gap-2 reverse flex-no-shrink">
|
2023-04-04 06:11:49 +00:00
|
|
|
<Component is={notification.component.NotificationPresenter} props={{ value: object }} />
|
2023-06-01 16:38:53 +00:00
|
|
|
<AssigneeEditor object={issue} avatarSize={'card'} shouldShowName={false} />
|
2023-04-04 06:11:49 +00:00
|
|
|
</div>
|
2022-06-16 04:24:17 +00:00
|
|
|
</div>
|
2023-05-02 03:46:47 +00:00
|
|
|
<div class="card-content text-md caption-color lines-limit-2">
|
|
|
|
{object.title}
|
|
|
|
</div>
|
|
|
|
<div class="card-labels">
|
2023-05-31 08:40:47 +00:00
|
|
|
{#if enabledConfig(config, 'subIssues') && issue && issue.subIssues > 0}
|
2023-05-02 03:46:47 +00:00
|
|
|
<SubIssuesSelector value={issue} {currentProject} size={'small'} />
|
2023-04-04 06:11:49 +00:00
|
|
|
{/if}
|
2023-05-31 08:40:47 +00:00
|
|
|
{#if enabledConfig(config, 'priority')}
|
|
|
|
<PriorityEditor
|
|
|
|
value={issue}
|
|
|
|
isEditable={true}
|
|
|
|
kind={'link-bordered'}
|
|
|
|
size={'small'}
|
|
|
|
justify={'center'}
|
|
|
|
/>
|
|
|
|
{/if}
|
|
|
|
{#if enabledConfig(config, 'component')}
|
|
|
|
<ComponentEditor
|
|
|
|
value={issue}
|
2023-08-17 06:34:16 +00:00
|
|
|
{space}
|
2023-05-31 08:40:47 +00:00
|
|
|
isEditable={true}
|
|
|
|
kind={'link-bordered'}
|
|
|
|
size={'small'}
|
|
|
|
justify={'center'}
|
2023-07-03 12:15:48 +00:00
|
|
|
shrink={1}
|
2023-05-31 08:40:47 +00:00
|
|
|
bind:onlyIcon={fullFilled[issueId]}
|
|
|
|
/>
|
|
|
|
{/if}
|
|
|
|
{#if enabledConfig(config, 'dueDate')}
|
|
|
|
<DueDatePresenter value={issue} size={'small'} kind={'link-bordered'} />
|
|
|
|
{/if}
|
2023-05-02 03:46:47 +00:00
|
|
|
</div>
|
2023-05-31 08:40:47 +00:00
|
|
|
{#if enabledConfig(config, 'labels')}
|
2023-07-03 12:15:48 +00:00
|
|
|
<div class="card-labels labels">
|
2023-05-31 08:40:47 +00:00
|
|
|
<Component
|
|
|
|
is={tags.component.LabelsPresenter}
|
2023-07-03 12:15:48 +00:00
|
|
|
props={{
|
|
|
|
value: issue.labels,
|
|
|
|
object: issue,
|
|
|
|
ckeckFilled: fullFilled[issueId],
|
|
|
|
kind: 'link',
|
|
|
|
compression: true
|
|
|
|
}}
|
2023-05-31 08:40:47 +00:00
|
|
|
on:change={(res) => {
|
|
|
|
if (res.detail.full) fullFilled[issueId] = true
|
|
|
|
}}
|
|
|
|
/>
|
|
|
|
</div>
|
|
|
|
{/if}
|
|
|
|
{#if shouldShowFooter(config, reports, estimations, object)}
|
2023-05-03 05:47:38 +00:00
|
|
|
<div class="card-footer flex-between">
|
2023-05-31 08:40:47 +00:00
|
|
|
{#if enabledConfig(config, 'estimation')}
|
|
|
|
<EstimationEditor kind={'list'} size={'small'} value={issue} />
|
|
|
|
{/if}
|
2023-05-03 05:47:38 +00:00
|
|
|
<div class="flex-row-center gap-3 reverse">
|
2023-05-31 08:40:47 +00:00
|
|
|
{#if enabledConfig(config, 'attachments') && (object.attachments ?? 0) > 0}
|
2023-05-03 05:47:38 +00:00
|
|
|
<AttachmentsPresenter value={object.attachments} {object} />
|
|
|
|
{/if}
|
2023-05-31 08:40:47 +00:00
|
|
|
{#if enabledConfig(config, 'comments')}
|
|
|
|
{#if (object.comments ?? 0) > 0}
|
|
|
|
<CommentsPresenter value={object.comments} {object} />
|
|
|
|
{/if}
|
|
|
|
{#if object.$lookup?.attachedTo !== undefined && (object.$lookup.attachedTo.comments ?? 0) > 0}
|
|
|
|
<CommentsPresenter
|
|
|
|
value={object.$lookup?.attachedTo?.comments}
|
|
|
|
object={object.$lookup?.attachedTo}
|
|
|
|
withInput={false}
|
|
|
|
/>
|
|
|
|
{/if}
|
2023-05-02 03:46:47 +00:00
|
|
|
{/if}
|
2023-05-03 05:47:38 +00:00
|
|
|
</div>
|
2023-04-04 06:11:49 +00:00
|
|
|
</div>
|
2023-05-03 05:47:38 +00:00
|
|
|
{:else}
|
|
|
|
<div class="min-h-4 max-h-4 h-4" />
|
|
|
|
{/if}
|
2022-06-15 04:59:43 +00:00
|
|
|
</div>
|
2023-04-04 06:11:49 +00:00
|
|
|
{/key}
|
2022-06-15 04:59:43 +00:00
|
|
|
</svelte:fragment>
|
|
|
|
</Kanban>
|
2022-07-06 06:11:32 +00:00
|
|
|
{/if}
|
2022-06-15 04:59:43 +00:00
|
|
|
|
|
|
|
<style lang="scss">
|
|
|
|
.header {
|
2023-05-02 03:46:47 +00:00
|
|
|
margin: 0 0.75rem 0.5rem;
|
|
|
|
padding: 0 0.5rem 0 1.25rem;
|
|
|
|
height: 2.5rem;
|
|
|
|
min-height: 2.5rem;
|
|
|
|
border: 1px solid var(--theme-divider-color);
|
|
|
|
border-radius: 0.25rem;
|
2022-06-15 04:59:43 +00:00
|
|
|
|
2023-05-02 03:46:47 +00:00
|
|
|
.counter {
|
|
|
|
color: var(--theme-dark-color);
|
|
|
|
}
|
|
|
|
.tools {
|
|
|
|
opacity: 0;
|
|
|
|
}
|
|
|
|
&:hover .tools {
|
|
|
|
opacity: 1;
|
2022-06-15 04:59:43 +00:00
|
|
|
}
|
|
|
|
}
|
|
|
|
.tracker-card {
|
|
|
|
position: relative;
|
|
|
|
display: flex;
|
|
|
|
flex-direction: column;
|
|
|
|
min-height: 6.5rem;
|
2023-05-03 05:47:38 +00:00
|
|
|
border-radius: 0.25rem;
|
2023-05-02 03:46:47 +00:00
|
|
|
|
|
|
|
.card-header {
|
|
|
|
padding: 0.75rem 1rem 0;
|
|
|
|
}
|
|
|
|
.card-content {
|
|
|
|
margin: 0.5rem 1rem;
|
|
|
|
}
|
|
|
|
/* Global styles in components.scss */
|
|
|
|
.card-labels {
|
|
|
|
display: flex;
|
|
|
|
flex-wrap: nowrap;
|
|
|
|
margin: 0 0.75rem 0 1rem;
|
|
|
|
min-width: 0;
|
|
|
|
|
|
|
|
&.labels {
|
|
|
|
overflow: hidden;
|
2023-07-03 12:15:48 +00:00
|
|
|
flex-shrink: 1;
|
2023-05-02 03:46:47 +00:00
|
|
|
margin: 0 1rem;
|
|
|
|
width: calc(100% - 2rem);
|
|
|
|
border-radius: 0 0.24rem 0.24rem 0;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
.card-footer {
|
|
|
|
margin-top: 1rem;
|
|
|
|
padding: 0.75rem 1rem;
|
|
|
|
background-color: var(--theme-kanban-card-footer);
|
|
|
|
border-radius: 0 0 0.25rem 0.25rem;
|
|
|
|
}
|
2022-07-07 02:21:30 +00:00
|
|
|
}
|
2022-06-15 04:59:43 +00:00
|
|
|
</style>
|