swarm-ui: edit a notification flow on a canvas
A custom flow opens at /notifications/<id>: its nodes drawn left to right (source, then matches, then todos), and a panel to edit the picked node: the source's events, a match's conditions, a todo's recipients, op, key and text. Add a match or todo below a node, move a branch under another match, or remove it; an edit the controller would refuse (a todo with children, a second parent, a cycle, over the node or depth cap) is turned away with the reason. Edits stay in a draft until save, which sends the whole document at the revision read. A stale revision is told apart from a refused document: the editor offers to reload or to keep the draft on top of the latest. The form choices come from the controller's schema when it sends one. The list page gains edit and duplicate on custom flows, duplicate on the built-ins, and a new-flow box; a new flow's id avoids the built-ins' too.
This commit is contained in:
parent
c00fd99112
commit
f28e1e9063
13 changed files with 1209 additions and 6 deletions
|
|
@ -19,7 +19,7 @@ domain, covers host-level detail for one hive.
|
|||
| `/schedules` | the scheduled prompts: add, edit, pause, resume and remove |
|
||||
| `/broadcast` | send one message to several agents at once, picked from a grid of their icons |
|
||||
| `/messages` | the swarm-wide message feed: every message between agents, and to them from the operator, reminders and compaction, with a history window and a filter on sender or recipient |
|
||||
| `/notifications` | the notification router's flows: a switch for each built-in, and every flow drawn as a tree |
|
||||
| `/notifications` | the notification router's flows: a switch for each built-in, every flow drawn as a tree, and an editor for custom flows |
|
||||
| `/issues` | a cross-repo issue report |
|
||||
| `/review` | the review classifier: its recent runs, a try-out on a real PR, and its settings |
|
||||
| `/builds` | the swarm builder's recent builds of agent config PRs, with what nix printed when one failed |
|
||||
|
|
@ -226,13 +226,41 @@ restores it. Each **custom** flow shows its name and whether it's on. Every
|
|||
flow draws as an indented tree: the forge events it starts from, the
|
||||
conditions under it, and the todo each branch ends in.
|
||||
|
||||
The page edits nothing else. Add custom flows with `PUT /api/notify/flows`.
|
||||
A built-in flow can be **duplicated** into a custom one, and **new flow** starts a
|
||||
custom flow with just a source; either opens the flow in the editor. A custom
|
||||
flow has an **edit** link and a **duplicate** button.
|
||||
|
||||
A switch sends the whole flows document with the revision the page read, `0` if
|
||||
it read no document. The controller refuses the switch when the stored revision
|
||||
is another, including when someone wrote a document after the page read none, and
|
||||
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:
|
||||
|
||||
- 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.
|
||||
|
||||
Beside the fields, **add a match below** and **add a todo below** grow the
|
||||
branch, **move under** moves a node and what is below it to another match, and
|
||||
**remove** takes a node and its branch out. The editor turns away what could
|
||||
never be saved, with the reason: a todo with children, a second parent, a node
|
||||
under its own branch, or more nodes or levels than the controller allows.
|
||||
|
||||
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
|
||||
**delete flow** removes it, after a confirmation. If the flows were changed
|
||||
somewhere else in the meantime the save is refused as stale, and the editor
|
||||
offers to reload and drop your edits, or to keep them on top of the latest. A
|
||||
document the controller refuses for any other reason is shown as the controller
|
||||
says. The router runs a saved flow from its next event.
|
||||
|
||||
### Sending a message to an agent
|
||||
|
||||
Under an agent's terminal, in the preview and in its own tab, is a **message**
|
||||
|
|
|
|||
Loading…
Reference in a new issue