mirror of
https://github.com/hcengineering/platform.git
synced 2025-04-21 07:46:24 +00:00
TSK-1206: drag-drop statuses between categories (#3112)
Signed-off-by: Vyacheslav Tumanov <me@slavatumanov.me>
This commit is contained in:
parent
c4ff71fe50
commit
77bd4fea29
@ -179,16 +179,12 @@
|
|||||||
}
|
}
|
||||||
|
|
||||||
function handleDragOver (ev: DragEvent, status: IssueStatus) {
|
function handleDragOver (ev: DragEvent, status: IssueStatus) {
|
||||||
if (draggingStatus?.category === status.category) {
|
hoveringStatus = status
|
||||||
hoveringStatus = status
|
ev.preventDefault()
|
||||||
ev.preventDefault()
|
|
||||||
} else {
|
|
||||||
hoveringStatus = null
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
async function handleDrop (toItem: IssueStatus) {
|
async function handleDrop (toItem: IssueStatus) {
|
||||||
if (draggingStatus != null && draggingStatus?._id !== toItem._id && draggingStatus?.category === toItem.category) {
|
if (draggingStatus != null && draggingStatus?._id !== toItem._id) {
|
||||||
const fromIndex = getStatusIndex(draggingStatus)
|
const fromIndex = getStatusIndex(draggingStatus)
|
||||||
const toIndex = getStatusIndex(toItem)
|
const toIndex = getStatusIndex(toItem)
|
||||||
const [prev, next] = [
|
const [prev, next] = [
|
||||||
@ -197,7 +193,9 @@
|
|||||||
]
|
]
|
||||||
|
|
||||||
isSaving = true
|
isSaving = true
|
||||||
await client.update(draggingStatus, { rank: calcRank(prev, next) })
|
let newCategory = {}
|
||||||
|
if (draggingStatus?.category !== toItem.category) newCategory = { category: toItem.category }
|
||||||
|
await client.update(draggingStatus, { rank: calcRank(prev, next), ...newCategory })
|
||||||
isSaving = false
|
isSaving = false
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user