diff --git a/docs/2-handbook/hives/README.md b/docs/2-handbook/hives/README.md index 2a0d2d86c..84e6ae42f 100644 --- a/docs/2-handbook/hives/README.md +++ b/docs/2-handbook/hives/README.md @@ -29,11 +29,11 @@ the other surfaces: the API docs and the swarm UI. The dashboard is a single page with these tabs: -- **4G3NTS** — every agent, live. This is the default tab and the one you +- **agents** — every agent, live. This is the default tab and the one you check most. -- **R3BU1LD QU3U3** — the rebuild queue. A build's output and history are on +- **rebuild queue** — the rebuild queue. A build's output and history are on the swarm's `builds` Grafana board. -- **K3PT ST4T3** — kept state from agents with no container (tombstones), +- **kept state** — kept state from agents with no container (tombstones), with a purge button per entry. Each agent also serves a small web server, with its stats and screen pages: open diff --git a/docs/2-handbook/hives/dashboard.md b/docs/2-handbook/hives/dashboard.md index 62c1286f3..cd22a23d5 100644 --- a/docs/2-handbook/hives/dashboard.md +++ b/docs/2-handbook/hives/dashboard.md @@ -8,16 +8,17 @@ creation, linking external forge and matrix accounts, the controller's job graph) and is where you do day-to-day work. The hive dashboard keeps shrinking: parts of it go, bit by bit. -A fixed header holds the tab strip, a **pages** menu with links to the API docs -and the swarm UI, and a profile menu with your authelia settings and sign-out. +The header looks like the swarm UI's: the hive's name, the tabs, a settings menu +for the theme, a **pages** menu with links to the API docs and the swarm UI, and +a profile menu with your authelia settings and sign-out. The URL hash (`#agents`, `#rebuild`, `#kept`) picks the tab. -- **4G3NTS** lists the hive's containers, one row each, sorted by name, with +- **agents** lists the hive's containers, one row each, sorted by name, with the agent's status and the actions on it: rebuild, start, stop, destroy. A red banner at the top says two agents hash to the same port. Rename one and rebuild. -- **R3BU1LD QU3U3** shows the rebuild queue and each build's log. -- **K3PT ST4T3** lists agents with kept state and no container, with their size +- **rebuild queue** shows the rebuild queue and each build's log. +- **kept state** lists agents with kept state and no container, with their size and age. **PURG3** wipes one's state directory. The list also shows an agent that's part-way through a spawn, because both look the same on disk: the row says `offline` and the tab carries a warning. diff --git a/docs/4-implementation/web-ui/dashboard.md b/docs/4-implementation/web-ui/dashboard.md index 1860632c3..a3d51f114 100644 --- a/docs/4-implementation/web-ui/dashboard.md +++ b/docs/4-implementation/web-ui/dashboard.md @@ -11,15 +11,18 @@ matrix accounts, the controller's job graph — are on the [swarm UI](../../2-handbook/swarm/ui.md). hive-c0re serves the dashboard at `/`. -It has a fixed chrome header at the top and a `
` that shows exactly -one tab pane at a time. The URL hash (`#agents`, `#rebuild`, +Its chrome is `@hive/shared`'s `AppShell`, the same header, nav and settings +menu the swarm UI has (`shell.js` mounts it), and the content column below it +shows exactly one tab pane at a time. The URL hash (`#agents`, `#rebuild`, `#kept`) drives which pane is active; hash changes don't reload the page. -**Chrome header** (fixed, overlays the active tab pane): +**Chrome header** (sticky, over the active tab pane): + +- **Brand**: the hive's name, from `state.hive_name`. - **Pages menu**: a link icon at the right end of the chrome, beside the - profile avatar (`links-menu.js`, `@hive/shared`'s `LinksMenu`, the same + profile avatar (`shell.js`, `@hive/shared`'s `LinksMenu`, the same component the swarm UI uses for its service links), opening a popover with links to **api docs** (`/api/docs/`) and **swarm** (the swarm UI at the swarm apex domain, opened in a new tab). The swarm entry @@ -27,7 +30,7 @@ active; hash changes don't reload the page. `HIVE_SWARM_PUBLIC_URL` (set from `services.hyperhive.swarm.domain`); with no domain set there is no swarm entry. The standalone pages link back to `/`. - **Profile menu**: the signed-in user's avatar at the right end of the - chrome (`user-menu.js`, the same component as the swarm UI's and the agent + chrome (`shell.js`, `@hive/shared`'s `UserMenu`, the same component as the swarm UI's and the agent page's). It opens a popover with the user's name and links to authelia's settings and sign-out pages. The name comes from `/api/whoami`, which the dashboard's nginx vhost proxies to authelia, and the links from @@ -35,10 +38,12 @@ active; hash changes don't reload the page. `HIVE_AUTHELIA_PUBLIC_URL` (set from `services.hyperhive.swarm.authelia.url`). If the name doesn't load the avatar shows a question mark, and without the URL the popover has no links. -- **Tab strip**: `◆ 4G3NTS ◆`, `◆ R3BU1LD QU3U3 ◆`, - `◆ K3PT ST4T3 ◆`. +- **Settings menu**: the theme, motion and solid-background settings, kept in + this page's own browser storage. +- **Nav**: **agents**, **rebuild queue** and **kept state**, with the sliding + underline the swarm UI has. - **Banner-thin** (`░▒▓█▓▒░ HYPERHIVE / HIVE-C0RE / WE ARE THE WIRED ░▒▓█▓▒░`) - — sits below the tab strip. + — sits in the footer. - **No warning banner.** No page shows hive-level warnings (host disk pressure, failing background sweeps, forge boot failures, agents that need a claude login). They live in a push-based registry @@ -50,9 +55,8 @@ active; hash changes don't reload the page. A container crash is a swarm-level Grafana alert on the crash watcher's own log line, so a hive with no otel export has no operator-visible warning signal beyond `/health/ready`. -- **Browser tab title** — `hyperhive // h1ve-c0re` by default; updated - to ` / // h1ve-c0re` once `hive_name` / `swarm_name` - arrive in the state snapshot. +- **Browser tab title** — ` · `, such as `agents · pr1ma`, once + `hive_name` arrives in the state snapshot. ## 4G3NTS tab diff --git a/frontend/packages/dashboard/package.json b/frontend/packages/dashboard/package.json index 48f47931d..886a621c8 100644 --- a/frontend/packages/dashboard/package.json +++ b/frontend/packages/dashboard/package.json @@ -5,7 +5,8 @@ "description": "hive-c0re dashboard SPA. Bundled by esbuild into a static dist; served by the hive-c0re Rust binary at runtime via tower_http::ServeDir.", "type": "module", "scripts": { - "build": "node ./build.mjs" + "build": "node ./build.mjs", + "test": "node --test test/*.test.mjs" }, "dependencies": { "@hive/shared": "*", diff --git a/frontend/packages/dashboard/src/common.css b/frontend/packages/dashboard/src/common.css index fa03f0b02..071999b70 100644 --- a/frontend/packages/dashboard/src/common.css +++ b/frontend/packages/dashboard/src/common.css @@ -128,23 +128,3 @@ code { color: var(--amber); border-color: var(--amber); } - -/* ─── page-content gutter ───────────────────────────────────────────── - Inverted-gutter layout: the dashboard keeps `` full-bleed - and wraps their padded content in a single `.page-content` div that - carries the horizontal gutter. Full-width chrome (the tab strip, the - footer) then spans edge-to-edge for free, - with no negative-margin breakout hacks. Only matches on pages that opt - in by adding the wrapper (index.html). */ -.page-content { - padding: 0 1.5em; -} - -/* ─── sticky top region ─────────────────────────────────────────────── - One sticky container per page holding the page chrome (tab bar / page - header). common.js (initStickyTop) wraps the chrome in this on load. */ -.sticky-top { - position: sticky; - top: 0; - z-index: 50; -} diff --git a/frontend/packages/dashboard/src/common.js b/frontend/packages/dashboard/src/common.js index 253781fcc..287b3206f 100644 --- a/frontend/packages/dashboard/src/common.js +++ b/frontend/packages/dashboard/src/common.js @@ -282,23 +282,3 @@ export function openStream(url) { noteWorkerActivity(); return target; } - -// ─── sticky top region ─────────────────────────────────────────────── -// One sticky container wrapping the page's chrome (tab bar / page -// header), built once by wrapping the existing chrome element. A page -// without a chrome (none today) gets an empty sticky region at the top of -// . -export function initStickyTop() { - let top = document.querySelector(".sticky-top"); - if (top) return top; - top = document.createElement("div"); - top.className = "sticky-top"; - const chrome = document.querySelector(".dashboard-chrome, .page-header"); - if (chrome && chrome.parentNode) { - chrome.parentNode.insertBefore(top, chrome); - top.append(chrome); - } else { - document.body.prepend(top); - } - return top; -} diff --git a/frontend/packages/dashboard/src/dashboard.css b/frontend/packages/dashboard/src/dashboard.css index 99d21bde6..229f642e0 100644 --- a/frontend/packages/dashboard/src/dashboard.css +++ b/frontend/packages/dashboard/src/dashboard.css @@ -9,17 +9,20 @@ @import "@hive/shared/jobq-graph.css"; @import "@hive/shared/user-menu.css"; @import "@hive/shared/links-menu.css"; +@import "@hive/shared/app-shell.css"; +@import "@hive/shared/icon-button.css"; +@import "@hive/shared/settings-menu.css"; +@import "@hive/shared/solid-backgrounds.css"; -/* ─── tabbed dashboard chrome ────────────────────────────────────── - Top-of-page sticky header with banner + tab strip. SSE stays - alive across tab switches. See docs/4-implementation/web-ui/dashboard.md::Chrome header + Tab strip for the - routing model. */ +/* ─── the dashboard page ─────────────────────────────────────────── + The chrome (header, nav, settings) is `@hive/shared`'s AppShell, drawn by + shell.js; SSE stays alive across tab switches. See + docs/4-implementation/web-ui/dashboard.md::Chrome header + Tab strip. */ body.dashboard-shell { /* Full-bleed body (no horizontal gutter). The 1.5em side gutter lives - on the inner `.page-content` wrapper (see common.css), so the sticky - chrome bar and the footer span the full - width edge-to-edge with no negative-margin breakout. `padding-bottom` + in the shell's content column, so the footer spans the full width + edge-to-edge with no negative-margin breakout. `padding-bottom` keeps a little breathing room above the viewport edge (overridden to clear the selection bar via `.has-selection` below). No max-width cap — wide screens use the full width rather than empty side margins. */ @@ -27,40 +30,6 @@ body.dashboard-shell { padding-bottom: 1.5em; } -.dashboard-chrome { - /* Pages menu + tab strip share one row (flex). The chrome owns the - horizontal gutter and the single full-width bottom divider; its - children drop their own side padding / border so they sit inline. */ - display: flex; - align-items: center; - gap: 0.75em; - /* Stickiness lives on the `.sticky-top` wrapper (common.css) that - common.js wraps this chrome in. */ - background: color-mix( - in srgb, - var(--bg) calc(100% - 14% * var(--glass-clear)), - transparent - ); - -webkit-backdrop-filter: var(--glass-filter); - backdrop-filter: var(--glass-filter); - border-bottom: 1px solid var(--purple-dim); - padding: 0.3em 1em; - margin: 0 0 1em; -} -/* The pages menu and the profile menu, together at the right end of the - chrome. Their own looks are `@hive/shared/links-menu.css`'s and - `@hive/shared/user-menu.css`'s. */ -.dashboard-chrome-actions { - display: flex; - align-items: center; - gap: 0.25em; - flex: none; - margin-left: auto; -} -.links-menu-slot, -.user-menu-slot { - flex: none; -} .banner-thin { text-align: center; margin: 0; @@ -73,52 +42,8 @@ body.dashboard-shell { text-overflow: ellipsis; } -.tabbar { - display: flex; - flex-wrap: nowrap; - align-items: center; - gap: 0.2em; - /* On one row with the chrome's menus; the chrome owns the gutter + - the bottom divider, so no outer padding / border here. */ -} -/* Shares the flat-pill aesthetic of the shared `.hive-tab` (sub-tabs on - the standalone pages) so the chrome reads as one family. Kept a touch - weightier than bare `.hive-tab` — larger font, bold labels, count - pills — since this is the dashboard's primary nav, not a sub-strip. */ -.tabbar .tab { - display: inline-flex; - align-items: center; - gap: 0.5em; - flex-shrink: 0; - padding: 0.4em 0.95em; - color: var(--muted); - font-family: inherit; - font-size: 0.92em; - letter-spacing: 0.06em; - text-decoration: none; - border: 0; - border-radius: 4px; - cursor: pointer; - transition: - color 0.15s ease, - background 0.15s ease; -} -.tabbar .tab:hover { - color: var(--fg); - background: var(--border); -} -.tabbar .tab.hive-tab--active { - color: var(--purple); - background: var(--border); -} -.tab-label { - font-weight: bold; - white-space: nowrap; -} - -/* Tab pane visibility — createTabStrip (@hive/shared/tabs.js) sets the - `hidden` attribute on every inactive pane (resolved from the URL hash; - default — no hash — is 4G3NTS). Only the active pane stays visible. */ +/* Tab pane visibility: shell.js sets the `hidden` attribute on every pane but + the one the URL hash names. */ .tab-pane[hidden] { display: none; } diff --git a/frontend/packages/dashboard/src/index.html b/frontend/packages/dashboard/src/index.html index 21bd4c78e..95835f094 100644 --- a/frontend/packages/dashboard/src/index.html +++ b/frontend/packages/dashboard/src/index.html @@ -11,141 +11,78 @@ - -
- - -
- -
-
-
- - - -
-
- - - - + - - -
+
- +