Watch
0
0
Fork
You've already forked hyperhive
0

hive ui: the dashboard wears the swarm UI's chrome, and its own header, tab strip and menu mounts go

The dashboard mounts @hive/shared's AppShell, the header, nav and settings menu the swarm UI has, from a new shell.js: the hive's name for the brand, the tabs agents, rebuild queue and kept state routed by the URL hash, the theme, motion and solid-background settings in this page's own browser storage, and the shared links and user menus. The three tab panes stay plain DOM, kept hidden in index.html and moved into the shell's content column by shell.js. The tabs, the hash-to-tab parse and the menu entries sit in shell-routes.js, which npm test covers (the dashboard package gets a test script). The old header, the createTabStrip tabbar, the leet tab names, the identity headline and title code, the sticky-top wrapper, the links-menu.js and user-menu.js mounts and their CSS are removed. The docs say the plain tab names and the new chrome.
This commit is contained in:
iris 2026-11-21 10:21:21 +01:00
commit 7707a257e9

View file

@ -8,10 +8,9 @@
// live in `./common.js`.
// 4G3NTS (containers) domain lives in `./agents.js`.
import { $, openStream, initStickyTop } from "./common.js";
import { $, openStream } from "./common.js";
import { el } from "@hive/shared/dom.js";
import { bindAsyncForms } from "@hive/shared/forms.js";
import { createTabStrip } from "@hive/shared/tabs.js";
import { containersState, syncContainersFromSnapshot } from "./state.js";
import {
initJobqRollup,
@ -30,12 +29,9 @@ import {
renderKept,
syncKeptFromSnapshot,
} from "./kept.js";
import { renderLinksMenu } from "./links-menu.js";
import { renderUserMenu } from "./user-menu.js";
import { renderShell } from "./shell.js";
(() => {
initStickyTop();
// ─── async forms ────────────────────────────────────────────────────────
// Shared `data-async` submit interceptor (in common.js, shared with the other
// pages' bundles). On success it re-runs refreshState unless the form
@ -121,23 +117,6 @@ import { renderUserMenu } from "./user-menu.js";
// synchronous read (e.g. the compose autocomplete pulls agent
// names from here instead of refetching on every keystroke).
window.__hyperhive_state = s;
// Hive identity: render the swarm/hive name as a headline at the
// top of the 4G3NTS pane + update the page title once the
// server-side display names are known. `hive_name` / `swarm_name`
// come from HYPERHIVE_HIVE_NAME / HYPERHIVE_SWARM_NAME env vars
// (set by services.hyperhive.{hiveName,swarmName} nix options).
// When unset we fall back gracefully — the headline stays hidden.
const hiveId = $("swarm-identity");
if (hiveId) {
const hive = s.hive_name;
const swarm = s.swarm_name;
if (hive || swarm) {
const label = swarm && hive ? `${swarm} / ${hive}` : hive || swarm;
hiveId.textContent = label;
hiveId.hidden = false;
document.title = label + " // h1ve-c0re";
}
}
const openDetails = snapshotOpenDetails();
// Sync transients + containers first so renderContainers below
// sees the current derived maps (it reads from
@ -155,8 +134,7 @@ import { renderUserMenu } from "./user-menu.js";
syncKeptFromSnapshot(s);
renderContainers(s);
renderKept();
renderLinksMenu(s);
renderUserMenu(s);
renderShell(s, activateTab);
renderHiveRev(s.hyperhive_rev);
restoreOpenDetails(openDetails);
// No periodic refresh timer. Phase 6 covers every container
@ -256,16 +234,8 @@ import { renderUserMenu } from "./user-menu.js";
})();
// ─── tab routing ───────────────────────────────────────────────────────
// Hash-based: `#agents` / `#rebuild` / `#kept`
// activate the matching pane on the dashboard. Empty
// hash defaults to 4G3NTS. Tab routing only applies when the tab DOM is
// present.
// The shared hash-routed tab strip (@hive/shared/tabs.js) owns the
// tab/pane toggle + aria-selected + routing; `activateTab` runs the
// per-tab side-effects via the strip's onShow. Constructed below (after
// the lazy-load fns it calls are defined). The responsive overflow menu
// was dropped — if the strip ever runs out of room we move panes
// to their own pages rather than hide them in a dropdown.
// The shell (`shell.js`) routes by the URL hash (`#agents`, `#rebuild`,
// `#kept`; none means agents) and calls this each time a tab is shown.
function activateTab(target) {
// Track active tab on the body so renderSelectionBar can gate
// visibility (bar only belongs on 4G3NTS where agent cards live).
@ -273,11 +243,8 @@ import { renderUserMenu } from "./user-menu.js";
renderSelectionBar(Array.from(containersState.values()));
}
// Wire the shared tab strip now that activateTab + the lazy-load fns it
// calls are defined. The strip resolves the active tab from the hash
// (default 4G3NTS), toggles the active tab/pane + aria-selected, and
// fires activateTab for the per-tab side-effects on every change.
createTabStrip($("tabbar"), { defaultId: "agents", onShow: activateTab });
// Draw the shell before the first state arrives, so the page has its frame.
renderShell(null, activateTab);
// The rebuild queue mounts now, not on first show.
initBuilds();
})();