Watch
0
0
Fork
You've already forked hyperhive
0

hive dashboard: an agent's name links to its terminal in the swarm UI

This commit is contained in:
iris 2026-11-16 22:55:58 +01:00 • committed by mara
commit 8ca6317356

View file

@ -9,6 +9,7 @@ import { el } from "@hive/shared/dom.js";
import { themedConfirm, themedToast } from "@hive/shared/modal.js";
import { h, render } from "preact";
import { JobqRollup } from "@hive/shared/jobq-rollup.js";
import { agentPageUrl, loginPageUrl } from "./agent-page.js";
import { containersState } from "./state.js";
import { closeAllMenus } from "@hive/shared/hive-menu.js";
import "./agent-menu/hive-agent-menu.js"; // registers <hive-agent-menu> — side-effect import
@ -258,6 +259,9 @@ function containerRowFingerprint(
// fetch for stable rows.
function buildContainerLi(c, opts) {
const { pending, opRunning, selected, url, containerBase, s } = opts;
// The agent has no page of its own; its name leads to its terminal in the swarm UI.
const pageUrl = agentPageUrl(s, c.name);
const loginUrl = loginPageUrl(s);
// A single `pending-running` class covers any active transient
// badge state (see the pending-badge derivation comment in
// renderContainers).
@ -318,11 +322,13 @@ function buildContainerLi(c, opts) {
// -- identity -------------------------------------------------------
const head = el("div", { class: "head" });
head.append(
el(
"a",
{ class: "name", href: url, target: "_blank", rel: "noopener" },
c.name,
),
pageUrl
? el(
"a",
{ class: "name", href: pageUrl, target: "_blank", rel: "noopener" },
c.name,
)
: el("span", { class: "name" }, c.name),
);
// Icon-only nav strip — populated async from the agent's own
// `GET /api/dashboard-state` (via gateway when enabled, direct
@ -474,17 +480,20 @@ function buildContainerLi(c, opts) {
),
);
} else if (c.needs_login) {
// Logging in again is on the swarm UI; without one the badge only says so.
head.append(
el(
"a",
{
class: "hive-pill-sm badge-warn",
href: url,
target: "_blank",
rel: "noopener",
},
"needs login →",
),
loginUrl
? el(
"a",
{
class: "hive-pill-sm badge-warn",
href: loginUrl,
target: "_blank",
rel: "noopener",
},
"needs login →",
)
: el("span", { class: "hive-pill-sm badge-warn" }, "needs login"),
);
}
if (c.paused) {