swarm ui: ask before actions that cannot be undone, with a danger button and a useConfirm hook
Button gains a danger variant and an autofocus prop; ConfirmDialog gains danger (red confirm, focus on cancel). Destroy, delete linked account, delete claude login, remove schedule and delete flow use it. New useConfirm hook asks from inside a handler (await confirm({...})) without a dialog's state at the call site. It now guards: removing a swarm-wide egress domain, removing a domain for every agent from an agent's popover, removing a stored API-key environment, firing a schedule now, moving an agent's internet to a looser mode, the /clear message, and reload over unsaved instructions (replacing window.confirm). The review try-out's button is now called push a branch for a PR, since it pushes a branch and does not open one, and asks first. loosensInternet is a tested helper.
This commit is contained in:
parent
d9551415bf
commit
c3e24fe2c6
2 changed files with 353 additions and 60 deletions
|
|
@ -350,8 +350,8 @@ collaborator:
|
|||
allowlist, the account counts only once it's on that list, and read access
|
||||
is then enough for reviews.
|
||||
|
||||
The try-out's **open a PR** pushes a branch to the repo itself, so it
|
||||
needs **write** whatever the branch protection says.
|
||||
The try-out's **push a branch for a PR** button pushes a branch to the repo itself,
|
||||
so it needs **write** whatever the branch protection says.
|
||||
|
||||
The repo also needs a rules file on its default branch (see
|
||||
[Repo configuration](#repo-configuration)). Without one, a request posts a
|
||||
|
|
@ -596,11 +596,12 @@ since a run also works on a merged or closed PR. Two routes feed them:
|
|||
|
||||
Every error is problem+json with the reason in `detail`.
|
||||
|
||||
When it's ready, **open a PR** (`POST /api/review-classifier/open-pr`, with
|
||||
the repo and the classifications) has the service account push a branch that
|
||||
adds the classifications to the repo's rules, with you, the swarm UI user, as
|
||||
commit author. The page then links you to the forge's compare page for that
|
||||
branch, where you log in as usual and open the PR yourself.
|
||||
When it's ready, **push a branch for a PR**
|
||||
(`POST /api/review-classifier/open-pr`, with the repo and the classifications)
|
||||
has the service account push a branch that adds the classifications to the repo's
|
||||
rules, with you, the swarm UI user, as commit author. The page then links you to
|
||||
the forge's compare page for that branch, where you log in as usual and open the
|
||||
PR yourself.
|
||||
|
||||
- **The branch** is `review-classifier/<you>-<8 hex digits>`, made from the
|
||||
default branch's head with one commit, through the forge's contents API.
|
||||
|
|
|
|||
|
|
@ -28,6 +28,15 @@ scrolls sideways. Nothing makes the page itself scroll sideways at 360px.
|
|||
A dialog grows to fit its content, up to 64em or nine tenths of the window, whichever is
|
||||
smaller; short confirm dialogs stay short.
|
||||
|
||||
An action that can't be undone asks first, in a dialog with a red confirm button and
|
||||
the focus on **cancel**, so a stray **Enter** doesn't confirm it. These ask:
|
||||
destroying an agent, deleting a linked account or a claude login, removing a schedule,
|
||||
a flow or a stored API-key environment, **fire now** on a schedule, removing an
|
||||
allowed domain (swarm-wide, or for every agent from an agent's popover), moving an
|
||||
agent's internet to a looser mode, sending `/clear` as a message, reloading over
|
||||
unsaved instructions, and **push a branch for a PR** on the review try-out. A page
|
||||
asks from inside a handler with the `useConfirm` hook, with no dialog state of its own.
|
||||
|
||||
| route | what |
|
||||
| ---------------------------------------------- | -------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- |
|
||||
| `/` | the start page: the swarm's name over a digital-rain backdrop with the slug (`hyperhive / we are the wired`, its shaded gradients pulsing in a wave unless reduced motion is on) at the foot, plus a paperclip offering to set up an agent while no `ruth` exists, or her hive declares her destroyed (it opens the create form with `ruth` filled in); the swarm name in the header links here |
|
||||
|
|
@ -338,11 +347,11 @@ again. The page saves no classification and no result, and a run posts nothing
|
|||
to the forge; like every table in the UI, the result table remembers its column
|
||||
filters in the browser. It shows no token counts, cache counts or cost.
|
||||
|
||||
When a classification answers the way you want, **open a PR** proposes the
|
||||
classifications on the page to the repo. The classifier's forge account pushes
|
||||
a branch that adds them to the repo's rules file, with you as the commit's
|
||||
author, and the page links to the forge's page for opening the PR from that
|
||||
branch, where you log in as usual. A classification named like one the file
|
||||
When a classification answers the way you want, **push a branch for a PR** (it asks
|
||||
first) proposes the classifications on the page to the repo. The classifier's forge
|
||||
account pushes a branch that adds them to the repo's rules file, with you as the
|
||||
commit's author, and the page links to the forge's page for opening the PR from
|
||||
that branch, where you log in as usual. A classification named like one the file
|
||||
already holds replaces it, and the file's other rules stay. It needs no PR
|
||||
number. If the forge has no account of yours yet, log in to the forge once
|
||||
first. If the classifier's account may not push to the repo, the page says so:
|
||||
|
|
|
|||
Loading…
Reference in a new issue