Watch
0
0
Fork
You've already forked hyperhive
0

swarm ui: show agent freshness and failures where the operator looks, page titles, try again, and stale-data notes

An agent card shows its freshness (stale with the last report's age, never reported, not in swarm identity) when it is not fresh, so the status filter has a visible reason. A failed state change shows its reason in a panel under the card, and a failed cancel shows its reason in the badge, instead of a hover title. Pages can set their title (usePageTitle) and the flow editor does, so several editor tabs differ; the 404 links home. The claude login dialog offers try again after a failure, announces its wait, and has a per-agent field id. The create-agent tabs go forward again as far as the operator has been, but not past a step that is invalid now (lastReachableStep, tested), and the disabled next and create buttons say why in a hint they are described by. usePolled reports when the last live answer arrived, and StaleNote says how old a list is under a failed refresh, or that it is the answer saved from the last visit, on the alerts, builds, review runs, hives, schedules and flows lists.
This commit is contained in:
iris 2026-11-19 18:59:20 +01:00 • committed by mara
commit 679d2ee420

View file

@ -72,6 +72,7 @@ import {
} from "./CreateAgentAgentsMd.js";
import {
NAME_PATTERN,
lastReachableStep,
nextStep,
previousStep,
STEP_TITLES,
@ -285,6 +286,32 @@ export function CreateAgentForm({
});
const done = result.status === "done";
const at = STEPS.indexOf(step);
// The tabs go forward again as far as the operator has been, as long as the
// steps before are still valid.
const [reached, setReached] = useState(0);
useEffect(() => {
setReached((r) => Math.max(r, at));
}, [at]);
const firstBad = STEPS.findIndex(
(s) =>
stepProblem(s, {
name,
hive,
permissionsReady: catalogue !== null,
inferenceProblem,
}) !== null,
);
const lastTab = lastReachableStep(reached, firstBad, at);
// Why the primary button is off, said in words.
const createProblem =
step === "summary" && result.status !== "submitting"
? !hivesReady
? "the hive list has not loaded"
: !catalogue
? "the permission list has not loaded"
: null
: null;
const shownProblem = problem ?? createProblem;
// Enter goes on to the next step, and creates only from the summary.
function onSubmit(e: Event) {
@ -314,7 +341,7 @@ export function CreateAgentForm({
type="button"
class={`create-agent-step-tab${s === step ? " create-agent-step-current" : ""}`}
aria-current={s === step ? "step" : undefined}
disabled={i > at || done}
disabled={i > lastTab || done}
onClick={() => setStep(s)}
>
{i + 1}. {STEP_TITLES[s]}
@ -555,9 +582,14 @@ export function CreateAgentForm({
>
back
</Button>
{problem !== null && (step !== "identity" || name !== "") && (
<Hint as="span" role="status" class="create-agent-hint">
{problem}
{shownProblem !== null && (
<Hint
as="span"
role="status"
class="create-agent-hint"
id="create-agent-hint"
>
{shownProblem}
</Hint>
)}
{step === "summary" ? (
@ -567,6 +599,9 @@ export function CreateAgentForm({
disabled={
result.status === "submitting" || !hivesReady || !catalogue
}
describedBy={
createProblem !== null ? "create-agent-hint" : undefined
}
>
{result.status === "submitting" ? "creating…" : "create"}
</Button>
@ -575,6 +610,9 @@ export function CreateAgentForm({
variant="primary"
type="submit"
disabled={problem !== null}
describedBy={
problem !== null ? "create-agent-hint" : undefined
}
>
next
</Button>