feat(webui): five-place top bar with Settings, New task and one connection pill
Dashboard, Tasks, Workflows, Events and Settings replace the Work, Agent and System menus. Configuration pages move under /settings/* with redirects from their old paths; Logs and Appearance leave the bar and stay reachable from Jump to, the Dashboard and the account menu. New task opens the Start work form in a dialog and lands on the new task. One pill reports the live stream's state. Drops docs/prds/dashboard-navigation-groups.md: web UI design is not tracked in PRDs.
This commit is contained in:
23 files changed
+453
-383
No files matched your search
@@ -0,0 +1,15 @@
|
||||
import assert from "node:assert/strict";
|
||||
import test from "node:test";
|
||||
|
||||
import { connectionStatus } from "../src/lib/connection.ts";
|
||||
|
||||
test("the connection pill names the stream state", () => {
|
||||
for (const [state, label, tone] of [
|
||||
["live", "Connected", "ok"],
|
||||
["connecting", "Connecting", "warn"],
|
||||
["reconnecting", "Connecting", "warn"],
|
||||
["unavailable", "Disconnected", "danger"],
|
||||
] as const) {
|
||||
assert.deepEqual(connectionStatus(state), { label, tone }, state);
|
||||
}
|
||||
});
|
||||
@@ -0,0 +1,74 @@
|
||||
import assert from "node:assert/strict";
|
||||
import test from "node:test";
|
||||
|
||||
import { buildNav, type NavRoute, type NavSpec } from "../src/lib/nav-tree.ts";
|
||||
|
||||
const table: NavRoute[] = [
|
||||
{ path: "/", meta: { label: "Dashboard" } },
|
||||
{ path: "/tasks", meta: { label: "Tasks" } },
|
||||
{ path: "/settings/models", meta: { label: "Models" } },
|
||||
{ path: "/settings/skills", meta: { label: "Skills" } },
|
||||
{ path: "/settings/channels", meta: { label: "Channels" } },
|
||||
{ path: "/logs", meta: { label: "Logs" } },
|
||||
];
|
||||
|
||||
const specs: NavSpec[] = [
|
||||
{ kind: "link", path: "/" },
|
||||
{ kind: "link", path: "/tasks" },
|
||||
{
|
||||
kind: "group",
|
||||
label: "Settings",
|
||||
sections: [
|
||||
{ label: "Agents", paths: ["/settings/models", "/settings/skills"] },
|
||||
{ label: "Integrations", paths: ["/settings/channels"] },
|
||||
],
|
||||
},
|
||||
];
|
||||
|
||||
test("each settings section labels its first visible item", () => {
|
||||
const nav = buildNav(table, specs, ["/settings/models"]);
|
||||
const group = nav.tree.find((n) => n.kind === "group");
|
||||
assert.ok(group && group.kind === "group");
|
||||
assert.deepEqual(
|
||||
group.items.map((i) => [i.path, i.dividerBefore]),
|
||||
[
|
||||
["/settings/skills", "Agents"],
|
||||
["/settings/channels", "Integrations"],
|
||||
],
|
||||
);
|
||||
});
|
||||
|
||||
test("a section with every item hidden leaves no label behind", () => {
|
||||
const nav = buildNav(table, specs, ["/settings/models", "/settings/skills"]);
|
||||
const group = nav.tree.find((n) => n.kind === "group");
|
||||
assert.ok(group && group.kind === "group");
|
||||
assert.deepEqual(
|
||||
group.items.map((i) => [i.path, i.dividerBefore]),
|
||||
[["/settings/channels", "Integrations"]],
|
||||
);
|
||||
});
|
||||
|
||||
test("a group with every item hidden is dropped", () => {
|
||||
const nav = buildNav(table, specs, [
|
||||
"/settings/models",
|
||||
"/settings/skills",
|
||||
"/settings/channels",
|
||||
]);
|
||||
assert.deepEqual(
|
||||
nav.tree.map((n) => (n.kind === "link" ? n.entry.path : n.label)),
|
||||
["/", "/tasks"],
|
||||
);
|
||||
});
|
||||
|
||||
test("jump targets add unlisted pages to what the bar reaches", () => {
|
||||
const nav = buildNav(table, specs, [], ["/logs"]);
|
||||
assert.deepEqual(
|
||||
nav.jumpTargets.map((e) => e.path),
|
||||
["/", "/tasks", "/settings/models", "/settings/skills", "/settings/channels", "/logs"],
|
||||
);
|
||||
assert.deepEqual(buildNav(table, specs, ["/logs"], ["/logs"]).jumpTargets.map((e) => e.path).includes("/logs"), false);
|
||||
});
|
||||
|
||||
test("a spec naming a missing route fails loudly", () => {
|
||||
assert.throws(() => buildNav(table, [{ kind: "link", path: "/nope" }]), /\/nope/);
|
||||
});
|
||||
@@ -1,22 +0,0 @@
|
||||
import assert from "node:assert/strict";
|
||||
import { readFile } from "node:fs/promises";
|
||||
import test from "node:test";
|
||||
|
||||
const navModel = await readFile(
|
||||
new URL("../src/lib/nav.ts", import.meta.url),
|
||||
"utf8",
|
||||
);
|
||||
const navGroup = await readFile(
|
||||
new URL("../src/components/topbar/NavGroup.vue", import.meta.url),
|
||||
"utf8",
|
||||
);
|
||||
|
||||
test("System separates operational pages from settings before Task settings", () => {
|
||||
assert.match(
|
||||
navModel,
|
||||
/label:\s*"System"[\s\S]*dividerBefore:\s*\{\s*path:\s*"\/system\/tasks",\s*label:\s*"Settings"\s*\}/,
|
||||
);
|
||||
assert.match(navGroup, /DropdownMenuSeparator/);
|
||||
assert.match(navGroup, /DropdownMenuLabel/);
|
||||
assert.match(navGroup, /item\.dividerBefore/);
|
||||
});
|
||||
Reference in new issue
Block a user