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
1 changed files with 353 additions and 60 deletions
|
|
@ -8,6 +8,7 @@ import {
|
|||
internetBody,
|
||||
internetMode,
|
||||
internetSummary,
|
||||
loosensInternet,
|
||||
MAX_REPOS,
|
||||
maxReposBody,
|
||||
parseMaxRepos,
|
||||
|
|
@ -109,3 +110,13 @@ test("the limit's body carries the stored list, so the PUT does not reset it", (
|
|||
});
|
||||
assert.deepEqual(maxReposBody(undefined, 0), { max_repos: 0 });
|
||||
});
|
||||
|
||||
test("only a change that lets more traffic through is asked first", () => {
|
||||
assert.equal(loosensInternet("restricted", "log"), true);
|
||||
assert.equal(loosensInternet("restricted", "unrestricted"), true);
|
||||
assert.equal(loosensInternet("log", "unrestricted"), true);
|
||||
assert.equal(loosensInternet("unrestricted", "restricted"), false);
|
||||
assert.equal(loosensInternet("unrestricted", "log"), false);
|
||||
assert.equal(loosensInternet("log", "restricted"), false);
|
||||
assert.equal(loosensInternet("log", "log"), false);
|
||||
});
|
||||
|
|
|
|||
Loading…
Reference in a new issue