3314f8405b
- 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.
63 lines
2.0 KiB
JavaScript
63 lines
2.0 KiB
JavaScript
// 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;
|
|
}
|