web: one status glyph, a compact settings button and collapsible panes

- Run and pipeline rows use one coloured status glyph with the word in its
  tooltip; the run version sits at the right of the title line; the usage
  metrics row is gone.
- Settings is an icon beside the connection status (rail and dock), not a
  destination tab; the destinations keep a roving tab even while Settings is
  open.
- The rail and every list pane collapse to a narrow strip from an icon at their
  top-right (remembered per device). A collapsed runs list shows the status
  glyph, pipelines their flow glyph, chats their status word.
- Tool calls open in a modal (rendered/expanded rows in place) instead of an
  inline popover; the chip stays a quiet line beside the message.
- Refresh tooltips show the last data arrival (manual or socket) per
  destination.
This commit is contained in:
2026-10-20 01:36:38 +01:00
parent 9a450e0ebb
commit 3314f8405b
11 changed files with 488 additions and 118 deletions
+98 -10
View File
@@ -28,6 +28,7 @@ import { layoutGraph } from "./graph.js";
import { readGraphExpanded } from "./graphPrefs.js";
import { readArtifactView } from "./artifactViewPrefs.js";
import { readChatStars } from "./chatStars.js";
import { readLayoutPrefs, writeLayoutPrefs } from "./layoutPrefs.js";
import { DEFAULT_ROUTE, parseRoute, serializeRoute } from "./routes.js";
import { EMPTY_PIPELINE_FILTERS, PIPELINE_DETAIL_TABS } from "./pipelines.js";
import {
@@ -180,6 +181,8 @@ const state = {
artifactView: readArtifactView(),
// Starred chat sessions (chatStars.js): local, always sorted first.
chatStars: readChatStars(),
// The collapsed rail/list choices (layoutPrefs.js), restored per device.
...readLayoutPrefs(),
// Whether the CLOSED chats group is expanded (the chevron beside its name).
chatClosedOpen: false,
// The last time each destination's data arrived (manual refresh or a socket
@@ -458,7 +461,9 @@ const railDestinations = h(
"aria-label": "Destinations",
"aria-orientation": "vertical",
},
...DESTINATIONS.map((destination) => destinationTab(destination, "rail")),
...DESTINATIONS.filter((destination) => destination.key !== "settings").map((destination) =>
destinationTab(destination, "rail"),
),
);
const dockDestinations = h(
@@ -469,7 +474,9 @@ const dockDestinations = h(
role: "tablist",
"aria-label": "Destinations",
},
...DESTINATIONS.map((destination) => destinationTab(destination, "dock")),
...DESTINATIONS.filter((destination) => destination.key !== "settings").map((destination) =>
destinationTab(destination, "dock"),
),
);
const railSearch = h(
@@ -517,6 +524,25 @@ function statusControl(id, mount) {
const railStatus = statusControl("shellStatus", "rail");
const dockStatus = statusControl("shellStatusNarrow", "dock");
function settingsControl(mount) {
return h(
"button",
{
id: mount === "rail" ? "railSettings" : "dockSettings",
class: mount === "rail" ? "shell-settings rail-settings" : "shell-settings dock-settings",
type: "button",
title: "Settings",
"aria-label": "Settings",
"data-settings-destination": "settings",
onclick: () => goToDestination("settings"),
},
icon("settings"),
);
}
const railSettings = settingsControl("rail");
const dockSettings = settingsControl("dock");
const railSections = h("div", { id: "railSections", class: "rail-sections" });
const sectionStrip = h("nav", {
id: "sectionStrip",
@@ -527,6 +553,14 @@ const sectionStrip = h("nav", {
const appRail = h(
"aside",
{ id: "appRail", class: "app-rail", "aria-label": "Pipelines navigation" },
h("button", {
id: "railCollapse",
class: "shell-collapse rail-collapse",
type: "button",
title: "Collapse navigation",
"aria-label": "Collapse navigation",
"aria-expanded": "true",
}),
h(
"div",
{ class: "rail-brand" },
@@ -545,7 +579,7 @@ const appRail = h(
railDestinations,
h("div", { class: "rail-divider", role: "presentation" }),
railSections,
h("div", { class: "rail-footer" }, railStatus),
h("div", { class: "rail-footer" }, h("div", { class: "rail-footer-row" }, railStatus, railSettings)),
);
// The omni-search panel is part of the workspace flow: it takes height from the
@@ -568,7 +602,7 @@ const workspace = h(
const dock = h(
"nav",
{ id: "destinationDock", class: "destination-dock", "aria-label": "Destinations" },
dockStatus,
h("div", { class: "dock-status-row" }, dockStatus, dockSettings),
h("div", { class: "dock-row" }, dockSearch, dockDestinations),
);
// The attention sheet lives in its own layer so it can overlay any view without
@@ -581,6 +615,18 @@ const modalLayer = h("div", { id: "modalLayer" });
const skipLink = h("a", { class: "skip-link", href: "#pane-main", text: "Skip to detail" });
document.body.append(skipLink);
document.body.append(h("div", { class: "app-root" }, appRail, workspace, dock));
appRail.querySelector("#railCollapse")?.addEventListener("click", () => {
state.railCollapsed = !state.railCollapsed;
applyLayoutState();
});
document.addEventListener("click", (event) => {
const button = event.target instanceof Element ? event.target.closest("#listCollapse") : null;
if (!button) return;
state.listCollapsed = !state.listCollapsed;
writeLayoutPrefs(state);
renderContent();
});
applyLayoutState();
document.body.append(attentionLayer);
document.body.append(modalLayer);
@@ -647,11 +693,17 @@ function clearServerUrlError() {
/** Repaint the shell chrome in place; the rail itself is never rebuilt. */
function renderHeader() {
const activeKey = destinationForView(state.view);
const activeIndex = destinationIndex(activeKey);
for (const tab of document.querySelectorAll("[data-destination]")) {
const isActive = tab.getAttribute("data-destination") === activeKey;
const tabs = [...document.querySelectorAll("[data-destination]")];
const keys = tabs.map((tab) => tab.getAttribute("data-destination"));
// Settings is a separate control beside the status, so while it is open no
// destination tab is selected; keep the first one in the roving order.
const activeIndex = keys.indexOf(activeKey);
const roving = activeIndex >= 0 ? activeIndex : 0;
for (const tab of tabs) {
const key = tab.getAttribute("data-destination");
const isActive = key === activeKey;
tab.setAttribute("aria-selected", isActive ? "true" : "false");
tab.setAttribute("tabindex", rovingTabindex(activeIndex, DESTINATIONS.findIndex((d) => d.key === tab.getAttribute("data-destination"))));
tab.setAttribute("tabindex", rovingTabindex(roving, keys.indexOf(key)));
if (isActive) tab.setAttribute("aria-current", "page");
else tab.removeAttribute("aria-current");
}
@@ -662,6 +714,12 @@ function renderHeader() {
if (label) label.textContent = status.text;
control.setAttribute("aria-label", `Connection status: ${status.text}. Open Settings`);
}
for (const control of document.querySelectorAll("[data-settings-destination='settings']")) {
const active = activeKey === "settings";
control.classList.toggle("active", active);
if (active) control.setAttribute("aria-current", "page");
else control.removeAttribute("aria-current");
}
railSearch.setAttribute("aria-expanded", state.searchOpen ? "true" : "false");
dockSearch.setAttribute("aria-expanded", state.searchOpen ? "true" : "false");
// aria-controls points at #searchPanel only while that panel exists.
@@ -849,10 +907,37 @@ function paneHeading(title, { detailOpen, subtitle = "", actions = [] } = {}) {
{ class: "pane-head" },
h("div", { class: "pane-head-text" }, h(tag, { class: "pane-title", id: "listTitle", text: title }), subtitle ? h("h2", { class: "pane-subtitle", text: subtitle }) : null),
);
if (actions.length) head.append(h("div", { class: "pane-head-actions" }, ...actions));
head.append(h("div", { class: "pane-head-actions" }, ...actions, listCollapseButton()));
return head;
}
/** The icon that collapses the list pane to a narrow strip and back. */
function listCollapseButton() {
const collapsed = state.listCollapsed === true;
return h("button", {
id: "listCollapse",
class: "shell-collapse list-collapse",
type: "button",
title: collapsed ? "Expand list" : "Collapse list",
"aria-label": collapsed ? "Expand list" : "Collapse list",
"aria-expanded": collapsed ? "false" : "true",
text: collapsed ? "\u203a" : "\u2039",
});
}
function applyLayoutState() {
appRail.classList.toggle("collapsed", state.railCollapsed === true);
const railButton = document.getElementById("railCollapse");
if (railButton) {
const label = state.railCollapsed ? "Expand navigation" : "Collapse navigation";
railButton.title = label;
railButton.setAttribute("aria-label", label);
railButton.setAttribute("aria-expanded", state.railCollapsed ? "false" : "true");
railButton.textContent = state.railCollapsed ? "\u203a" : "\u2039";
}
writeLayoutPrefs(state);
}
function listSubtitle(view) {
switch (view) {
case "runs":
@@ -1031,7 +1116,10 @@ function renderContent() {
: state.selectedTemplateKey != null;
const activePane = detailOpen ? "detail" : "list";
const model = detailSections();
const layout = h("div", { class: "pane-layout", "data-active-pane": activePane });
const layout = h("div", {
class: `pane-layout${state.listCollapsed ? " list-collapsed" : ""}`,
"data-active-pane": activePane,
});
if (view === "pipelines") {
layout.append(
+30
View File
@@ -0,0 +1,30 @@
// The shell's two layout preferences: a collapsed destination rail and a
// collapsed list pane. Per-device, so they survive reloads.
export const LAYOUT_KEY = "pipelines.web.layout.v1";
export function readLayoutPrefs(storage = globalThis.localStorage) {
try {
const parsed = JSON.parse(storage?.getItem(LAYOUT_KEY) ?? "{}");
return {
railCollapsed: parsed?.railCollapsed === true,
listCollapsed: parsed?.listCollapsed === true,
};
} catch {
return { railCollapsed: false, listCollapsed: false };
}
}
export function writeLayoutPrefs(prefs, storage = globalThis.localStorage) {
try {
storage?.setItem(
LAYOUT_KEY,
JSON.stringify({
railCollapsed: prefs?.railCollapsed === true,
listCollapsed: prefs?.listCollapsed === true,
}),
);
} catch {
// Storage may be unavailable; the in-memory choice still applies.
}
}
+62
View File
@@ -0,0 +1,62 @@
// The one status glyph used in list rows: a single coloured icon whose tooltip
// and accessible name say the state. The pill text badge is deliberately gone.
import { h } from "./dom.js";
const NS = "http://www.w3.org/2000/svg";
function iconPath(state) {
switch (state) {
case "succeeded":
return "M5 12.5l4.5 4.5L19 7";
case "failed":
return "M6 6l12 12M18 6L6 18";
case "running":
return "M12 3a9 9 0 1 0 9 9";
case "canceled":
return "M12 3a9 9 0 1 0 0 18M7.5 7.5l9 9";
case "interrupted":
return "M9 6v12M15 6v12";
case "waiting":
case "queued":
return "M12 6v6l4 2";
default:
return "M12 8v8M8 12h8";
}
}
/** `state` is the run status token; `label` is the word a person reads. */
export function statusIcon(state, label = state) {
const tone = String(state ?? "").trim().toLowerCase() || "unknown";
const word = String(label ?? tone);
const span = h("span", {
class: `chip chip-${tone} status-icon status-${tone}`,
role: "img",
title: word,
"aria-label": word,
"data-status": tone,
});
const svg = document.createElementNS(NS, "svg");
svg.setAttribute("viewBox", "0 0 24 24");
svg.setAttribute("aria-hidden", "true");
svg.setAttribute("focusable", "false");
if (tone === "waiting" || tone === "queued") {
const circle = document.createElementNS(NS, "circle");
circle.setAttribute("cx", "12");
circle.setAttribute("cy", "12");
circle.setAttribute("r", "9");
circle.setAttribute("fill", "none");
circle.setAttribute("stroke", "currentColor");
circle.setAttribute("stroke-width", "1.8");
svg.append(circle);
}
const path = document.createElementNS(NS, "path");
path.setAttribute("d", iconPath(tone));
path.setAttribute("fill", "none");
path.setAttribute("stroke", "currentColor");
path.setAttribute("stroke-width", "2");
path.setAttribute("stroke-linecap", "round");
path.setAttribute("stroke-linejoin", "round");
svg.append(path);
span.append(svg);
return span;
}
+55 -64
View File
@@ -2491,15 +2491,14 @@ function renderChatToolCalls(turn, { streaming = false, elapsedMillis = () => 0
const running = streaming && toolsRunning(turn.parts);
const failed = parts.some((part) => toolFailed(part.state));
const long = running && parts.some((part) => toolRunning(part) && toolLongRunning(elapsedMillis(part)));
const turnKey = turn.key;
const wrap = h("div", { class: "chat-tools" });
const open = state.chatToolPanels.has(turnKey);
const chip = h("button", {
class: `chip chat-tool-chip${failed ? " chat-tool-chip-failed" : ""}`,
type: "button",
"aria-label": toolCallsAnnouncement(count),
"aria-expanded": String(open),
"aria-expanded": "false",
"aria-haspopup": "dialog",
});
if (running) {
chip.append(h("span", { class: "spinner chat-tool-spinner", "aria-hidden": "true" }));
@@ -2514,28 +2513,25 @@ function renderChatToolCalls(turn, { streaming = false, elapsedMillis = () => 0
}
chip.append(h("span", { class: "chat-tool-label", text: toolCallsLabel(count) }));
if (long) chip.append(h("span", { class: "chat-tool-long", text: "\u00b7 long" }));
const chevron = h("span", {
class: "chat-tool-chevron",
role: "img",
"aria-label": open ? "Hide tool calls" : "Show tool calls",
text: open ? "\u25b4" : "\u25be",
chip.append(
h("span", {
class: "chat-tool-chevron",
role: "img",
"aria-label": "Open tool calls",
text: "\u25b8",
}),
);
chip.addEventListener("click", (event) => {
event.stopPropagation();
openChatToolCalls(turn, parts, count);
});
chip.append(chevron);
wrap.append(chip);
return wrap;
}
const panel = h("div", { class: "chat-tool-panel", role: "dialog", "aria-label": toolCallsLabel(count) });
panel.hidden = !open;
const head = h("div", { class: "chat-tool-panel-head" });
head.append(h("span", { class: "chat-tool-panel-count", text: toolCallsLabel(count) }));
const close = h("button", {
class: "ghost chat-tool-close",
type: "button",
"aria-label": "Close tool calls",
title: "Close tool calls",
text: "\u00d7",
});
head.append(close);
panel.append(head);
/** The tool list body, shared by the modal: one expandable row per call. */
function renderChatToolPanelBody(turn, parts, count) {
const panel = h("div", { class: "chat-tool-panel" });
const list = h("div", { class: "chat-tool-list" });
for (const part of parts) {
const id = String(part?.id ?? "");
@@ -2553,50 +2549,45 @@ function renderChatToolCalls(turn, { streaming = false, elapsedMillis = () => 0
list.append(holder);
}
panel.append(list);
wrap.append(panel);
const setOpen = (next) => {
if (next) state.chatToolPanels.add(turnKey);
else state.chatToolPanels.delete(turnKey);
panel.hidden = !next;
chip.setAttribute("aria-expanded", String(next));
chevron.setAttribute("aria-label", next ? "Hide tool calls" : "Show tool calls");
chevron.textContent = next ? "\u25b4" : "\u25be";
if (next) positionChatToolPanel(panel, chip);
};
chip.addEventListener("click", (event) => {
event.stopPropagation();
setOpen(panel.hidden);
});
close.addEventListener("click", () => setOpen(false));
if (open) {
// The panel is built before its turn is attached to the document, so its
// rect is not measurable yet; place it on the next frame, when it is.
const place = () => positionChatToolPanel(panel, chip);
if (typeof requestAnimationFrame === "function") requestAnimationFrame(place);
else setTimeout(place, 0);
}
return wrap;
return panel;
}
/**
* Places the tool panel below its chip, or above it when there is no room, keeping
* it inside the viewport margins — the browser's port of
* `ToolPanelPositionProvider`. Resolved in px from the live rects, so it is
* independent of any layout guess.
*/
function positionChatToolPanel(panel, chip) {
const gap = 4;
const margin = 8;
const chipRect = chip.getBoundingClientRect();
const rect = panel.getBoundingClientRect();
let top = chipRect.bottom + gap;
if (top + rect.height > window.innerHeight - margin) top = chipRect.top - rect.height - gap;
top = Math.max(margin, Math.min(top, window.innerHeight - rect.height - margin));
const left = Math.max(margin, Math.min(chipRect.left, window.innerWidth - rect.width - margin));
panel.style.top = `${Math.round(top)}px`;
panel.style.left = `${Math.round(left)}px`;
/** Open one turn's tool calls in a modal, not an inline popover. */
function openChatToolCalls(turn, parts, count) {
const close = () => modal.close("chat-tools");
const overlay = h("div", {
class: "chat-tools-viewer",
role: "dialog",
"aria-modal": "true",
"aria-label": toolCallsLabel(count),
});
overlay.addEventListener("click", (event) => {
if (event.target === overlay) close();
});
const panel = h("div", { class: "chat-tools-modal-panel" });
panel.append(
h(
"div",
{ class: "chat-tool-panel-head" },
h("span", { class: "chat-tool-panel-count", text: toolCallsLabel(count) }),
h("button", {
class: "ghost chat-tool-close",
type: "button",
"aria-label": "Close tool calls",
title: "Close tool calls",
text: "\u00d7",
onclick: close,
}),
),
renderChatToolPanelBody(turn, parts, count),
);
overlay.append(panel);
modal.open("chat-tools", overlay, {
history: false,
onClose: close,
trigger: document.activeElement,
fallbackSelectors: ["#chatTranscript", "#detailTitle", "#pane-main"],
});
}
/**
+35 -2
View File
@@ -24,6 +24,7 @@ import {
versionRow,
} from "../pipelines.js";
import { PIPELINE_GRAPH_EMPTY, mount as mountGraph } from "../graph.js";
import { statusIcon } from "../statusIcon.js";
import { writeGraphExpanded } from "../graphPrefs.js";
export function createPipelinesView(rt) {
@@ -237,7 +238,12 @@ function fillPipelineRows(rowsEl) {
function renderPipelineRow(pipeline, latestRuns, runsKnown, now) {
const children = [
h("span", { class: "row-title", text: pipeline.name || `pipeline ${pipeline.id}` }),
h(
"span",
{ class: "pipeline-head" },
pipelineGlyph(),
h("span", { class: "row-title", text: pipeline.name || `pipeline ${pipeline.id}` }),
),
h("span", { class: "row-meta", text: pipelineSubtitle(pipeline) }),
];
const updated = pipelineUpdatedLine(pipeline);
@@ -252,7 +258,7 @@ function renderPipelineRow(pipeline, latestRuns, runsKnown, now) {
h(
"span",
{ class: "row-run" },
h("span", { class: `chip chip-${badge.state}`, text: badge.state }),
statusIcon(badge.state, badge.state.charAt(0).toUpperCase() + badge.state.slice(1)),
h("span", { class: "row-meta", text: runBadgeMetaLine(badge) }),
),
);
@@ -269,6 +275,33 @@ function renderPipelineRow(pipeline, latestRuns, runsKnown, now) {
);
}
/** A small flow glyph: the pipeline's own icon in lists and the collapsed strip. */
function pipelineGlyph() {
const ns = "http://www.w3.org/2000/svg";
const svg = document.createElementNS(ns, "svg");
svg.setAttribute("class", "pipeline-glyph");
svg.setAttribute("viewBox", "0 0 24 24");
svg.setAttribute("aria-hidden", "true");
svg.setAttribute("focusable", "false");
const path = document.createElementNS(ns, "path");
path.setAttribute("d", "M4 12h5V6h5M9 12v6h5");
path.setAttribute("fill", "none");
path.setAttribute("stroke", "currentColor");
path.setAttribute("stroke-width", "1.8");
path.setAttribute("stroke-linecap", "round");
path.setAttribute("stroke-linejoin", "round");
svg.append(path);
for (const [cx, cy] of [[3, 12], [19, 6], [19, 18]]) {
const dot = document.createElementNS(ns, "circle");
dot.setAttribute("cx", String(cx));
dot.setAttribute("cy", String(cy));
dot.setAttribute("r", "2");
dot.setAttribute("fill", "currentColor");
svg.append(dot);
}
return svg;
}
function renderPipelineDetail() {
const d = state.pipelineDetail;
const pane = h("div", { class: "detail" });
+2 -4
View File
@@ -3,6 +3,7 @@
// owns the DOM and the page's run-list state.
import { h } from "../dom.js";
import { statusIcon } from "../statusIcon.js";
import {
RUN_STATES,
RUN_TIME_RANGES,
@@ -55,9 +56,6 @@ function renderRunList(now = Date.now()) {
for (const entry of entries) {
switch (entry.kind) {
case "usage":
scroll.append(renderUsage(entry.usage));
break;
case "empty":
scroll.append(renderEmptyState(entry));
break;
@@ -125,7 +123,7 @@ function renderRunRow(run, now) {
});
const head = h("span", { class: "run-row-head" });
head.append(h("span", { class: `chip chip-${status}`, text: status }));
head.append(statusIcon(status, status.charAt(0).toUpperCase() + status.slice(1)));
if (run.executing) head.append(h("span", { class: "spinner", "aria-hidden": "true" }));
// The pipeline is the list's anchor: it names what ran, before the task title.
head.append(