Enhance TrainingUnitSectionsEditor with new drag-and-drop functionality for parallel phases
Deploy Development / deploy (push) Successful in 39s
Test Suite / pytest-backend (push) Successful in 36s
Test Suite / lint-backend (push) Successful in 0s
Test Suite / build-frontend (push) Successful in 11s
Test Suite / k6 /health Baseline (push) Successful in 33s
Test Suite / playwright-tests (push) Successful in 1m8s
Deploy Development / deploy (push) Successful in 39s
Test Suite / pytest-backend (push) Successful in 36s
Test Suite / lint-backend (push) Successful in 0s
Test Suite / build-frontend (push) Successful in 11s
Test Suite / k6 /health Baseline (push) Successful in 33s
Test Suite / playwright-tests (push) Successful in 1m8s
- Added new event handlers for drag-and-drop operations to manage sections above and below split headers in parallel phases. - Implemented utility functions to reorder sections as whole groups or as the first entry in parallel phases, improving section management. - Updated CSS styles to visually represent new drop zones for sections, enhancing user experience during reordering. - Refactored existing logic to accommodate new features and ensure proper handling of section placements within parallel streams.
This commit is contained in:
1 parent
73975d3402
commit
72e8f31cff
3 files changed
+286
-13
No files matched your search
@@ -863,6 +863,48 @@ export function reorderBlocksImmutableWithPlanLoc(prev, fromI, toBeforeIdx) {
|
||||
return arr
|
||||
}
|
||||
|
||||
/**
|
||||
* Abschnitt direkt vor den Parallel-Lauf setzen (immer Ganzgruppe oberhalb der Split-Phase).
|
||||
*/
|
||||
export function reorderSectionBeforeParallelRunAsWholeGroup(prev, fromI, phaseOrderIndex) {
|
||||
const po = Number(phaseOrderIndex) || 0
|
||||
const idxs = indicesOfParallelPhase(prev, po)
|
||||
if (!idxs.length || fromI < 0 || fromI >= (prev?.length ?? 0)) return prev
|
||||
const fg = idxs[0]
|
||||
const arr = [...prev]
|
||||
const [moved] = arr.splice(fromI, 1)
|
||||
let insertAt = fg
|
||||
if (fromI < insertAt) insertAt -= 1
|
||||
insertAt = Math.max(0, Math.min(insertAt, arr.length))
|
||||
const above = insertAt > 0 ? arr[insertAt - 1] : undefined
|
||||
let planLocNext
|
||||
if (above?.planLoc?.phaseKind === 'whole_group') {
|
||||
planLocNext = { ...above.planLoc }
|
||||
} else if (!above) {
|
||||
planLocNext = defaultPlanLocWholeGroup(0)
|
||||
} else {
|
||||
const mx = maxPhaseOrderIndexFromSections(arr)
|
||||
planLocNext = defaultPlanLocWholeGroup(mx + 1)
|
||||
}
|
||||
arr.splice(insertAt, 0, { ...moved, planLoc: planLocNext })
|
||||
return arr
|
||||
}
|
||||
|
||||
/** Abschnitt als neuen ersten Eintrag der Parallel-Phase (gleiche Phasen-/Stream-Metadaten wie bisheriger Kopf). */
|
||||
export function reorderSectionAsFirstInParallelPhase(prev, fromI, phaseOrderIndex) {
|
||||
const po = Number(phaseOrderIndex) || 0
|
||||
const idxs = indicesOfParallelPhase(prev, po)
|
||||
if (!idxs.length || fromI < 0 || fromI >= (prev?.length ?? 0)) return prev
|
||||
let fg = idxs[0]
|
||||
const arr = [...prev]
|
||||
const headTpl = { ...arr[fg].planLoc }
|
||||
const [moved] = arr.splice(fromI, 1)
|
||||
if (fromI < fg) fg -= 1
|
||||
fg = Math.max(0, Math.min(fg, arr.length))
|
||||
arr.splice(fg, 0, { ...moved, planLoc: { ...headTpl } })
|
||||
return arr
|
||||
}
|
||||
|
||||
/**
|
||||
* Abschnitt ans Ende eines parallelen Streams setzen (planLoc wie dieser Stream).
|
||||
* Leerer Stream: Einfügen hinter den letzten Abschnitt der zugehörigen parallelen Phase, planLoc vom Referenz-Abschnitt mit angepasstem streamIndex.
|
||||
|
||||
Reference in new issue
Block a user