Add drag reorder and clipboard operations to workflow editing #13
Loading…
Reference in a new issue
No description provided.
Delete branch "%!s()"
Deleting a branch is permanent. Although the deleted branch may continue to exist for a short time before it actually gets removed, it CANNOT be undone in most cases. Continue?
Context
The workflow editor is intentionally a vertically ordered route with indented branch lanes, not a free-form canvas. Its current move-up/move-down controls make route editing slow, and rebuilding a similarly configured node manually is error-prone.
Scope
Non-goals
Acceptance
Implemented in
e4f3978(committed locally, push blocked on a 1Password approval). Delivered together with #25 and #26, which share the same foundation.Route projection.
WorkflowRouteprojects the graph as a trunk of steps with a lane per branch port; structural editing is now a list operation on a lane (withActionAt,withStepMoved,withoutStep,withPastedStep), and every op returnsRouteEdit.Applied(workflow, notices)orRouteEdit.Rejected(reason)so a refusal is explained rather than absorbed. Edges the projection does not describe are preserved untouched, and steps no trigger reaches are surfaced as "NOT ON THE ROUTE" instead of being hidden.Drag reordering.
MacrosDraggableStep/rememberLaneDragStatein the design system: long-press on a handle (so the route still scrolls), tonal lift, drop-line marking the target gap, edge auto-scroll, targets resolved from real measured row heights for large-font layouts, clamped to the lane. The drag is always a move within one lane, per the one-handed route rule; Move up / Move down stay in the overflow menu as the accessible path.Clipboard. Copy / Cut / Paste on each step plus a Paste control at each lane end. The clipboard is in-app state (
MacrosUiState.clipboard), never Android's system clipboard. Paste mints a fresh node identity, keeps configuration the destination can honour, and clears values whose source is not upstream — naming each one ("… needs a source on this route"); a pasted switch keeps its rule IDs so its lanes survive, with conditions reset if they referenced unavailable outputs. Cut goes through the ordinary safe-removal path, so a switch still holding branch steps refuses and says so.Non-goals respected: no canvas, no multi-node selection, no undo/redo, no cross-device clipboard, no secret copying.
Verification.
task ci:qualitygreen. Engine tests inWorkflowRouteTestcover projection, join insertion, in-lane reorder persistence, invalid-drop no-op, protected branch removal, fresh pasted IDs and destination repair;DefaultAutomationEngineTestcovers join execution. On emulator-5554: dragged a step within a branch lane, reordered the trunk, refused an invalid move with an explanation, copied a step and pasted it into the fallback lane, added a step after the switch, then saved, reopened and ran the automation to Completed.