diff --git a/changelog.md b/changelog.md index bb876c3477..63e8c9a7a2 100644 --- a/changelog.md +++ b/changelog.md @@ -6,6 +6,9 @@ HR: - Allow to change assignee in Kanban +Tracker: +- Manual issues ordering + ## 0.6.29 Platform: diff --git a/models/tracker/src/index.ts b/models/tracker/src/index.ts index 92cb19a6ba..1d58e0855f 100644 --- a/models/tracker/src/index.ts +++ b/models/tracker/src/index.ts @@ -494,7 +494,7 @@ export function createModel (builder: Builder): void { id: issuesId, label: tracker.string.Issues, icon: tracker.icon.Issues, - component: tracker.component.IssuesView, + component: tracker.component.Issues, componentProps: { title: tracker.string.Issues } diff --git a/packages/kanban/src/components/Kanban.svelte b/packages/kanban/src/components/Kanban.svelte index 95f3b9e4ef..4aba8dda72 100644 --- a/packages/kanban/src/components/Kanban.svelte +++ b/packages/kanban/src/components/Kanban.svelte @@ -27,7 +27,7 @@ export let states: TypeState[] = [] export let query: DocumentQuery = {} export let fieldName: string - export let rankFieldName: string + export let rankFieldName: string | undefined export let selection: number | undefined = undefined export let checked: Doc[] = [] @@ -57,7 +57,10 @@ dragItem?: Item // required for svelte to properly recalculate state. ): ExtItem[] { const stateCards = objects.filter((it) => (it as any)[fieldName] === state._id) - stateCards.sort((a, b) => (a as any)[rankFieldName]?.localeCompare((b as any)[rankFieldName])) + if (rankFieldName !== undefined) { + const sortField = rankFieldName + stateCards.sort((a, b) => (a as any)[sortField]?.localeCompare((b as any)[sortField])) + } return stateCards.map((it, idx, arr) => ({ it, prev: arr[idx - 1], @@ -96,14 +99,13 @@ } } - const dragCardRank = (dragCard as any)[rankFieldName] - if (dragCardInitialRank !== (dragCard as any)[rankFieldName]) { + if (rankFieldName !== undefined && dragCardInitialRank !== (dragCard as any)[rankFieldName]) { + const dragCardRank = (dragCard as any)[rankFieldName] updates = { ...updates, [rankFieldName]: dragCardRank } } - if (Object.keys(updates).length > 0) { await updateItem(dragCard, updates) } @@ -113,7 +115,7 @@ const client = getClient() let dragCard: Item | undefined - let dragCardInitialRank: string + let dragCardInitialRank: string | undefined let dragCardInitialState: StateType let isDragging = false @@ -144,23 +146,26 @@ if (card !== undefined && card[fieldName] !== state._id) { card[fieldName] = state._id const objs = getStateObjects(objects, state) - card[rankFieldName] = calcRank(objs[objs.length - 1]?.it, undefined) + if (rankFieldName !== undefined) card[rankFieldName] = calcRank(objs[objs.length - 1]?.it, undefined) } } function cardDragOver (evt: CardDragEvent, object: ExtItem): void { if (dragCard !== undefined) { - ;(dragCard as any)[rankFieldName] = doCalcRank(object, evt) + ;(dragCard as any)[fieldName] = (dragCard as any)[fieldName] + if (rankFieldName !== undefined) { + ;(dragCard as any)[rankFieldName] = doCalcRank(object, evt) + } } } function cardDrop (evt: CardDragEvent, object: ExtItem): void { - if (dragCard !== undefined) { + if (dragCard !== undefined && rankFieldName !== undefined) { ;(dragCard as any)[rankFieldName] = doCalcRank(object, evt) } isDragging = false } function onDragStart (object: ExtItem, state: TypeState): void { dragCardInitialState = state._id - dragCardInitialRank = (object.it as any)[rankFieldName] + dragCardInitialRank = rankFieldName === undefined ? undefined : (object.it as any)[rankFieldName] dragCard = object.it isDragging = true dispatch('obj-focus', object.it) diff --git a/plugins/tracker-assets/lang/en.json b/plugins/tracker-assets/lang/en.json index eb3bacccf1..8ccc89d194 100644 --- a/plugins/tracker-assets/lang/en.json +++ b/plugins/tracker-assets/lang/en.json @@ -106,6 +106,7 @@ "NoAssignee": "No assignee", "LastUpdated": "Last updated", "DueDate": "Due date", + "Manual": "Manual", "All": "All", "PastWeek": "Past week", "PastMonth": "Past month", diff --git a/plugins/tracker-assets/lang/ru.json b/plugins/tracker-assets/lang/ru.json index 4c742600b3..381408df84 100644 --- a/plugins/tracker-assets/lang/ru.json +++ b/plugins/tracker-assets/lang/ru.json @@ -106,6 +106,7 @@ "NoAssignee": "Нет исполнителя", "LastUpdated": "Последнее обновление", "DueDate": "Срок", + "Manual": "Пользовательский", "All": "Все", "PastWeek": "Предыдущая неделя", "PastMonth": "Предыдущий месяц", diff --git a/plugins/tracker-resources/src/components/issues/Active.svelte b/plugins/tracker-resources/src/components/issues/Active.svelte index f05fd82967..c5fbbd06d3 100644 --- a/plugins/tracker-resources/src/components/issues/Active.svelte +++ b/plugins/tracker-resources/src/components/issues/Active.svelte @@ -25,7 +25,10 @@ let query: DocumentQuery $: statusQuery.query( tracker.class.IssueStatus, - { category: { $in: [tracker.issueStatusCategory.Unstarted, tracker.issueStatusCategory.Started] } }, + { + category: { $in: [tracker.issueStatusCategory.Unstarted, tracker.issueStatusCategory.Started] }, + space: currentSpace + }, (result) => { query = { status: { $in: result.map(({ _id }) => _id) }, space: currentSpace } } diff --git a/plugins/tracker-resources/src/components/issues/Backlog.svelte b/plugins/tracker-resources/src/components/issues/Backlog.svelte index bf36d4e5b4..1e051dfc00 100644 --- a/plugins/tracker-resources/src/components/issues/Backlog.svelte +++ b/plugins/tracker-resources/src/components/issues/Backlog.svelte @@ -23,9 +23,13 @@ const statusQuery = createQuery() let query: DocumentQuery = {} - $: statusQuery.query(tracker.class.IssueStatus, { category: tracker.issueStatusCategory.Backlog }, (result) => { - query = { status: { $in: result.map(({ _id }) => _id) }, space: currentSpace } - }) + $: statusQuery.query( + tracker.class.IssueStatus, + { category: tracker.issueStatusCategory.Backlog, space: currentSpace }, + (result) => { + query = { status: { $in: result.map(({ _id }) => _id) }, space: currentSpace } + } + ) diff --git a/plugins/tracker-resources/src/components/issues/Issues.svelte b/plugins/tracker-resources/src/components/issues/Issues.svelte new file mode 100644 index 0000000000..3b91af2422 --- /dev/null +++ b/plugins/tracker-resources/src/components/issues/Issues.svelte @@ -0,0 +1,26 @@ + + + + diff --git a/plugins/tracker-resources/src/components/issues/KanbanView.svelte b/plugins/tracker-resources/src/components/issues/KanbanView.svelte index e91a5e94af..15cc669418 100644 --- a/plugins/tracker-resources/src/components/issues/KanbanView.svelte +++ b/plugins/tracker-resources/src/components/issues/KanbanView.svelte @@ -14,18 +14,18 @@ -->