Skip to content

Commit c41fd15

Browse files
authored
Fix Tracker board card (#2090)
Signed-off-by: Andrey Sobolev <[email protected]>
1 parent cbcf04f commit c41fd15

File tree

6 files changed

+67
-14
lines changed

6 files changed

+67
-14
lines changed

packages/ui/src/components/Button.svelte

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -100,7 +100,7 @@
100100
style={width ? 'width: ' + width : ''}
101101
{title}
102102
type={kind === 'primary' ? 'submit' : 'button'}
103-
on:click
103+
on:click|stopPropagation|preventDefault
104104
on:focus
105105
on:blur
106106
on:mousemove

plugins/contact-resources/src/components/EmployeePresenter.svelte

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -17,7 +17,9 @@
1717
1818
let container: HTMLElement
1919
20-
const onEdit = () => {
20+
const onEdit = (evt: MouseEvent) => {
21+
evt?.preventDefault()
22+
evt?.stopPropagation()
2123
if (value) {
2224
showPopup(
2325
EmployeePreviewPopup,

plugins/tracker-resources/src/components/issues/AssigneePresenter.svelte

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -75,6 +75,8 @@
7575
if (!isEditable) {
7676
return
7777
}
78+
event?.preventDefault()
79+
event?.stopPropagation()
7880
7981
showPopup(
8082
UsersPopup,

plugins/tracker-resources/src/components/issues/KanbanView.svelte

Lines changed: 61 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -14,19 +14,22 @@
1414
-->
1515
<script lang="ts">
1616
import contact from '@anticrm/contact'
17-
import { Class, Doc, FindOptions, Ref, WithLookup } from '@anticrm/core'
18-
import { Kanban } from '@anticrm/kanban'
19-
import { getClient } from '@anticrm/presentation'
20-
import { Issue, IssuesGrouping, Team, ViewOptions } from '@anticrm/tracker'
21-
import { Button, Icon, IconAdd, showPopup, Tooltip } from '@anticrm/ui'
17+
import { Class, Doc, FindOptions, Ref, SortingOrder, WithLookup } from '@anticrm/core'
18+
import { Kanban, TypeState } from '@anticrm/kanban'
19+
import notification from '@anticrm/notification'
20+
import { createQuery, getClient } from '@anticrm/presentation'
21+
import { Issue, IssuesGrouping, IssueStatus, Team, ViewOptions } from '@anticrm/tracker'
22+
import { Button, Component, Icon, IconAdd, showPanel, showPopup, Tooltip } from '@anticrm/ui'
2223
import { focusStore, ListSelectionProvider, SelectDirection, selectionStore } from '@anticrm/view-resources'
2324
import ActionContext from '@anticrm/view-resources/src/components/ActionContext.svelte'
2425
import Menu from '@anticrm/view-resources/src/components/Menu.svelte'
2526
import { onMount } from 'svelte'
2627
import tracker from '../../plugin'
2728
import { getKanbanStatuses } from '../../utils'
2829
import CreateIssue from '../CreateIssue.svelte'
30+
import ProjectEditor from '../projects/ProjectEditor.svelte'
2931
import AssigneePresenter from './AssigneePresenter.svelte'
32+
import SubIssuesSelector from './edit/SubIssuesSelector.svelte'
3033
import IssuePresenter from './IssuePresenter.svelte'
3134
import PriorityEditor from './PriorityEditor.svelte'
3235
@@ -42,7 +45,34 @@
4245
...query
4346
}
4447
48+
const spaceQuery = createQuery()
49+
const statusesQuery = createQuery()
50+
4551
const client = getClient()
52+
let currentTeam: Team | undefined
53+
$: spaceQuery.query(tracker.class.Team, { _id: currentSpace }, (res) => {
54+
currentTeam = res.shift()
55+
})
56+
57+
let issueStatuses: WithLookup<IssueStatus>[] | undefined
58+
let states: TypeState[] | undefined
59+
$: statusesQuery.query(
60+
tracker.class.IssueStatus,
61+
{ attachedTo: currentSpace },
62+
(is) => {
63+
states = is.map((status) => ({
64+
_id: status._id,
65+
title: status.name,
66+
color: status.color ?? status.$lookup?.category?.color ?? 0,
67+
icon: status.$lookup?.category?.icon ?? undefined
68+
}))
69+
issueStatuses = is
70+
},
71+
{
72+
lookup: { category: tracker.class.IssueStatusCategory },
73+
sort: { rank: SortingOrder.Ascending }
74+
}
75+
)
4676
4777
function toIssue (object: any): WithLookup<Issue> {
4878
return object as WithLookup<Issue>
@@ -51,7 +81,10 @@
5181
const options: FindOptions<Issue> = {
5282
lookup: {
5383
assignee: contact.class.Employee,
54-
space: tracker.class.Team
84+
space: tracker.class.Team,
85+
_id: {
86+
subIssues: tracker.class.Issue
87+
}
5588
}
5689
}
5790
@@ -133,7 +166,12 @@
133166
</svelte:fragment>
134167
<svelte:fragment slot="card" let:object>
135168
{@const issue = toIssue(object)}
136-
<div class="tracker-card">
169+
<div
170+
class="tracker-card"
171+
on:click={() => {
172+
showPanel(tracker.component.EditIssue, object._id, object._class, 'content')
173+
}}
174+
>
137175
<div class="flex-col mr-6">
138176
<IssuePresenter value={issue} />
139177
<span class="fs-bold caption-color mt-1 lines-limit-2">
@@ -142,14 +180,20 @@
142180
</div>
143181
<div class="abs-rt-content">
144182
<AssigneePresenter
145-
value={issue?.$lookup?.assignee}
183+
value={issue.$lookup?.assignee}
184+
defaultClass={contact.class.Employee}
146185
issueId={issue._id}
147186
{currentSpace}
148187
isEditable={true}
149-
defaultClass={contact.class.Employee}
150188
/>
189+
<div class="flex-center mt-2">
190+
<Component is={notification.component.NotificationPresenter} props={{ value: object }} />
191+
</div>
151192
</div>
152193
<div class="buttons-group xsmall-gap mt-10px">
194+
{#if issue && issueStatuses && issue.subIssues > 0}
195+
<SubIssuesSelector {issue} {currentTeam} {issueStatuses} />
196+
{/if}
153197
<PriorityEditor
154198
value={issue}
155199
isEditable={true}
@@ -158,6 +202,14 @@
158202
justify={'center'}
159203
width={''}
160204
/>
205+
<ProjectEditor
206+
value={issue}
207+
isEditable={true}
208+
kind={'link-bordered'}
209+
size={'inline'}
210+
justify={'center'}
211+
width={''}
212+
/>
161213
</div>
162214
</div>
163215
</svelte:fragment>

plugins/tracker-resources/src/index.ts

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -21,7 +21,6 @@ import Inbox from './components/inbox/Inbox.svelte'
2121
import Active from './components/issues/Active.svelte'
2222
import AssigneePresenter from './components/issues/AssigneePresenter.svelte'
2323
import Backlog from './components/issues/Backlog.svelte'
24-
import Board from './components/issues/Board.svelte'
2524
import DueDatePresenter from './components/issues/DueDatePresenter.svelte'
2625
import EditIssue from './components/issues/edit/EditIssue.svelte'
2726
import IssueItem from './components/issues/IssueItem.svelte'
@@ -111,7 +110,6 @@ export default async (): Promise<Resources> => ({
111110
NopeComponent,
112111
Active,
113112
Backlog,
114-
Board,
115113
Inbox,
116114
Issues,
117115
MyIssues,

plugins/tracker-resources/src/plugin.ts

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -166,7 +166,6 @@ export default mergeIds(trackerId, tracker, {
166166
Views: '' as AnyComponent,
167167
Active: '' as AnyComponent,
168168
Backlog: '' as AnyComponent,
169-
Board: '' as AnyComponent,
170169
Projects: '' as AnyComponent,
171170
IssuePresenter: '' as AnyComponent,
172171
ProjectTitlePresenter: '' as AnyComponent,

0 commit comments

Comments
 (0)