swarm-ui: builds are a card under the job graph on the jobs tab
The builds tab is gone from the nav; its card sits below the jobs card on /jobs. The swarm-builder commit status now links to /jobs?run=<id>, and the old /builds address redirects there with its query so links already on PRs still open the build. Docs and the link test follow.
This commit is contained in:
parent
31670da795
commit
a2f000bab4
2 changed files with 64 additions and 21 deletions
|
|
@ -1,8 +1,10 @@
|
|||
// <BuildsPage> — the swarm builder's recent builds, newest first: which agent
|
||||
// <BuildsCard> — the swarm builder's recent builds, newest first: which agent
|
||||
// config PR heads it built, how each ended, and what `nix` printed when one
|
||||
// failed. One card per build; selecting a card opens it. Reads
|
||||
// `GET /api/builder/runs`. A `swarm-builder` commit status links here as
|
||||
// `/builds?run=<id>`, which opens that build's card and scrolls to it.
|
||||
// `GET /api/builder/runs`. A `swarm-builder` commit status links to the jobs
|
||||
// page as `/jobs?run=<id>`, which opens that build's card and scrolls to it.
|
||||
// The card sits under the job graph on that page; the old `/builds` address
|
||||
// redirects there with its query.
|
||||
import { useEffect, useRef, useState } from "preact/hooks";
|
||||
import { useSearch } from "wouter-preact";
|
||||
import { ApiErrorPanel } from "@hive/shared/api-error-panel.js";
|
||||
|
|
@ -91,7 +93,7 @@ function BuildCard({
|
|||
);
|
||||
}
|
||||
|
||||
export function BuildsPage() {
|
||||
export function BuildsCard() {
|
||||
const wanted = wantedRun(useSearch());
|
||||
const [intervalMs, setIntervalMs] =
|
||||
useState<RefreshIntervalMs>(DEFAULT_INTERVAL_MS);
|
||||
|
|
|
|||
|
|
@ -37,6 +37,11 @@ export const OUTCOME_TONE: Record<BuildOutcome, BadgeTone> = {
|
|||
error: "warning",
|
||||
};
|
||||
|
||||
/** Where an old `/builds` link goes: the jobs page, keeping its query. */
|
||||
export function jobsHref(search: string): string {
|
||||
return search === "" ? "/jobs" : `/jobs?${search}`;
|
||||
}
|
||||
|
||||
/** The run a `?run=<id>` query names, or `null` when it names none. */
|
||||
export function wantedRun(search: string): string | null {
|
||||
const id = new URLSearchParams(search).get("run");
|
||||
|
|
|
|||
Loading…
Reference in a new issue