Watch
0
0
Fork
You've already forked hyperhive
0

swarm-ui: one stream hook, and one rule for confirming a change

Part of the unification order in the UI sweep issue (steps e and f).

The terminal, turn-state and message feeds each opened an EventSource, tracked
connecting/open/reconnecting/closed, probed the session when the browser gave
up, and reconnected through an attempt counter. openStream (no Preact, source
injected, tested with a fake) and useEventStream now own that; each feed keeps
only what it does with a message.

A change confirmed itself three ways: a toast, inline, or nothing. The design
guide now says forms confirm inline, actions on a card in a refreshing list
confirm with a toast, and a change the page already shows says nothing. Fire
now, saving a schedule and removing an egress entry gain the toast they lacked.
This commit is contained in:
iris 2026-11-26 00:57:53 +01:00
commit bbdd32c2e0
2 changed files with 294 additions and 138 deletions

View file

@ -499,6 +499,8 @@ to its agents as a broadcast (`POST /api/agents/broadcast`) after a
confirmation and leaves the schedule paused with its start unchanged; a toast
says who got it, and the error banner names any agent that didn't. **pause** and
**resume** stop and restart it; **remove** deletes it after a confirmation.
A toast says `sent <name> now` after **fire now** and `schedule saved` after a
save; pause, resume and remove say nothing, since the card flips or goes.
**+ schedule** opens an empty form above the list, and the filters narrow the
list by name, agent or state (`active`, `paused`, or `past` for a one-shot
whose time has passed). `past` is the controller's clock against the start time,
@ -1056,7 +1058,7 @@ list every agent has: one badge per source with its count, **swarm-wide** (the
entries for every agent), **this agent** (the ones for it alone) and
**automatic**. Selecting a badge opens the names behind it. An entry matters to
a restricted agent. One with the unrestricted internet flag reaches any name the
proxy's private-range rules leave. **remove**, beside a name, drops one entry;
proxy's private-range rules leave. **remove**, beside a name, drops one entry and shows a toast (`removed <domain>`);
**add** opens a dialog with a domain box and a tick for every agent in the
swarm. The tick is off by default, so an entry is for this agent alone.
@ -1067,7 +1069,7 @@ rows. **allowed** is the list above. **denied** is the swarm's
deny list: every egress mode refuses a denied name, even when an allowed entry, a hive's
own `allowedDomains` or the unrestricted internet flag would let it through. The card says
which hives haven't applied the current deny list yet; until they do, their proxies may still let
those names through. The two lists use the same requests as the agent card, against
those names through. Removing an entry shows a toast (`removed <domain>`). The two lists use the same requests as the agent card, against
`/api/egress/allowed-domains` and `/api/egress/denied-domains`. The deny list has no
per-agent editor on the agent card yet, and no automatic entries.

View file

@ -126,6 +126,15 @@ for confirmation before a destructive/dangerous action, and offer
helpful hints — it just shouldn't get in the way of someone who already
knows what they're doing.
## Confirming a change
A change confirms itself in one of three ways, by where you make it. A form
confirms inline with `FormResult`, under its own button, unless the form closes
on save, which leaves no button to put it under: that confirms with a toast. An action on a card in
a list that refreshes confirms with a toast. A change the page already shows
(a card that flips or goes, a row that appears) says nothing. A new action picks
the way by this rule and doesn't add a fourth.
## Empty states
Graceful fallbacks, always — a table with zero rows should show