swarm ui: agents page opens an agent's details beside the list
Selecting an agent card opens its details in a column on the right of the agents list, at /agents/<name>, instead of unfolding the card in place. The list is full width until an agent is selected, then narrows and the details slide in. A narrow screen shows the details alone, with a back button. A card's message is cut to one line. The shell treats /agents/<name> as the agents page, so the nav tab stays lit and the page is not rebuilt on each selection.
This commit is contained in:
parent
2d3da56907
commit
7bdaea7954
5 changed files with 494 additions and 154 deletions
|
|
@ -1,4 +1,4 @@
|
|||
// An opened agent card's permissions editor: its starting selection and the
|
||||
// The agent details' permissions editor: its starting selection and the
|
||||
// summary line. Run by `npm test` with Node's type stripping.
|
||||
import assert from "node:assert/strict";
|
||||
import { test } from "node:test";
|
||||
|
|
|
|||
|
|
@ -1,4 +1,4 @@
|
|||
// An opened agent card's SSH row: the badge, the PUT body and the target
|
||||
// The agent details' SSH row: the badge, the PUT body and the target
|
||||
// snippets. Run by `npm test` with Node's type stripping.
|
||||
import assert from "node:assert/strict";
|
||||
import { test } from "node:test";
|
||||
|
|
|
|||
|
|
@ -1,4 +1,4 @@
|
|||
// An opened agent card's allowed-domains editor: which entries one agent sees and
|
||||
// The agent details' allowed-domains editor: which entries one agent sees and
|
||||
// the bodies it sends. Run by `npm test` with Node's type stripping.
|
||||
import assert from "node:assert/strict";
|
||||
import { test } from "node:test";
|
||||
|
|
|
|||
|
|
@ -1,4 +1,4 @@
|
|||
// The sections an opened agent card holds. Run by `npm test`, which Node runs
|
||||
// The sections an agent's details hold. Run by `npm test`, which Node runs
|
||||
// with its built-in test runner and type stripping.
|
||||
import assert from "node:assert/strict";
|
||||
import { test } from "node:test";
|
||||
|
|
|
|||
|
|
@ -3,8 +3,11 @@ import assert from "node:assert/strict";
|
|||
import { test } from "node:test";
|
||||
import {
|
||||
MOVED_ROUTES,
|
||||
agentPath,
|
||||
isFullBleedRoute,
|
||||
movedHref,
|
||||
pageOf,
|
||||
selectedAgent,
|
||||
visibleNavItems,
|
||||
} from "../src/shell/routes.ts";
|
||||
|
||||
|
|
@ -80,3 +83,33 @@ test("a group of agent terminals is full-bleed", () => {
|
|||
assert.equal(isFullBleedRoute("/agents/group/ab12cd34"), true);
|
||||
assert.equal(isFullBleedRoute("/agents/group"), false);
|
||||
});
|
||||
|
||||
test("one segment after /agents selects that agent on the agents page", () => {
|
||||
assert.equal(selectedAgent("/agents/iris"), "iris");
|
||||
assert.equal(selectedAgent("/agents/a%20b"), "a b");
|
||||
assert.equal(agentPath("a b"), "/agents/a%20b");
|
||||
assert.equal(selectedAgent(agentPath("a/b")), "a/b");
|
||||
});
|
||||
|
||||
test("the agents list, a group and a terminal select no agent", () => {
|
||||
for (const path of [
|
||||
"/agents",
|
||||
"/agents/",
|
||||
"/agents/group",
|
||||
"/agents/group/g1",
|
||||
"/agents/iris/terminal",
|
||||
"/agents/iris/subagents/s/terminal",
|
||||
"/jobs",
|
||||
]) {
|
||||
assert.equal(selectedAgent(path), null, path);
|
||||
}
|
||||
assert.equal(selectedAgent("/agents/%E0%A4%A"), null);
|
||||
});
|
||||
|
||||
test("an agent selected on the agents page is still the agents page", () => {
|
||||
assert.equal(pageOf("/agents/iris"), "/agents");
|
||||
assert.equal(pageOf("/agents"), "/agents");
|
||||
assert.equal(pageOf("/agents/iris/terminal"), "/agents/iris/terminal");
|
||||
assert.equal(pageOf("/agents/group/g1"), "/agents/group/g1");
|
||||
assert.equal(pageOf("/jobs"), "/jobs");
|
||||
});
|
||||
|
|
|
|||
Loading…
Reference in a new issue