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:
+55
-64
@@ -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"],
|
||||
});
|
||||
}
|
||||
|
||||
/**
|
||||
|
||||
@@ -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" });
|
||||
|
||||
@@ -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(
|
||||
|
||||
Reference in New Issue
Block a user