Watch
0
0
Fork
You've already forked hyperhive
0

swarm-ui: rewire a notification flow by drag or keyboard

The flow editor can now change a flow's shape on the canvas, not only
through the inspector's fields:

- drag a box onto another to move it and its branch there; a drop the
  save would refuse shows the target dashed red and gives the reason;
- a palette of node kinds adds a node below the picked box on click, or
  below any box it is dragged onto; it offers what the controller lists;
- arrow keys walk the tree, M picks a box up and Enter drops it under
  the focused one, Alt+Up/Down reorder a node among its siblings, Delete
  removes a branch; focus follows the edit;
- each box with siblings says when it runs, and the inspector can move
  it earlier or later, since the router runs children in edge order;
- request_reviewer is a second leaf kind beside todo, with a reviewer
  field;
- leaving with unsaved edits asks first, also for in-app links and the
  back button (a router hook runs navigation past a page's guard).
This commit is contained in:
iris 2026-10-24 14:49:48 +02:00 • committed by mara
commit 68e289fff5
16 changed files with 1072 additions and 133 deletions

View file

@ -238,21 +238,38 @@ the page shows why. Reload to switch against the current document.
#### Editing a flow
`/notifications/<flow id>` edits one custom flow. The canvas draws the flow left
to right: the source on the left, each match to its right, and the todos at the
ends. Pick a node to edit it in the panel beside the canvas:
to right: the source on the left, each match to its right, and the leaf nodes at
the ends. Pick a node to edit it in the panel beside the canvas:
- a **source** picks the forge events the flow starts from;
- a **match** lists conditions, each an event field and the value it must equal;
- a **todo** says who gets it (the agents an event field names, or one agent),
whether it sets or clears a todo, the todo's key, and its text. The key and the
text can use `{field}` placeholders.
text can use `{field}` placeholders;
- a **request_reviewer** names the forge login the router asks to review the
pull request. It ends a branch, like a todo, and the row of kinds above the
canvas only offers it when the controller does.
Beside the fields, **add a match below** and **add a todo below** grow the
branch, **move under** moves a node and what's below it to another match, and
**remove** takes a node and its branch out. The editor turns away any edit the
controller would refuse to save, and says why: a todo with children, a second
parent, a node under its own branch, or more nodes or levels than the
controller allows.
Rewire the flow on the canvas:
- **Add** a node from the row of kinds above the canvas. Choose a kind to add it
below the picked box, or drag it onto any box.
- **Move** a node and its branch by dragging its box onto another box. With the
keyboard, the arrow keys walk the tree, **M** picks up the focused box, the
arrows go to the box you want it under, and **Enter** drops it there.
**Escape** puts it back. The panel's **move under** list does the same.
- **Reorder** the branches of a node. The router runs a node's branches in the
order they sit, so when a clear and an upsert share a key prefix, the order
decides what's left. A box with siblings says when it runs, such as "runs
2nd". **run earlier** and **run later** in the panel, or **Alt+Up** and
**Alt+Down** on the canvas, swap it with its neighbour.
- **Remove** a node and its branch with **remove** in the panel or the
**Delete** key.
The editor turns away any edit the controller would refuse to save, and says
why: a leaf node with children, a second parent, a node under its own branch, or
more nodes or levels than the controller allows. A drop it will refuse shows the
target box dashed and red while you hold the box over it.
Edits stay in a draft until **save**, which sends the whole flows document with
the revision the editor read. **discard edits** goes back to the saved flow and
@ -262,8 +279,9 @@ editor offers to reload and drop your edits, or to keep them and replace this
flow's latest version with them. For any other refusal the editor shows the
controller's own message. The router runs a saved flow from its next event.
Closing or reloading the tab with unsaved edits asks first. Leaving through a
link in the app, or the browser's back button, drops the draft without asking.
Leaving the page with unsaved edits asks first, whether you close or reload the
tab, follow a link in the app, or press the browser's back button. Choose
**leave and drop edits** to go on, or cancel to stay and save.
### Sending a message to an agent