diff --git a/packages/delivery/README.md b/packages/delivery/README.md index f16f4ebfa4e..f2635f763d2 100644 --- a/packages/delivery/README.md +++ b/packages/delivery/README.md @@ -216,14 +216,14 @@ beside a "Clear filters" link. Every list page keeps one live result line, and "Older" and "Newest" move focus to the top of the list. A route that fails to load, or names nothing, renders inside the app's layout and takes focus; a request the server refused offers a way out instead of "Try again". -Every confirmation asks through one native `` that the root layout -mounts (`ConfirmDialogProvider`): a `ConfirmButton` renders its own question -into that dialog while it is open, so a page with forty confirm buttons has one -dialog element. The dialog returns focus to its button. While the confirmed +Every confirmation asks in console-ui's modal `Dialog`: a `ConfirmButton` owns +its question and renders it only while it is open, so a page with forty confirm +buttons holds no dialog until one asks. "Keep as is" takes focus first, Escape +cancels, and the dialog returns focus to its button. While the confirmed action is in flight the button is `aria-disabled` rather than disabled, because a disabled element cannot hold focus; a focused button that leaves the page -hands its focus to the page heading. The server returns `index.html` for every -non-API path. +hands its focus to the page heading, and an open question leaves with it. The +server returns `index.html` for every non-API path. The environment page leads with its state, then the actions: a summary line (the accepted revision, the approval policy and the deployment in flight), @@ -297,14 +297,16 @@ pointer). List tables stack below `720px`, and the overview tightens further at Pages share these components from `src/client/components/`: -| Component | Renders | -| ------------ | ----------------------------------------------------------------------- | -| `Status` | A state as glyph, words and color; `label` gives a page its own words | -| `Facts` | A definition list of labelled values, one `Fact` each | -| `Disclosure` | A native `
` with an optional count | -| `Identifier` | A UUID or digest in a short form, its full value in `title` and text | -| `Revision` | A set revision as its r-number (`r274`); `revisionLabel` gives the text | -| `Receipt` | An evidence summary or step message: prose, or a JSON receipt as facts | +| Component | Renders | +| ---------------------------------- | ---------------------------------------------------------------------------------- | +| `Status` | A Delivery state as console-ui's `StatusGlyph`; `label` gives a page its own words | +| `Facts` | Labelled values as console-ui's `DescriptionList`, one `Fact` each | +| `Disclosure` | console-ui's `Disclosure`, run across a panel's padding where it sits in one | +| `Notice` | Page news as console-ui's `Banner`, with a tone, an id and a `bleed` | +| `Elapsed`, `Deadline`, `ClockTime` | Delivery's wording over console-ui's `Duration`, `ExactTime` and `RelativeTime` | +| `Identifier` | A UUID or digest in a short form, its full value in `title` and text | +| `Revision` | A set revision as its r-number (`r274`); `revisionLabel` gives the text | +| `Receipt` | An evidence summary or step message: prose, or a JSON receipt as facts | `GET /api/v1/deployments` returns each deployment with `versionSetRevision`, the number of the set revision it deploys, read for the whole page in one @@ -363,10 +365,10 @@ actor folds into one counted entry. Folding is presentational and per fetched page: the route still pages by audit row, so a run that crosses a page boundary reads as one entry on each page. -Every moment the app states in absolute terms uses one format -(`exactTime` in `src/client/components/time.tsx`): the reader's local date and -a 24-hour clock, to the minute, or to the second where nearby moments are -ordered. A relative time keeps that exact moment in its title. Wherever a +Every moment the app states uses console-ui's one format: a relative time +("3m ago") keeps its exact moment in its title, and an absolute time reads in +Pacific time on a 24-hour clock ("Nov 26, 14:02 PT"), to the minute or to the +second where nearby moments are ordered. Wherever a person reads a release, it is its set revision number (`r274`); a set revision the page has not loaded shows the short form of its id. A service or environment is named as the overview names it, with its id as the title; the diff --git a/packages/delivery/e2e/activity-environment.spec.ts b/packages/delivery/e2e/activity-environment.spec.ts index 845f6b06016..ebb3fbdfb13 100644 --- a/packages/delivery/e2e/activity-environment.spec.ts +++ b/packages/delivery/e2e/activity-environment.spec.ts @@ -1,5 +1,5 @@ import { expect, test } from "@playwright/test"; -import { expectNoHorizontalOverflow } from "./helpers.ts"; +import { activityRows, expectNoHorizontalOverflow } from "./helpers.ts"; /** The instant `minutes` before nine o'clock on the fixture day. */ const at = (minutes: number) => @@ -53,9 +53,9 @@ test("one deployment's steps read as one activity row, each step once, however o route.fulfill({ json: { items, nextCursor: null } }), ); await page.goto("/activity"); - const rows = page.locator("ol.activity > li"); + const rows = activityRows(page); await expect(rows).toHaveCount(2); - const steps = rows.first().locator("ol.activity-stages > li"); + const steps = rows.first().locator('[data-part="stages"] > li'); await expect(steps).toHaveCount(1); await expect(steps.first()).toContainText("worker-image-provenance"); await expect(steps.first()).toContainText("succeeded"); @@ -130,7 +130,7 @@ test("repeated check-ins and worker retirements fold into counted rows that name route.fulfill({ json: { items, nextCursor: null } }), ); await page.goto("/activity"); - const rows = page.locator("ol.activity > li"); + const rows = activityRows(page); await expect(rows).toHaveCount(5); // The proof recorded for one retirement deployment is one row too. @@ -156,7 +156,9 @@ test("repeated check-ins and worker retirements fold into counted rows that name await expect(retirements).toContainText("r338"); await expect(retirements).toContainText("from "); await retirements.getByText("3 requests").click(); - await expect(retirements.locator(".activity-repeated > li")).toHaveCount(3); + await expect(retirements.locator('[data-part="repeated"] > li')).toHaveCount( + 3, + ); const failed = rows.filter({ hasText: "Worker recovery failed" }); await expect(failed.first()).toContainText( diff --git a/packages/delivery/e2e/attention.model.spec.ts b/packages/delivery/e2e/attention.model.spec.ts index 96f37a41d72..20ca34699e9 100644 --- a/packages/delivery/e2e/attention.model.spec.ts +++ b/packages/delivery/e2e/attention.model.spec.ts @@ -1,17 +1,14 @@ -import { expect, test, type Page } from "@playwright/test"; -import { expectNoHorizontalOverflow, openOverview } from "./helpers.ts"; +import { expect, test } from "@playwright/test"; +import { + expectNoHorizontalOverflow, + openOverview, + overviewRow as serviceRow, +} from "./helpers.ts"; // Served by e2e/model-server.ts: Arcade prod's accepted release has a firing // critical alarm under a hold policy, and Cloudflare's tofu stack has a saved // plan waiting for a decision. -function tile(page: Page, title: string) { - return page - .getByRole("main") - .getByRole("listitem") - .filter({ has: page.getByRole("link", { name: title, exact: true }) }); -} - test("an alarm on an accepted release needs attention and marks its chip", async ({ page, }) => { @@ -26,7 +23,7 @@ test("an alarm on an accepted release needs attention and marks its chip", async await expect( alarm.getByRole("link", { name: "Arcade prod monitor alarm" }), ).toHaveAttribute("href", "/environments/arcade/prod"); - const prod = tile(page, "Arcade").getByRole("link", { name: /^prod / }); + const prod = serviceRow(page, "Arcade").getByRole("link", { name: /^prod / }); await expect(prod).toContainText("alarm firing"); await expectNoHorizontalOverflow(page); }); @@ -40,7 +37,7 @@ test("a saved plan waiting for a decision is awaiting approval, not running", as name: "OpenTofu cloudflare stack prod awaits plan approval", }), ).toBeVisible(); - const chip = tile(page, "OpenTofu cloudflare stack").getByRole("link", { + const chip = serviceRow(page, "OpenTofu cloudflare stack").getByRole("link", { name: /^prod /u, }); await expect(chip).toContainText("awaiting approval"); diff --git a/packages/delivery/e2e/commits.spec.ts b/packages/delivery/e2e/commits.spec.ts index 70ec3cdd7d6..8e880ae57d5 100644 --- a/packages/delivery/e2e/commits.spec.ts +++ b/packages/delivery/e2e/commits.spec.ts @@ -1,5 +1,5 @@ import { expect, test, type Page } from "@playwright/test"; -import { expectNoHorizontalOverflow } from "./helpers.ts"; +import { expectNoHorizontalOverflow, statusIn } from "./helpers.ts"; import { ACCEPTED_POSITION, CARRIED_FAILURE_POSITION, @@ -47,9 +47,7 @@ test("a commit says deploying only once a deployment that carries it is claimed, // released", since a release of it exists. const unreleased = await openCommit(page, UNRELEASED_POSITION); const header = unreleased.locator("[data-page-header]"); - await expect(header.locator(".status").first()).toHaveText( - /Needs manual release/u, - ); + await expect(statusIn(header).first()).toHaveText(/Needs manual release/u); await expect(header).not.toContainText("Not released"); await expect(header).not.toContainText("Deploying"); await expect(header).toContainText( @@ -86,7 +84,7 @@ test("the list row names the environment that is blocking it", async ({ page, }) => { const unreleased = await findRow(page, UNRELEASED_POSITION); - await expect(unreleased.locator(".status").first()).toHaveText( + await expect(statusIn(unreleased).first()).toHaveText( /Needs manual release/u, ); await expect(unreleased).toContainText("Birmel / prod: needs manual release"); @@ -147,9 +145,7 @@ test("a commit whose whole pipeline failed stands where the next passing commit' const header = main.locator("[data-page-header]"); // Its change ships in the carrier's Birmel release, which waits on a // manual release: never "not released" while that release carries it. - await expect(header.locator(".status").first()).toHaveText( - /Needs manual release/u, - ); + await expect(statusIn(header).first()).toHaveText(/Needs manual release/u); await expect(header).toContainText( `The changed service needs a manual release: Birmel prod. Not built on its own; included in ${carrier} (whose build of CI (Woodpecker) passed).`, ); @@ -176,9 +172,7 @@ test("a commit whose whole pipeline failed stands where the next passing commit' // The list row says the same thing in the same words. const row = await findRow(page, PIPELINE_FAILURE_POSITION); - await expect(row.locator(".status").first()).toHaveText( - /Needs manual release/u, - ); + await expect(statusIn(row).first()).toHaveText(/Needs manual release/u); await expect(row).toContainText( `Not built on its own; included in ${carrier} (whose build of CI (Woodpecker) passed)`, ); @@ -190,8 +184,8 @@ test("a commit whose whole pipeline failed stands where the next passing commit' async function findRow(page: Page, position: number) { await page.goto("/commits"); const recent = page.getByRole("region", { name: "Recent commits" }); - await expect(recent.getByRole("listitem").first()).toBeVisible(); - const row = recent.getByRole("listitem").filter({ + await expect(recent.locator("tbody tr").first()).toBeVisible(); + const row = recent.locator("tbody tr").filter({ has: page.getByRole("link", { name: new RegExp(`^${historySha(position).slice(0, 7)}`, "u"), }), @@ -199,7 +193,7 @@ async function findRow(page: Page, position: number) { const older = recent .getByRole("navigation", { name: "Pages" }) .getByRole("link", { name: "Older" }); - const first = recent.getByRole("listitem").first(); + const first = recent.locator("tbody tr").first(); while ((await row.count()) === 0 && (await older.count()) > 0) { const url = page.url(); const shown = await first.textContent(); @@ -266,7 +260,7 @@ test("a commit whose failed CI a newer passing commit includes says where its ch // later release, the accepted one, is what carries the change to prod. const release = historySha(ACCEPTED_POSITION).slice(0, 7); const row = await findRow(page, FAILED_POSITION); - await expect(row.locator(".status").first()).toHaveText(/Deployed/u); + await expect(statusIn(row).first()).toHaveText(/Deployed/u); await expect(row).toContainText( `Not built on its own; included in ${carrier} (whose build of Birmel passed)`, ); @@ -305,9 +299,7 @@ test("a carried CI failure does not outrank what actually blocks the commit", as const carrier = historySha(CARRIER_POSITION).slice(0, 7); const main = await openCommit(page, CARRIED_FAILURE_POSITION); const header = main.locator("[data-page-header]"); - await expect(header.locator(".status").first()).toHaveText( - /Needs manual release/u, - ); + await expect(statusIn(header).first()).toHaveText(/Needs manual release/u); // The real blocker leads; the carried failure follows. await expect(header).toContainText( `The changed service needs a manual release: Birmel prod. Built on its own for 2 services (1 changed); 1 service (Golink) was built by a later commit: included in ${carrier} (whose build of Golink passed).`, @@ -325,9 +317,7 @@ test("a carried CI failure does not outrank what actually blocks the commit", as const service = page.getByRole("region", { name: /^By service/u }); await expect(service).not.toContainText("Golink"); const row = await findRow(page, CARRIED_FAILURE_POSITION); - await expect(row.locator(".status").first()).toHaveText( - /Needs manual release/u, - ); + await expect(statusIn(row).first()).toHaveText(/Needs manual release/u); await expect(row).toContainText("Birmel / prod: needs manual release"); // Only Golink went through the carrier; the row says what the commit built itself. await expect(row).toContainText( @@ -341,24 +331,19 @@ test("the commit list lines its columns up and explains each environment tally", }) => { await page.goto("/commits"); const recent = page.getByRole("region", { name: "Recent commits" }); - await expect(recent.getByRole("listitem").first()).toBeVisible(); - const lefts = (selector: string) => + await expect(recent.locator("tbody tr").first()).toBeVisible(); + const lefts = (column: number) => recent - .locator(`.commit-row > ${selector}`) + .locator(`tbody tr > :nth-child(${String(column)})`) .evaluateAll((nodes) => nodes.map((node) => Math.round(node.getBoundingClientRect().left)), ); const rights = await recent - .locator(".commit-row > .commit-meta") + .locator("tbody tr > :nth-child(4)") .evaluateAll((nodes) => nodes.map((node) => Math.round(node.getBoundingClientRect().right)), ); - for (const column of [ - await lefts(".status"), - await lefts(".commit-subject"), - await lefts(".commit-detail"), - rights, - ]) + for (const column of [await lefts(1), await lefts(2), await lefts(3), rights]) expect(new Set(column).size).toBe(1); const accepted = await findRow(page, ACCEPTED_POSITION); diff --git a/packages/delivery/e2e/delivery.spec.ts b/packages/delivery/e2e/delivery.spec.ts index af4435f057b..c1ca9b8dbca 100644 --- a/packages/delivery/e2e/delivery.spec.ts +++ b/packages/delivery/e2e/delivery.spec.ts @@ -78,7 +78,7 @@ test("select an immutable release, inspect queued execution, and cancel safely", await expect(main.locator("[data-page-header]")).toContainText( "Nothing accepted yet · Deploys automatically · generation 0 · Nothing in flight", ); - await expect(main.locator(".environment-notice")).toHaveCount(0); + await expect(main.locator('[data-notice="environment"]')).toHaveCount(0); await expect(main.getByRole("region").first()).toHaveAccessibleName( "Release state", ); @@ -96,6 +96,10 @@ test("select an immutable release, inspect queued execution, and cancel safely", .click(); await expect(main.getByText("queued", { exact: true })).toBeVisible(); await expect(main).toContainText("No verification evidence recorded"); + // The summary line keeps a space between its status, kind, release and requester. + await expect(main.locator("[data-page-header]")).toContainText( + /queued deploy .+ requested by \S+/u, + ); await main.getByRole("button", { name: "Request cancellation" }).click(); await confirm(page, "Request cancellation"); await expect(main.getByText("canceled", { exact: true })).toBeVisible(); diff --git a/packages/delivery/e2e/deployment-outcome.model.spec.ts b/packages/delivery/e2e/deployment-outcome.model.spec.ts index f1bc8435ac1..0460b8c91be 100644 --- a/packages/delivery/e2e/deployment-outcome.model.spec.ts +++ b/packages/delivery/e2e/deployment-outcome.model.spec.ts @@ -1,6 +1,6 @@ import { expect, test, type Page } from "@playwright/test"; import { DeploymentPageSchema } from "#shared/hub/hub-contract.ts"; -import { api, expectNoHorizontalOverflow } from "./helpers.ts"; +import { api, expectNoHorizontalOverflow, statusIn } from "./helpers.ts"; // Served by e2e/model-server.ts: Arcade beta's deploy ended recovery-required // while its sync step was still running, and the Cloudflare stack's saved @@ -30,7 +30,7 @@ test("a failed deployment says why at the top and what the operator can do", asy // Only the status is live; the relative time beside it is not. const headerStatus = main.locator("[data-page-header]").getByRole("status"); await expect(headerStatus).toHaveText("failed"); - await expect(headerStatus.locator("svg.status-glyph")).toBeVisible(); + await expect(headerStatus.locator("[data-sev] > svg")).toBeVisible(); const why = main.getByRole("region", { name: "Why it failed" }); await expect(why).toContainText( "The sync outlived the executor; its result is unknown", @@ -92,7 +92,7 @@ test("a step its deployment outlived reads as interrupted, on the page and on th .filter({ hasText: "step-sync" }) .first(); await expect(sync).toContainText("interrupted · outcome unknown"); - await expect(steps.locator(".status-running")).toHaveCount(0); + await expect(statusIn(steps).filter({ hasText: "running" })).toHaveCount(0); // Its clock stopped when the deployment ended, so it reads the same later. const head = sync.locator(".step-head"); const before = await head.textContent(); @@ -105,7 +105,7 @@ test("a step its deployment outlived reads as interrupted, on the page and on th .getByRole("region", { name: "beta" }); const action = beta.getByRole("listitem").filter({ hasText: "step-sync" }); await expect(action).toContainText("interrupted · outcome unknown"); - await expect(action.locator(".status-running")).toHaveCount(0); + await expect(statusIn(action).filter({ hasText: "running" })).toHaveCount(0); }); test("a plan rejection checks its reason before asking, and keeps it after a refusal", async ({ diff --git a/packages/delivery/e2e/environment-actions.model.spec.ts b/packages/delivery/e2e/environment-actions.model.spec.ts index 1dd561c09ef..4e0a01be5d7 100644 --- a/packages/delivery/e2e/environment-actions.model.spec.ts +++ b/packages/delivery/e2e/environment-actions.model.spec.ts @@ -54,8 +54,8 @@ test("a locked environment says recovery is required and refuses every request", const header = main.locator("[data-page-header]"); await expect(header).toContainText("Recovery required"); await expect(header).not.toContainText("In flight"); - const notice = main.locator(".environment-notice"); - await expect(notice).toHaveClass(/notice error/u); + const notice = main.locator('[data-notice="environment"]'); + await expect(notice.locator('[data-sev="error"]').first()).toBeVisible(); await expect(notice).toContainText("failed and this environment is locked."); await expect(notice).toContainText( "A change may still be running outside Delivery.", @@ -94,16 +94,20 @@ test("a deployment awaiting approval disables every request with a reason that l /is awaiting approval\. Requests, rebinds and rollbacks are refused until it finishes or is canceled\./u, ); // The page says it once, and links the deployment in the way there. - await expect(main.locator(".notice", { hasText: "refused" })).toHaveCount(1); await expect( - main.locator(".environment-notice").getByRole("link", { name: waiting }), + main.locator("[data-notice]", { hasText: "refused" }), + ).toHaveCount(1); + await expect( + main + .locator('[data-notice="environment"]') + .getByRole("link", { name: waiting }), ).toHaveAttribute("href", `/deployments/${waiting}`); const rollback = main.getByRole("region", { name: "Rollback candidates" }); for (const button of await rollback .getByRole("button", { name: ROLLBACK_BUTTONS }) .all()) await expect(button).toBeDisabled(); - await expect(rollback.locator(".notice")).toHaveCount(0); + await expect(rollback.locator("[data-notice]")).toHaveCount(0); await expect( main .getByRole("region", { name: "Selection", exact: true }) @@ -173,7 +177,7 @@ test("a saved plan waiting for its decision reads as awaiting plan approval", as const header = main.locator("[data-page-header]"); await expect(header).toContainText(/In flight: \S.* awaiting plan approval/u); await expect(header).not.toContainText("running"); - await expect(main.locator(".environment-notice")).toContainText( + await expect(main.locator('[data-notice="environment"]')).toContainText( "is awaiting plan approval.", ); }); diff --git a/packages/delivery/e2e/evidence.model.spec.ts b/packages/delivery/e2e/evidence.model.spec.ts index d2d220fbbf3..e212577f6b7 100644 --- a/packages/delivery/e2e/evidence.model.spec.ts +++ b/packages/delivery/e2e/evidence.model.spec.ts @@ -3,6 +3,7 @@ import { z } from "zod"; import { DeploymentPageSchema } from "#shared/hub/hub-contract.ts"; import { EnvironmentSelectionSchema } from "#shared/model/route-contract.ts"; import { + activityRows, api, expectAccessible, expectNoHorizontalOverflow, @@ -70,14 +71,14 @@ test("a settled step folds its evidence, which opens as labelled facts under tha ["Application", "arcade"], ["Resources", "synced 12 · pruned 0"], ] as const) { - const fact = receipt.locator("dl.facts > div").filter({ + const fact = receipt.locator("dl > div").filter({ has: page.getByText(label, { exact: true }), }); await expect(fact.locator("dd")).toHaveText(value); } // A long id is short on screen and whole to a screen reader. await expect( - receipt.locator("dl.facts > div", { hasText: "Revision" }).locator("abbr"), + receipt.locator("dl > div", { hasText: "Revision" }).locator("abbr"), ).toHaveAttribute("title", "a".repeat(40)); // A nested value stays formatted JSON behind its own disclosure. const nested = receipt.getByText('"phase": "Succeeded"'); @@ -108,7 +109,7 @@ test("evidence no step recorded is grouped by what recorded it", async ({ ).toBeVisible(); // The alarm's receipt names its alert as a fact. await expect( - evidence.locator("dl.facts > div", { hasText: "Alertname" }).locator("dd"), + evidence.locator("dl > div", { hasText: "Alertname" }).locator("dd"), ).toHaveText("ArcadeErrorBudgetBurn"); await expect(evidence).toContainText( "3 more are shown under the steps that recorded them.", @@ -124,10 +125,10 @@ test("a step that has not settled shows its evidence without being asked", async await expect(sync).toContainText("running"); await expect(sync.locator(":scope > details")).toHaveAttribute("open"); await expect( - sync.locator("dl.facts > div", { hasText: "Phase" }).locator("dd"), + sync.locator("dl > div", { hasText: "Phase" }).locator("dd"), ).toBeVisible(); await expect( - sync.locator("dl.facts > div", { hasText: "Phase" }).locator("dd"), + sync.locator("dl > div", { hasText: "Phase" }).locator("dd"), ).toHaveText("Running"); await expectNoHorizontalOverflow(page); }); @@ -152,9 +153,9 @@ test("the activity trail names each stage and folds a deployment's stage run int }) => { const id = await accepted(page); await page.goto(`/activity?entity=${id}&action=deployment.stage`); - const entries = page.locator("ol.activity > li"); + const entries = activityRows(page); await expect(entries).toHaveCount(1); - const stages = entries.locator("ol.activity-stages > li"); + const stages = entries.locator('[data-part="stages"] > li'); await expect(stages).toHaveText([ /step-readback.*succeeded/u, /step-sync.*succeeded/u, @@ -164,7 +165,9 @@ test("the activity trail names each stage and folds a deployment's stage run int await page.goto(`/activity?entity=${id}`); // Each action reads in plain words; its recorded code stays in the title. const action = (code: string) => - entries.filter({ has: page.locator(`.activity-action[title="${code}"]`) }); + entries.filter({ + has: page.locator(`td[data-label="Action"] > span[title="${code}"]`), + }); await expect(action("deployment.stage")).toHaveCount(1); await expect(action("deployment.stage")).toContainText("Deployment steps"); await expect(action("deployment.approve")).toContainText("granted"); diff --git a/packages/delivery/e2e/helpers.ts b/packages/delivery/e2e/helpers.ts index 28e0717f58c..24fcad931b1 100644 --- a/packages/delivery/e2e/helpers.ts +++ b/packages/delivery/e2e/helpers.ts @@ -37,12 +37,12 @@ export async function openDeployment( } /** - * Accept the open native confirmation dialog. Every confirm button asks - * through the page's one dialog element, so the open one is the only one. + * Accept the open confirmation dialog. A confirm button renders its dialog + * only while it asks, so the open one is the only one. */ export async function confirm(page: Page, label: string) { - await expect(page.locator("dialog")).toHaveCount(1); const dialog = page.getByRole("dialog"); + await expect(dialog).toHaveCount(1); await expect(dialog).toBeVisible(); await dialog.getByRole("button", { name: label, exact: true }).click(); await expect(dialog).toBeHidden(); @@ -131,6 +131,25 @@ export async function expectAccessible(page: Page, path: string) { * a disclosure expanded or a dialog open; `path` names the state in a failure. */ export async function expectNoViolations(page: Page, path: string) { + // A dialog still opening is partly transparent, which axe reads as low contrast. + // Its transition starts a frame after it mounts, so let that frame pass first. + await page.evaluate( + () => + new Promise((resolve) => { + globalThis.requestAnimationFrame(() => { + globalThis.requestAnimationFrame(resolve); + }); + }), + ); + await page + .getByRole("dialog") + .evaluateAll((dialogs) => + Promise.all( + dialogs.flatMap((dialog) => + dialog.getAnimations().map((animation) => animation.finished), + ), + ), + ); const results = await new AxeBuilder({ page }) .withTags(["wcag2a", "wcag2aa", "wcag21a", "wcag21aa", "wcag22aa"]) .analyze(); @@ -145,10 +164,10 @@ export async function expectNoViolations(page: Page, path: string) { /** * Open every collapsed disclosure, then require that nothing inside any - * overview tile reaches past the tile's right edge: a long status pill wraps - * in its chip instead of spilling out of the card. + * overview service row reaches past the row's right edge: a long status + * wraps in its environment link instead of spilling out of the table. */ -export async function expectContainedInTiles(page: Page) { +export async function expectContainedInRows(page: Page) { await page.evaluate(() => { for (const details of globalThis.document.querySelectorAll( "main details", @@ -157,15 +176,15 @@ export async function expectContainedInTiles(page: Page) { }); const escapes = await page.evaluate(() => { const found: string[] = []; - for (const tile of globalThis.document.querySelectorAll(".overview-tile")) { - if (!tile.checkVisibility()) continue; - const edge = tile.getBoundingClientRect().right; - for (const element of tile.querySelectorAll("*")) { + for (const row of globalThis.document.querySelectorAll("main tbody tr")) { + if (!row.checkVisibility()) continue; + const edge = row.getBoundingClientRect().right; + for (const element of row.querySelectorAll("*")) { const box = element.getBoundingClientRect(); // The words a glyph already says are clipped to one pixel, by design. if (box.width > 1 && box.right > edge + 0.5) found.push( - `${tile.querySelector("a")?.textContent ?? "tile"}: ${element.textContent}`, + `${row.querySelector("a")?.textContent ?? "row"}: ${element.textContent}`, ); } } @@ -229,15 +248,17 @@ export async function expectApprovalsNavCount(page: Page, count: number) { * nothing scrolling sideways, and every short id on one line. */ export async function expectStackedTable(region: Locator) { - const table = region.locator(".stack-table").first(); - await expect(table.locator("thead")).toBeHidden(); + const table = region.locator("table[data-stack]").first(); + // The header row is clipped to a pixel: it stays for screen readers only. + const head = await table.locator("thead").boundingBox(); + expect(head?.width ?? 0).toBeLessThanOrEqual(1); await expect( table.locator("tbody tr").first().locator("td[data-label='Requested']"), ).toBeVisible(); expect( - await table.evaluate( - (element) => element.scrollWidth <= element.clientWidth, - ), + await table + .locator("xpath=..") + .evaluate((element) => element.scrollWidth <= element.clientWidth), ).toBe(true); for (const id of await table.locator(".identifier").all()) { const box = await id.boundingBox(); @@ -301,10 +322,28 @@ export async function expectPagesAgreeOnAttention(page: Page) { expect(leads[1]).toEqual(leads[0]); } -/** The Overview tile of one service: the list item holding the link to its pipeline. */ -export function overviewTile(page: Page, title: string) { +/** The Overview row of one service: the table row holding the link to its pipeline. */ +export function overviewRow(page: Page, title: string) { return page .getByRole("main") - .getByRole("listitem") + .getByRole("row") .filter({ has: page.getByRole("link", { name: title, exact: true }) }); } + +/** The rows of the activity table: one per entry or folded run. */ +export function activityRows(page: Page) { + return page.getByRole("table", { name: "Activity" }).locator("tbody > tr"); +} + +/** + * The status glyphs inside `scope`: the spans that carry a severity beside + * their glyph, in `severity` only when one is named. + */ +export function statusIn( + scope: Locator | Page, + severity?: "ok" | "info" | "warning" | "error" | "unknown", +) { + return scope.locator( + `span${severity === undefined ? "[data-sev]" : `[data-sev="${severity}"]`}:has(> svg)`, + ); +} diff --git a/packages/delivery/e2e/lists.model.spec.ts b/packages/delivery/e2e/lists.model.spec.ts index 947bcee58fd..37588841905 100644 --- a/packages/delivery/e2e/lists.model.spec.ts +++ b/packages/delivery/e2e/lists.model.spec.ts @@ -3,6 +3,7 @@ import { expectNoHorizontalOverflow, expectStackedTable, isPhone, + statusIn, } from "./helpers.ts"; // Served by e2e/model-server.ts, whose Arcade prod override and Cloudflare @@ -13,9 +14,9 @@ test("approvals put the waiting decisions first, named by service, environment a }) => { await page.goto("/approvals"); const waiting = page.getByRole("region", { - name: /^Waiting for a decision \(2\)$/u, + name: /^Waiting for a decision$/u, }); - await expect(waiting).toHaveClass(/panel-waiting/u); + await expect(waiting.locator("tbody tr")).toHaveCount(2); const row = waiting.locator("tbody tr").filter({ hasText: "Override" }); await expect( row.getByRole("link", { @@ -39,7 +40,7 @@ test("an undecided approval reads awaiting approval and its release wraps with t }); // Both the override waiting on its approval and the saved plan waiting on its // decision are "awaiting approval", as the other pages say. - const states = waiting.locator("td[data-label='Approval'] .status"); + const states = statusIn(waiting.locator("td[data-label='Approval']")); await expect(states).toHaveCount(2); for (const state of await states.all()) await expect(state).toHaveText(/awaiting approval$/u); diff --git a/packages/delivery/e2e/lists.spec.ts b/packages/delivery/e2e/lists.spec.ts index 64e0c7ced9f..3390c5042ac 100644 --- a/packages/delivery/e2e/lists.spec.ts +++ b/packages/delivery/e2e/lists.spec.ts @@ -1,8 +1,10 @@ import { expect, test, type Page } from "@playwright/test"; import { + activityRows, expectNoHorizontalOverflow, expectStackedTable, isPhone, + statusIn, usesNavDrawer, } from "./helpers.ts"; @@ -144,7 +146,7 @@ for (const { path, noun, values, filter } of [ ); // No rows and no paging from a filter that could not be read. await expect(main.getByRole("table")).toHaveCount(0); - await expect(main.locator("ol.activity")).toHaveCount(0); + await expect(activityRows(page)).toHaveCount(0); await expect(main.getByRole("link", { name: "Older" })).toHaveCount(0); await expect(page.getByRole("search", { name: filter })).toBeVisible(); await main.getByRole("link", { name: "Clear filters" }).click(); @@ -158,7 +160,7 @@ for (const { path, filters, filter, table } of [ filters: "problems (Show), within (Time range), action (Action prefix), actor, entity", filter: "Filter activity", - table: "ol.activity", + table: "table", }, { path: "/deployments?severity=high", @@ -307,7 +309,7 @@ for (const path of [ await expectNoHorizontalOverflow(page); }); -test("every list page has a plain header without an eyebrow and a filter panel", async ({ +test("every list page has a plain header without an eyebrow and a filter section", async ({ page, }) => { for (const [path, title] of [ @@ -321,7 +323,7 @@ test("every list page has a plain header without an eyebrow and a filter panel", await expect(header).not.toContainText("Homelab CI/CD"); await expect(header.getByRole("heading", { level: 1 })).toHaveText(title); if (path !== "/approvals") - await expect(page.locator(".panel").getByRole("search")).toBeVisible(); + await expect(page.getByRole("region").getByRole("search")).toBeVisible(); } }); @@ -370,34 +372,38 @@ test("activity labels its columns, puts the actor beside the action and marks fa page, }) => { await page.goto("/activity?action=deployment.failed"); - const entries = page.locator("ol.activity > li"); + const entries = activityRows(page); await expect(entries.first()).toBeVisible(); - const columns = page.locator(".activity-columns"); - if (isPhone(page)) await expect(columns).toBeHidden(); - else { + const columns = page + .getByRole("table", { name: "Activity" }) + .locator("thead"); + if (isPhone(page)) { + // The labels move into each cell; the header row is clipped to a pixel. + const head = await columns.boundingBox(); + expect(head?.width ?? 0).toBeLessThanOrEqual(1); + } else { await expect(columns).toHaveText("WhenActionByAbout", { useInnerText: false, }); // The actor sits right after the action, not across the page. const action = await entries .first() - .locator(".activity-action") + .locator('td[data-label="Action"]') .boundingBox(); const actor = await entries .first() - .locator(".activity-actor") + .locator('td[data-label="By"]') .boundingBox(); if (action === null || actor === null) throw new Error("row is laid out"); expect(actor.x - (action.x + action.width)).toBeLessThan(40); } // The action reads in plain words; its recorded code stays in the title. await expect( - entries.first().locator(".activity-action .status-failed"), + statusIn(entries.first().locator('td[data-label="Action"]'), "error"), ).toHaveText(/Deployment failed/u); - await expect(entries.first().locator(".activity-action")).toHaveAttribute( - "title", - "deployment.failed", - ); + await expect( + entries.first().locator('td[data-label="Action"] > span'), + ).toHaveAttribute("title", "deployment.failed"); await expect( entries.first().getByRole("link", { name: /^Deployment [0-9a-f-]{36}$/u }), ).toBeVisible(); @@ -407,7 +413,7 @@ test("activity counts the rows it renders, names its time zone and says why a de page, }) => { await page.goto("/activity"); - const entries = page.locator("ol.activity > li"); + const entries = activityRows(page); await expect(entries.first()).toBeVisible(); const rendered = await entries.count(); // The count is of rows; folded rows say how many events they hold. @@ -419,24 +425,23 @@ test("activity counts the rows it renders, names its time zone and says why a de "u", ), ); - const zone = /Times are (UTC(?:[+-]\d{1,2}(?::\d{2})?)?)\./u.exec( - (await page.locator("[data-page-header] [data-page-lede]").textContent()) ?? - "", - )?.[1]; - if (zone === undefined) throw new Error("the header names the time zone"); - await expect(entries.first().locator("time").first()).toHaveAttribute( + // Times are Pacific time, and every relative age carries its exact moment. + await expect( + page.locator("[data-page-header] [data-page-lede]"), + ).toContainText("Times are Pacific time."); + await expect(entries.first().locator("time[title]").first()).toHaveAttribute( "title", - new RegExp(` ${zone.replace("+", String.raw`\+`)}$`, "u"), + / PT$/u, ); // A stage written running and then succeeded reads once, as succeeded. - for (const run of await page.locator(".activity-stages").all()) { + for (const run of await page.locator('[data-part="stages"]').all()) { const stages = await run.locator(".mono").allTextContents(); expect(new Set(stages).size).toBe(stages.length); } await page.goto("/activity?action=deployment.failed"); - const failure = page.locator("ol.activity > li").first(); - await expect(failure.locator(".activity-reason")).not.toBeEmpty(); + const failure = activityRows(page).first(); + await expect(failure.locator('[data-part="reason"]')).not.toBeEmpty(); }); test("an environment's recent deployments do not repeat the environment on every row", async ({ diff --git a/packages/delivery/e2e/model.spec.ts b/packages/delivery/e2e/model.spec.ts index deeb3b28ca6..1509b293913 100644 --- a/packages/delivery/e2e/model.spec.ts +++ b/packages/delivery/e2e/model.spec.ts @@ -184,9 +184,9 @@ test("the page leads with what runs here and what is in flight, then the release /Accepted r3 · Approval required · generation 6 · In flight: deploy r4 awaiting approval/u, ); await expect( - main.locator("[data-page-header] .environment-in-flight svg.status-glyph"), + main.locator("[data-page-header] .environment-in-flight [data-sev] > svg"), ).toBeVisible(); - await expect(main.locator(".environment-notice")).toContainText( + await expect(main.locator("#environment-refusal")).toContainText( /^In flight: deployment \S+ is awaiting approval\. Requests, rebinds and rollbacks are refused until it finishes or is canceled\.$/u, ); expect( @@ -215,14 +215,13 @@ test("the page leads with what runs here and what is in flight, then the release ).toBeVisible(); }); -test("every confirmation asks through the page's one dialog and returns focus to its button", async ({ +test("every confirmation asks in a dialog of its own and returns focus to its button", async ({ page, }) => { await showIdle(page, PROD); await openEnvironment(page); const region = page.getByRole("region", { name: "Rollback candidates" }); - // Several buttons here ask before acting; the page holds one dialog for them. - await expect(page.locator("dialog")).toHaveCount(1); + await expect(page.getByRole("dialog")).toHaveCount(0); const rollback = region .locator("ol.candidates > li") .nth(1) @@ -236,7 +235,6 @@ test("every confirmation asks through the page's one dialog and returns focus to await asked.getByRole("button", keep).click(); await expect(page.getByRole("dialog")).toBeHidden(); await expect(rollback).toBeFocused(); - // Another button asks its own question through the same element. const rebind = page .getByRole("region", { name: "Selection", exact: true }) .getByRole("button", { name: "Rebind" }); @@ -245,8 +243,8 @@ test("every confirmation asks through the page's one dialog and returns focus to await expect(rebinding).toBeVisible(); await expect(rebinding).not.toContainText("Restores the selection"); await expect(rebinding).toContainText("Keeps set revision r3"); - await expect(page.locator("dialog")).toHaveCount(1); - await expect(page.locator("dialog h2")).toHaveCount(1); + await expect(page.getByRole("dialog")).toHaveCount(1); + await expect(page.getByRole("dialog").getByRole("heading")).toHaveCount(1); await page.keyboard.press("Escape"); await expect(page.getByRole("dialog")).toBeHidden(); await expect(rebind).toBeFocused(); @@ -273,7 +271,7 @@ test("every confirmation asks through the page's one dialog and returns focus to await expect(rebind).not.toHaveAttribute("aria-disabled"); await expect(rebind).toBeEnabled(); await expect(rebind).toBeFocused(); - await expect(page.locator("dialog")).toHaveCount(1); + await expect(page.getByRole("dialog")).toHaveCount(0); }); test("rolling back to a candidate requests its exact selection", async ({ @@ -472,7 +470,7 @@ test("the activity trail shows what each catalog reconcile changed", async ({ page, }) => { await page.goto("/activity?action=catalog."); - const entries = page.locator("ol.activity > li"); + const entries = page.locator("tbody tr"); await expect(entries).toHaveCount(3); await expect(entries.nth(0)).toContainText("Environments rebound (1)"); await expect(entries.nth(0)).toContainText("Recipe revisions created (1)"); diff --git a/packages/delivery/e2e/navigation.spec.ts b/packages/delivery/e2e/navigation.spec.ts index 7d4de053cd5..efc8658e3e6 100644 --- a/packages/delivery/e2e/navigation.spec.ts +++ b/packages/delivery/e2e/navigation.spec.ts @@ -84,7 +84,7 @@ test("commits show their title and author, and page to older ones", async ({ }) => { await page.goto("/commits"); const recent = page.getByRole("region", { name: "Recent commits" }); - const rows = recent.getByRole("listitem"); + const rows = recent.locator("tbody tr"); const arcade = rows.filter({ has: page.getByRole("link", { name: /^aaaaaaa/u }), }); diff --git a/packages/delivery/e2e/overview.model.spec.ts b/packages/delivery/e2e/overview.model.spec.ts index 0810a065550..e897def2683 100644 --- a/packages/delivery/e2e/overview.model.spec.ts +++ b/packages/delivery/e2e/overview.model.spec.ts @@ -2,30 +2,30 @@ import { expect, test } from "@playwright/test"; import { HubGridSchema } from "#shared/hub/hub-contract.ts"; import { api, - expectContainedInTiles, + expectContainedInRows, expectNoHorizontalOverflow, expectPagesAgreeOnAttention, isPhone, openOverview, - overviewTile as tile, + overviewRow as row, } from "./helpers.ts"; // Served by e2e/model-server.ts, where Arcade prod's newest request waits for // approval beside the release it already accepted: the longest chip there is. -test("a chip with an accepted release and a request awaiting approval stays inside its tile", async ({ +test("an environment with an accepted release and a request awaiting approval stays inside its row", async ({ page, }) => { await page.goto("/"); const chip = page .getByRole("main") - .locator(".overview-tile") + .locator("tbody tr") .filter({ has: page.getByRole("link", { name: "Arcade", exact: true }) }) .getByRole("link", { name: /^prod / }); await expect(chip).toContainText("awaiting approval"); - await expectContainedInTiles(page); + await expectContainedInRows(page); await page.setViewportSize({ width: 360, height: 800 }); - await expectContainedInTiles(page); + await expectContainedInRows(page); }); test("a phone says how many services are healthy, never a bare number", async ({ @@ -102,7 +102,7 @@ test("a queued worker retirement of the accepted release is not a pending releas route.fulfill({ json: { ...grid, groups } }), ); await openOverview(page); - const arcade = tile(page, "Arcade"); + const arcade = row(page, "Arcade"); if (isPhone(page) && !(await arcade.isVisible())) await page .getByRole("region", { name: "Products", exact: true }) @@ -117,7 +117,7 @@ test("a queued worker retirement of the accepted release is not a pending releas await expect(chip.getByText("worker retirement queued")).toBeVisible(); await expectNoHorizontalOverflow(page); await page.setViewportSize({ width: 390, height: 844 }); - await expectContainedInTiles(page); + await expectContainedInRows(page); }); test("the overview and the pipelines list name the same items needing attention", async ({ diff --git a/packages/delivery/e2e/overview.spec.ts b/packages/delivery/e2e/overview.spec.ts index f20307346f8..d3d7effafe7 100644 --- a/packages/delivery/e2e/overview.spec.ts +++ b/packages/delivery/e2e/overview.spec.ts @@ -2,14 +2,15 @@ import { expect, test } from "@playwright/test"; import { HubGridSchema } from "#shared/hub/hub-contract.ts"; import { api, - expectContainedInTiles, + expectContainedInRows, expectNoHorizontalOverflow, isPhone, mainNav, openOverview, - overviewTile as tile, + overviewRow as serviceRow, requestArcadeDeployment, showAllAttention, + statusIn, } from "./helpers.ts"; const NAVIGATION = [ @@ -86,19 +87,17 @@ test("attention comes first and names the service and environment", async ({ }); await expect(stuck).toBeVisible(); await expect( - tile(page, "Minecraft").getByRole("link", { + serviceRow(page, "Minecraft").getByRole("link", { name: /^tsmc .*recovery required/u, }), ).toHaveAttribute("href", "/environments/minecraft/tsmc"); // Attention precedes every panel of services in the page. const order = await page .getByRole("main") - .getByRole("region") - .evaluateAll((regions) => - regions.map((region) => region.getAttribute("aria-labelledby")), - ); - expect(order[0]).toBe("attention-heading"); - expect(order).toContain("overview-product"); + .getByRole("heading", { level: 2 }) + .allTextContents(); + expect(order[0]).toBe("Needs attention"); + expect(order).toContain("Products"); await stuck.click(); await expect(page).toHaveURL(/\/deployments\/[^/]+$/u); await expect( @@ -156,7 +155,7 @@ test("every attention row keeps its kind, lead, summary and time in the same col await expectNoHorizontalOverflow(page); }); -test("a chip shows the accepted release apart from a newer request, each with its own status", async ({ +test("an environment shows the accepted release apart from a newer request, each with its own status", async ({ page, }) => { await openOverview(page); @@ -169,16 +168,18 @@ test("a chip shows the accepted release apart from a newer request, each with it const accepted = `r${String(birmel.acceptedRevision)}`; const queued = `r${String(birmel.request.revision)}`; expect(accepted).not.toBe(queued); - const chip = tile(page, "Birmel").getByRole("link", { name: /^prod / }); + const chip = serviceRow(page, "Birmel").getByRole("link", { name: /^prod / }); // The accepted release with its own status and age, then the newer request's own number and status. await expect(chip).toHaveAccessibleName( new RegExp(`^prod accepted ${accepted} .+ ${queued} queued$`, "u"), ); await expect(chip).not.toContainText(`${accepted} queued`); // Every chip carries a status glyph and words, a newer request or not. - await expect(chip.locator(".status")).toHaveCount(2); - for (const each of await page.locator("a.overview-chip").all()) - await expect(each.locator(".status-glyph").first()).toHaveCount(1); + await expect(statusIn(chip)).toHaveCount(2); + for (const each of await page + .locator("main ol[aria-label$=' environments'] a") + .all()) + await expect(statusIn(each).first()).toHaveCount(1); // A deployment queued past the threshold with no stage started needs someone. const attention = page.getByRole("region", { name: "Needs attention" }); @@ -213,7 +214,7 @@ test("each attention item says what failed instead of the executor boilerplate", ).toContainText(/The \S+ of r\d+ failed and left the environment locked\./u); }); -test("each kind is a panel with its counts, and a group of several has its own", async ({ +test("each kind is a section with its counts, and a group of several has its own", async ({ page, }) => { await openOverview(page); @@ -225,14 +226,13 @@ test("each kind is a panel with its counts, and a group of several has its own", await expect(page.getByRole("main")).toContainText( `${String(total)} services`, ); - const panels = page.getByRole("main").locator("section.overview-kind"); - await expect(panels.getByRole("heading", { level: 2 })).toHaveText([ - "Products", - "Workloads", - "Platform", - ]); + const kinds = page + .getByRole("main") + .getByRole("heading", { level: 2 }) + .filter({ hasNotText: "Needs attention" }); + await expect(kinds).toHaveText(["Products", "Workloads", "Platform"]); // Other specs deploy to the products, so their standings move between - // runs; a panel's counts always add up to the tiles directly under it, + // runs; a section's counts always add up to the rows directly under it, // and each group under it counts its own. const products = page.getByRole("region", { name: "Products", exact: true }); const labels = await products @@ -245,7 +245,7 @@ test("each kind is a panel with its counts, and a group of several has its own", 0, ); await expect( - products.locator(".overview-tile:not(.overview-group .overview-tile)"), + products.locator("table[aria-label='Products'] tbody tr"), ).toHaveCount(counted); // Platform services holds the two seeded v2-only services beside its own. const platform = page.getByRole("region", { name: "Platform", exact: true }); @@ -263,21 +263,21 @@ test("each kind is a panel with its counts, and a group of several has its own", await expect( group.getByRole("link", { name: "Node feature discovery", exact: true }), ).toHaveAttribute("href", "/pipelines/nfd"); - await expect(tile(page, "1Password Connect")).toContainText( + await expect(serviceRow(page, "1Password Connect")).toContainText( "No environments", ); await expect( - tile(page, "Node feature discovery").getByRole("link", { + serviceRow(page, "Node feature discovery").getByRole("link", { name: "prod not started", }), ).toHaveAttribute("href", "/environments/nfd/prod"); await expectNoHorizontalOverflow(page); }); -test("a tile links its service and each environment chip", async ({ page }) => { +test("a row links its service and each environment", async ({ page }) => { await openOverview(page); - const scout = tile(page, "Scout for LoL"); - // A phone folds a service that needs nobody; open it to reach its chips. + const scout = serviceRow(page, "Scout for LoL"); + // A phone folds a service that needs nobody; open it to reach its environments. if (isPhone(page) && !(await scout.isVisible())) await page .getByRole("region", { name: "Products", exact: true }) @@ -319,13 +319,13 @@ test("the overview filters through the URL", async ({ page }) => { (sum, group) => sum + group.services.length, 0, ); - const tiles = page.getByRole("main").locator(".overview-tile"); - await expect(tiles).toHaveCount(total); + const rows = page.getByRole("main").locator("tbody tr"); + await expect(rows).toHaveCount(total); const filters = page.getByRole("search", { name: "Filter services" }); await filters.getByLabel("Service").fill("nfd"); await filters.getByRole("button", { name: "Filter" }).click(); await expect(page).toHaveURL(/\/\?q=nfd$/u); - await expect(tiles).toHaveCount(1); + await expect(rows).toHaveCount(1); await expect(page.getByRole("main")).toContainText( `1 of ${String(total)} services`, ); @@ -343,7 +343,7 @@ test("the overview filters through the URL", async ({ page }) => { await expect(page.getByRole("main")).toContainText( "No services match these filters.", ); - await expect(tiles).toHaveCount(0); + await expect(rows).toHaveCount(0); // A submit keeps focus on its button; the form is not remounted. await expect(filters.getByRole("button", { name: "Filter" })).toBeFocused(); @@ -351,23 +351,23 @@ test("the overview filters through the URL", async ({ page }) => { // The controls follow the URL through history, not what was last chosen. await page.goBack(); await expect(page).toHaveURL(/\/\?q=nfd$/u); - await expect(tiles).toHaveCount(1); + await expect(rows).toHaveCount(1); await expect(filters.getByLabel("Service")).toHaveValue("nfd"); await expect(filters.getByLabel("Newest deployment")).toHaveValue(""); await page.goBack(); await expect(filters.getByLabel("Service")).toHaveValue(""); - await expect(tiles).toHaveCount(total); + await expect(rows).toHaveCount(total); await page.goForward(); await expect(page).toHaveURL(/\/\?q=nfd$/u); await expect(filters.getByLabel("Service")).toHaveValue("nfd"); - await expect(tiles).toHaveCount(1); + await expect(rows).toHaveCount(1); await page.goForward(); await expect(page).toHaveURL(/\/\?q=nfd&status=succeeded$/u); await expect(filters.getByLabel("Service")).toHaveValue("nfd"); await expect(filters.getByLabel("Newest deployment")).toHaveValue( "succeeded", ); - await expect(tiles).toHaveCount(0); + await expect(rows).toHaveCount(0); // A submit trims what was typed, and the control still follows the URL. await openOverview(page); @@ -376,7 +376,7 @@ test("the overview filters through the URL", async ({ page }) => { await expect(page).toHaveURL(/\/\?q=nfd$/u); await expect(filters.getByLabel("Service")).toHaveValue("nfd"); await page.goBack(); - await expect(tiles).toHaveCount(total); + await expect(rows).toHaveCount(total); await expect(filters.getByLabel("Service")).toHaveValue(""); // A deep link carries the filter, and a status alone filters too. @@ -384,44 +384,48 @@ test("the overview filters through the URL", async ({ page }) => { await expect(filters.getByLabel("Newest deployment")).toHaveValue( "not_started", ); - await expect(tile(page, "Node feature discovery")).toBeVisible(); - await expect(tile(page, "1Password Connect")).toHaveCount(0); + await expect(serviceRow(page, "Node feature discovery")).toBeVisible(); + await expect(serviceRow(page, "1Password Connect")).toHaveCount(0); await expectNoHorizontalOverflow(page); }); -test("tiles fill the width on a desktop and sit two to a row on a phone", async ({ +test("each service row sets its name beside its environments on a desktop and stacks them on a phone", async ({ page, }) => { await openOverview(page); - // Wait for the tiles to settle before measuring them. - await expect( - page - .getByRole("region", { name: "Products", exact: true }) - .locator(".overview-tile") - .first(), - ).toBeVisible(); + const products = page.getByRole("region", { name: "Products", exact: true }); + const first = products + .locator("table[aria-label='Products'] tbody tr") + .first(); + // Wait for the rows to settle before measuring them. + await expect(first).toBeVisible(); await expectNoHorizontalOverflow(page); - const lefts = await page - .getByRole("region", { name: "Products", exact: true }) - .locator(".overview-tile") - .evaluateAll((tiles) => - tiles + const lefts = await products + .locator("table[aria-label='Products'] td[data-label='Environments']") + .evaluateAll((cells) => + cells .filter((entry) => entry.checkVisibility()) .map((entry) => Math.round(entry.getBoundingClientRect().left)), ); expect(lefts.length).toBeGreaterThan(3); - const columns = new Set(lefts).size; - if (isPhone(page)) expect(columns).toBe(2); - else expect(columns).toBeGreaterThan(2); + // Every row's environments start at the same edge. + expect(new Set(lefts).size).toBe(1); + const name = await first.locator("th").boundingBox(); + const environments = await first.locator("td").boundingBox(); + if (name === null || environments === null) + throw new Error("The first row has a name and its environments"); + // Side by side on a desktop; under their label on a phone. + if (isPhone(page)) expect(environments.y).toBeGreaterThan(name.y); + else expect(environments.x).toBeGreaterThan(name.x + name.width - 1); await expectNoHorizontalOverflow(page); }); -test("every chip stays inside its tile", async ({ page }) => { +test("every environment stays inside its row", async ({ page }) => { await openOverview(page); - await expectContainedInTiles(page); - // A phone's narrow tiles are the hardest case; check that width too. + await expectContainedInRows(page); + // A phone's narrow rows are the hardest case; check that width too. await page.setViewportSize({ width: 390, height: 844 }); - await expectContainedInTiles(page); + await expectContainedInRows(page); }); test("a phone folds the services that need nobody behind a closed count", async ({ @@ -433,7 +437,7 @@ test("a phone folds the services that need nobody behind a closed count", async has: page.locator("summary", { hasText: "healthy" }), }); if (!isPhone(page)) { - // A wide screen shows every tile. + // A wide screen shows every row. await expect( page.locator("main details", { hasText: "healthy" }), ).toHaveCount(0); @@ -443,13 +447,13 @@ test("a phone folds the services that need nobody behind a closed count", async // The count reads as a count of healthy services, never as zero things. await expect(fold.locator("summary")).toHaveText(/^(?:All )?\d+ healthy$/u); // What needs a person stays in sight: a service that requires recovery. - await expect(tile(page, "Minecraft")).toBeVisible(); + await expect(serviceRow(page, "Minecraft")).toBeVisible(); await fold.locator("summary").click(); - await expect(fold.locator(".overview-tile").first()).toBeVisible(); + await expect(fold.locator("tbody tr").first()).toBeVisible(); await expectNoHorizontalOverflow(page); }); -test("a deployment moves its tile without a reload", async ({ +test("a deployment moves its row without a reload", async ({ page, baseURL, }) => { @@ -458,7 +462,7 @@ test("a deployment moves its tile without a reload", async ({ page.getByRole("status").filter({ hasText: "Live" }), ).toBeVisible(); const { deployment, cancel } = await requestArcadeDeployment(page, baseURL); - const chip = tile(page, "Arcade").getByRole("link", { name: /^prod / }); + const chip = serviceRow(page, "Arcade").getByRole("link", { name: /^prod / }); try { await expect(chip).toContainText(deployment.status.replaceAll("_", " ")); } finally { diff --git a/packages/delivery/e2e/recovery.model.spec.ts b/packages/delivery/e2e/recovery.model.spec.ts index 3ce8734dbc5..524e3a643f6 100644 --- a/packages/delivery/e2e/recovery.model.spec.ts +++ b/packages/delivery/e2e/recovery.model.spec.ts @@ -4,7 +4,13 @@ import { DeploymentPageSchema, EnvironmentDetailSchema, } from "#shared/hub/hub-contract.ts"; -import { api, expectNoHorizontalOverflow, openOverview } from "./helpers.ts"; +import { + activityRows, + api, + expectNoHorizontalOverflow, + openOverview, + statusIn, +} from "./helpers.ts"; import { APPLIED_REQUEST, HELD_PROD, @@ -119,7 +125,7 @@ test("the environment names the desired image recovery applied, and its newest f "image:streambot runs desired r4's digest, which Delivery has not accepted", ); await expect(runtime).toContainText("not accepted"); - await expect(runtime.locator(".status-failed")).toHaveCount(0); + await expect(statusIn(runtime, "error")).toHaveCount(0); await expectNoHorizontalOverflow(page); }); @@ -190,11 +196,7 @@ test("every page leads a deployment that ended mid-step with that step, not with await expect(canary).not.toContainText("Recovery intent 1 read"); await page.goto("/activity?action=deployment.failed"); - const row = page - .getByRole("main") - .locator("ol.activity > li") - .filter({ hasText: "Golink canary" }) - .first(); + const row = activityRows(page).filter({ hasText: "Golink canary" }).first(); await expect(row).toContainText(INTERRUPTED_CAUSE); await expect(row).not.toContainText("ended in phase"); }); @@ -233,9 +235,7 @@ test("a failure recorded as a runtime error shows its sentence, and the raw text for (const stray of [".;", "found;", "; -"]) await expect(main).not.toContainText(stray, { useInnerText: true }); // The raw text is in a disclosure that starts collapsed. - const raw = main - .locator("details.disclosure") - .filter({ hasText: "Full error text" }); + const raw = main.locator("details").filter({ hasText: "Full error text" }); await expect(raw.first()).not.toHaveAttribute("open", ""); await expect(raw.first().locator("pre").first()).toBeHidden(); await expect(raw.first().locator("pre").first()).toHaveText( diff --git a/packages/delivery/e2e/vocabulary.spec.ts b/packages/delivery/e2e/vocabulary.spec.ts index 8f357020dc8..08fc52da0b3 100644 --- a/packages/delivery/e2e/vocabulary.spec.ts +++ b/packages/delivery/e2e/vocabulary.spec.ts @@ -3,26 +3,27 @@ import { HubGridSchema, ServicePipelineSchema, } from "#shared/hub/hub-contract.ts"; -import { api, expectNoHorizontalOverflow } from "./helpers.ts"; +import { activityRows, api, expectNoHorizontalOverflow } from "./helpers.ts"; test("activity rows show a clock reading, plain actions and where each entity belongs", async ({ page, }) => { await page.goto("/activity?action=deployment."); - const entries = page.locator("ol.activity > li"); + const entries = activityRows(page); await expect(entries.first()).toBeVisible(); // Every row says when to the second in sight, not only in a title. - await expect(entries.first().locator(".activity-when .clock")).toHaveText( - /\d{2}:\d{2}:\d{2}/u, - ); + await expect( + entries.first().locator('[data-part="when"] time').first(), + ).toHaveText(/\d{2}:\d{2}:\d{2}/u); // A deployment entry names its environment by the overview's name and its release. - const named = entries.filter({ has: page.locator(".activity-where") }); + const named = entries.filter({ has: page.locator('[data-part="where"]') }); await expect(named.first()).toBeVisible(); - await expect(named.first().locator(".activity-where")).toContainText(/r\d+/u); - await expect(page.locator(".activity-action").first()).toHaveAttribute( - "title", - /^deployment\./u, + await expect(named.first().locator('[data-part="where"]')).toContainText( + /r\d+/u, ); + await expect( + page.locator('td[data-label="Action"] > span').first(), + ).toHaveAttribute("title", /^deployment\./u); await expectNoHorizontalOverflow(page); }); @@ -36,7 +37,7 @@ test("activity filters to problems and a time range through the URL", async ({ await form.getByRole("button", { name: "Filter" }).click(); await expect(page).toHaveURL(/[?&]problems=only/u); await expect(page).toHaveURL(/[?&]within=day/u); - const entries = page.locator("ol.activity > li"); + const entries = activityRows(page); await expect(entries.first()).toBeVisible(); // The unfiltered rows stay until the filtered page arrives, so wait for it. const problem = @@ -44,7 +45,7 @@ test("activity filters to problems and a time range through the URL", async ({ await expect .poll(async () => { const titles = await entries - .locator(".activity-action") + .locator('td[data-label="Action"] > span') .evaluateAll((nodes) => nodes.map((node) => node.getAttribute("title") ?? ""), ); @@ -61,16 +62,16 @@ test("a burst of commit records folds into one counted row", async ({ page, }) => { await page.goto("/activity?action=build.source_recorded"); - const folded = page - .locator("ol.activity > li") - .filter({ has: page.locator(".activity-count") }); + const folded = activityRows(page).filter({ + has: page.locator('[data-part="count"]'), + }); await expect(folded.first()).toBeVisible(); - await expect(folded.first().locator(".activity-action")).toContainText( + await expect(folded.first().locator('td[data-label="Action"]')).toContainText( /Commit recorded ×\d+/u, ); await folded.first().locator("summary").click(); await expect( - folded.first().locator(".activity-repeated > li").first(), + folded.first().locator('[data-part="repeated"] > li').first(), ).toBeVisible(); }); diff --git a/packages/delivery/e2e/workers.spec.ts b/packages/delivery/e2e/workers.spec.ts index 5f5c73acbe6..e978be9bfa3 100644 --- a/packages/delivery/e2e/workers.spec.ts +++ b/packages/delivery/e2e/workers.spec.ts @@ -199,7 +199,7 @@ test("retained artifacts with no desired host are collapsed behind their count", await expect( pool.getByRole("button", { name: "Request retirement", exact: true }), ).toHaveCount(1); - await expect(page.locator("dialog")).toHaveCount(1); + await expect(page.getByRole("dialog")).toHaveCount(0); await expectNoHorizontalOverflow(page); }); @@ -238,8 +238,10 @@ test("an open question closes without acting when its build leaves the pool", as await page.locator("html").dispatchEvent("visibilitychange"); await expect(retire).toHaveCount(0); await expect(page.getByRole("dialog")).toBeHidden(); - await expect(page.locator("dialog")).toHaveJSProperty("open", false); - await expect(page.locator("dialog h2")).toHaveCount(0); + await expect(page.getByRole("dialog")).toHaveCount(0); + await expect( + page.getByRole("heading", { name: /^Retire build 1/u }), + ).toHaveCount(0); expect(retirements).toEqual([]); await expect(pool).toContainText("1 · selected"); }); diff --git a/packages/delivery/src/client/artifacts.tsx b/packages/delivery/src/client/artifacts.tsx index 13986fb6172..2c3807bf3e2 100644 --- a/packages/delivery/src/client/artifacts.tsx +++ b/packages/delivery/src/client/artifacts.tsx @@ -42,8 +42,8 @@ export function BuildTable({ names?: CatalogNames | undefined; }) { return ( -
- +
+
@@ -56,7 +56,7 @@ export function BuildTable({ {builds.map((build) => ( - - - - - - - ); @@ -136,36 +143,46 @@ export function DeploymentTable({ empty, showEnvironment = true, names, + bleed = "panel", }: { deployments: DeploymentListItem[]; empty: string; showEnvironment?: boolean; /** The catalog's names, so an environment reads as the overview names it. */ names?: CatalogNames; + /** What holds the table: a padded `panel` it runs across, or an `inline` section. */ + bleed?: "panel" | "inline"; }) { - if (deployments.length === 0) return

{empty}

; + if (deployments.length === 0) + return ( +
+ {empty} +
+ ); return ( -
-
Service
+
{names?.service(build.serviceId) ?? build.serviceId} @@ -67,12 +67,12 @@ export function BuildTable({ )}
+ +
@@ -83,7 +83,7 @@ export function BuildTable({
+
    {build.artifacts.map((artifact) => (
  • @@ -95,7 +95,7 @@ export function BuildTable({ ))}
+ {build.ciUrl === null ? ( {evidenceSummary(build.sourceKind)} ) : ( @@ -118,7 +118,7 @@ export function SelectedArtifacts({ version: VersionSetRevision; }) { return ( - +
{Object.entries(version.components).map(([component, artifact]) => (
diff --git a/packages/delivery/src/client/components/attention-panel.tsx b/packages/delivery/src/client/components/attention-panel.tsx index e780ddfb17d..a4216041b13 100644 --- a/packages/delivery/src/client/components/attention-panel.tsx +++ b/packages/delivery/src/client/components/attention-panel.tsx @@ -1,7 +1,12 @@ import { useId, useState } from "react"; import type { Attention } from "#shared/hub/hub-contract.ts"; import { TargetLink } from "./links.tsx"; -import { RelativeTime } from "./time.tsx"; +import { + Button, + Chip, + RelativeTime, + Section, +} from "@shepherdjerred/console-ui"; const ATTENTION: Record = { approval: "Approval", @@ -19,9 +24,9 @@ export const ATTENTION_COLLAPSE_AFTER = 5; const WAITS: ReadonlySet = new Set(["approval", "queued"]); /** - * What someone has to act on, newest first. Renders nothing when there is - * nothing to act on. A failure, a recovery or an alarm outranks a wait, so - * the panel takes the failure tone as soon as it holds one. Each row keeps + * What someone has to act on, newest first, as a `Section`. Renders nothing + * when there is nothing to act on. A failure, a recovery or an alarm is told + * from a wait by its chip's severity. Each row keeps * its kind, its lead, its summary and its time in fixed columns, so rows read * alike however long their words. `collapseAfter` shows only that many * items, with a button for the rest, on a page where the list is not the @@ -37,27 +42,35 @@ export function AttentionPanel({ const [expanded, setExpanded] = useState(false); const list = useId(); if (items.length === 0) return null; - const waiting = items.every((item) => WAITS.has(item.kind)); const collapsible = collapseAfter !== undefined && items.length > collapseAfter; const shown = collapsible && !expanded ? items.slice(0, collapseAfter) : items; return ( -
{ + setExpanded(!expanded); + }} + > + {expanded ? "Show fewer" : `Show all ${String(items.length)}`} + + ) + } > -
-

Needs attention

- - {items.length} {items.length === 1 ? "item" : "items"} - -
-
    +
      {shown.map((item) => ( -
    • - - {ATTENTION[item.kind]} +
    • + + + {ATTENTION[item.kind]} + {item.title} @@ -71,19 +84,6 @@ export function AttentionPanel({
    • ))}
    - {collapsible && ( - - )} -
+ ); } diff --git a/packages/delivery/src/client/components/confirm-dialog.tsx b/packages/delivery/src/client/components/confirm-dialog.tsx index fa6802d6ea1..e0ebefca27d 100644 --- a/packages/delivery/src/client/components/confirm-dialog.tsx +++ b/packages/delivery/src/client/components/confirm-dialog.tsx @@ -1,135 +1,20 @@ -import { - createContext, - useCallback, - useContext, - useId, - useMemo, - useRef, - useState, - type ReactNode, -} from "react"; -import { createPortal, flushSync } from "react-dom"; - -type ConfirmDialogHost = { - /** The dialog's form, where the open button renders its question. */ - form: HTMLFormElement | null; - /** The button whose question is open, or null while the dialog is closed. */ - owner: string | null; - /** The id the question's heading takes, so it names the dialog. */ - heading: string; - /** Open the dialog on `owner`'s question; a confirmed answer runs `onConfirm`. */ - ask: (owner: string, onConfirm: () => void) => void; - /** The action a confirmed answer runs, as the open question now defines it. */ - answerWith: (onConfirm: () => void) => void; - /** Close without confirming when `owner`'s question is the open one. */ - release: (owner: string) => void; -}; - -const ConfirmDialogContext = createContext(null); - -/** - * The one native modal dialog every `ConfirmButton` below it asks through. - * A page with forty confirm buttons has one ``, not forty: the button - * that opened it renders its own question into the dialog's form. Focus moves - * into the dialog, Escape cancels, and the browser returns focus to the - * button that opened it. - */ -export function ConfirmDialogProvider({ children }: { children: ReactNode }) { - const dialog = useRef(null); - const asking = useRef<{ owner: string; onConfirm: () => void } | null>(null); - const [form, setForm] = useState(null); - const [owner, setOwner] = useState(null); - const heading = useId(); - const ask = useCallback((next: string, onConfirm: () => void) => { - asking.current = { owner: next, onConfirm }; - // The question is in the form before the dialog opens, so the browser - // finds "Keep as is" to focus. - flushSync(() => { - setOwner(next); - }); - dialog.current?.showModal(); - }, []); - const answerWith = useCallback((onConfirm: () => void) => { - if (asking.current !== null) asking.current.onConfirm = onConfirm; - }, []); - const release = useCallback((leaving: string) => { - if (asking.current?.owner === leaving) dialog.current?.close(); - }, []); - const host = useMemo( - () => ({ form, owner, heading, ask, answerWith, release }), - [form, owner, heading, ask, answerWith, release], - ); - return ( - - {children} - { - const confirmed = event.currentTarget.returnValue === "confirm"; - event.currentTarget.returnValue = ""; - const asked = asking.current; - asking.current = null; - setOwner(null); - if (confirmed) asked?.onConfirm(); - }} - > -
-
-
- ); -} - -/** What the dialog asks: its heading, the consequences, and the two answers. */ -export function ConfirmQuestion({ - heading, - title, - children, - confirmLabel, - danger, - onAnswer, -}: { - heading: string; - title: string; - children: ReactNode; - confirmLabel: string; - danger: boolean; - /** Runs as the confirming answer is given, before the dialog closes on it. */ - onAnswer?: () => void; -}) { - return ( - <> -

{title}

-
{children}
-
- - -
- - ); -} +import { useCallback, useRef, useState, type ReactNode } from "react"; +import { Button, Dialog, DialogClose } from "@shepherdjerred/console-ui"; /** The route's h1 (`PageHeader`), where focus goes when its own place is gone. */ const PAGE_HEADING = "#main-heading"; /** - * A button that asks before acting, through the page's one native modal - * dialog (`ConfirmDialogProvider`): focus moves into it, Escape cancels, and - * focus returns to the button on close. + * A button that asks before acting, in console-ui's modal `Dialog`: focus + * moves to "Keep as is", Escape cancels, and focus returns to the button on + * close. A closed dialog renders nothing, so a page may hold dozens. * * The button keeps that focus while its confirmed action is `pending`: it * reads as disabled and ignores a press, but is not disabled, because a * disabled element cannot hold focus and the browser would drop it to the * document. When the button leaves the page while focused, focus moves to - * the page heading, the same place a navigation puts it. + * the page heading, the same place a navigation puts it, and an open question + * leaves with it. */ export function ConfirmButton({ label, @@ -168,55 +53,75 @@ export function ConfirmButton({ check?: () => boolean; onConfirm: () => void; }) { - const host = useContext(ConfirmDialogContext); - if (host === null) - throw new Error("ConfirmButton renders below a ConfirmDialogProvider"); - const id = useId(); - const { ask, answerWith, release } = host; - const leaving = useCallback( - (trigger: HTMLButtonElement | null) => () => { - // A button that leaves the page takes its open question with it; the - // closing dialog hands focus back to the button first. - release(id); - if (trigger !== null && document.activeElement === trigger) + const [asking, setAsking] = useState(false); + const trigger = useRef(null); + // Focus is the button's from the press until a cancel hands it straight back; + // a confirmed answer closes the dialog while the action may remove the button. + const holdsFocus = useRef(false); + const attach = useCallback((button: HTMLButtonElement | null) => { + trigger.current = button; + // A button that leaves the page takes its open question with it; focus it + // held goes to the page heading rather than the document. + return () => { + if ( + button !== null && + (holdsFocus.current || document.activeElement === button) + ) document.querySelector(PAGE_HEADING)?.focus(); - }, - [release, id], - ); + }; + }, []); return ( <> - - {host.owner === id && - host.form !== null && - createPortal( - { - answerWith(onConfirm); - }} - > - {children} - , - host.form, - )} + + { + // Dismissing the question leaves focus on the button, as it was. + if (!open) holdsFocus.current = false; + setAsking(open); + }} + size="sm" + title={title} + finalFocus={() => trigger.current ?? true} + actions={ + <> + } + data-autofocus="" + > + Keep as is + + + + } + > +
{children}
+
); } diff --git a/packages/delivery/src/client/components/deployment-table.tsx b/packages/delivery/src/client/components/deployment-table.tsx index 4ed25cea1f8..f24ef939e29 100644 --- a/packages/delivery/src/client/components/deployment-table.tsx +++ b/packages/delivery/src/client/components/deployment-table.tsx @@ -1,5 +1,6 @@ import type { ReactNode } from "react"; import { Link } from "@tanstack/react-router"; +import { State } from "@shepherdjerred/console-ui"; import type { DeploymentListItem } from "#shared/hub/hub-contract.ts"; import { Identifier, @@ -9,7 +10,11 @@ import { } from "./identifier.tsx"; import { Status, statusLabel } from "./status.tsx"; import { CatalogName, type CatalogNames } from "./catalog-name.tsx"; -import { RelativeTime, relativeTime, useNow } from "./time.tsx"; +import { + RelativeTime, + formatRelative, + useNow, +} from "@shepherdjerred/console-ui"; /** What a deployment releases, as people say it: `r274`, or the source build's short id. */ export function releaseLabel(deployment: DeploymentListItem) { @@ -95,7 +100,7 @@ function Row({ ); return (
+ {name} @@ -118,9 +123,11 @@ function Row({ - - {deployment.requestedBy} + +
+ + {deployment.requestedBy} +
- - - - - - - - - - {deployments.map((deployment) => ( - - ))} - -
{showEnvironment ? "Deployment" : "Kind"}StatusReleaseRequested
+
+
+ + + + + + + + + + + {deployments.map((deployment) => ( + + ))} + +
{showEnvironment ? "Deployment" : "Kind"}StatusReleaseRequested
+
); } diff --git a/packages/delivery/src/client/components/disclosure.tsx b/packages/delivery/src/client/components/disclosure.tsx index 1595271b674..82ce48a4711 100644 --- a/packages/delivery/src/client/components/disclosure.tsx +++ b/packages/delivery/src/client/components/disclosure.tsx @@ -1,28 +1,21 @@ -import type { ReactNode } from "react"; +import { + Disclosure as SharedDisclosure, + type DisclosureProps, +} from "@shepherdjerred/console-ui"; -/** A native `
` with a styled summary and an optional count, for collapsing a long list. */ +/** + * console-ui's `Disclosure` where Delivery still draws a padded panel: `panel` + * runs its hairline and gutter across the panel's padding, `inline` stays + * inside what holds it. + */ export function Disclosure({ - summary, - count, - open = false, - children, -}: { - summary: ReactNode; - /** How many items the disclosure holds, shown beside the summary. */ - count?: number; - /** Whether it starts open; the reader's own toggling is kept afterwards. */ - open?: boolean; - children: ReactNode; -}) { - return ( -
- - {summary} - {count !== undefined && ( - {count} - )} - -
{children}
-
+ bleed = "panel", + ...props +}: DisclosureProps & { bleed?: "panel" | "inline" }) { + const disclosure = ; + return bleed === "inline" ? ( + disclosure + ) : ( +
{disclosure}
); } diff --git a/packages/delivery/src/client/components/facts.tsx b/packages/delivery/src/client/components/facts.tsx index c9fe6e4e17d..d6fa8c4c983 100644 --- a/packages/delivery/src/client/components/facts.tsx +++ b/packages/delivery/src/client/components/facts.tsx @@ -1,24 +1,47 @@ -import type { ReactNode } from "react"; +import { Children, isValidElement, type ReactNode } from "react"; +import { + DescriptionList, + type DescriptionItem, +} from "@shepherdjerred/console-ui"; -/** The label/value definition list: every `Fact` inside is one labelled value. */ -export function Facts({ children }: { children: ReactNode }) { - return
{children}
; +type FactProps = { + label: string; + mono?: boolean; + /** Takes a row of its own in the grid, for a long value. */ + wide?: boolean; + children: ReactNode; +}; + +/** + * One labelled value in a `Facts` list; `mono` sets an identifier in + * monospace. It renders nothing itself: `Facts` reads it as an item of + * console-ui's `DescriptionList`, so a fact can be left out with `&&`. + */ +export function Fact(_props: FactProps): null { + return null; } -/** One labelled value in a `Facts` list; `mono` sets an identifier in monospace. */ -export function Fact({ - label, - mono = false, +/** + * Labelled values as console-ui's `DescriptionList`. Labels are unique within + * a list. `bleed` says what the list sits in so its gutter lines up: `panel` + * runs across a panel's padding, `inline` stays inside what holds it. + */ +export function Facts({ children, + bleed = "panel", + layout = "grid", }: { - label: ReactNode; - mono?: boolean; children: ReactNode; + bleed?: "panel" | "inline"; + /** `rail` stacks the facts in one column, for a narrow place. */ + layout?: "grid" | "rail"; }) { - return ( -
-
{label}
-
{children}
-
- ); + const items: DescriptionItem[] = Children.toArray(children).map((child) => { + if (!isValidElement(child) || child.type !== Fact) + throw new Error("Facts holds only Fact children, or nothing"); + const { label, mono = false, wide = false, children: value } = child.props; + return { label, value, mono, wide }; + }); + const list = ; + return bleed === "inline" ? list :
{list}
; } diff --git a/packages/delivery/src/client/components/integrations.tsx b/packages/delivery/src/client/components/integrations.tsx index 6b806e6b9bf..ced04cbbf03 100644 --- a/packages/delivery/src/client/components/integrations.tsx +++ b/packages/delivery/src/client/components/integrations.tsx @@ -10,7 +10,8 @@ import type { import { queries } from "#client/queries.ts"; import { imageCheckStanding, imageCheckSummary } from "#client/presentation.ts"; import { Status } from "./status.tsx"; -import { Duration, RelativeTime } from "./time.tsx"; +import { Elapsed } from "#client/components/moment.tsx"; +import { RelativeTime } from "@shepherdjerred/console-ui"; import { ShortSha, ToolLinks } from "./links.tsx"; import { ErrorNotice } from "./notices.tsx"; import { Fact, Facts } from "./facts.tsx"; @@ -64,7 +65,7 @@ function Workflow({ workflow }: { workflow: CiWorkflow }) { {workflow.name} {workflow.startedAt !== null && ( - + )}
    @@ -96,7 +97,7 @@ function CiRunBody({ run }: { run: CiRun }) { {run.event} on {run.branch} {run.startedAt !== null && ( - + )}

    {(["test", "build", "publish", "other"] as const).map((stage) => { @@ -178,7 +179,7 @@ export function SourcePanel({

    )} {source.data.data.body !== "" && ( - +
    {source.data.data.body}
    )} diff --git a/packages/delivery/src/client/components/moment.tsx b/packages/delivery/src/client/components/moment.tsx new file mode 100644 index 00000000000..e99bd55a082 --- /dev/null +++ b/packages/delivery/src/client/components/moment.tsx @@ -0,0 +1,64 @@ +import { + Duration, + ExactTime, + RelativeTime, + useNow, + type ExactTimeProps, +} from "@shepherdjerred/console-ui"; + +/** + * How long something has run, with what an unfinished span measures in front + * of it, such as "awaiting approval for 3m". + */ +export function Elapsed({ + start, + end, + ongoing = "running", +}: { + start: string; + end: string | null; + /** What an unfinished span measures, such as "awaiting approval for". */ + ongoing?: string; +}) { + return ( + + {end === null ? `${ongoing} ` : ""} + + + ); +} + +/** + * A moment people act on by its date (an expiry, a creation stamp). One still + * ahead also says how far off it is. + */ +export function Deadline(props: ExactTimeProps) { + const now = useNow(); + const ahead = new Date(props.value).getTime() > now; + return ( + <> + + {ahead && ( + + {" "} + () + + )} + + ); +} + +/** + * A moment where the order of nearby rows matters: its exact time to the + * second beside how long ago it was, because a touch screen cannot hover a + * title. + */ +export function ClockTime({ value }: { value: string }) { + return ( + <> + + + + + ); +} diff --git a/packages/delivery/src/client/components/notices.tsx b/packages/delivery/src/client/components/notices.tsx index 310cc225dc6..34d9ab7e599 100644 --- a/packages/delivery/src/client/components/notices.tsx +++ b/packages/delivery/src/client/components/notices.tsx @@ -1,3 +1,6 @@ +import type { ReactNode } from "react"; +import { Banner, type Severity } from "@shepherdjerred/console-ui"; + /** * An error in the words a person reads. A Delivery API error is its message * alone: the code (`CONFLICT`, `INVALID`) is for programs, not for people. @@ -6,10 +9,81 @@ export function errorMessage(error: unknown) { return error instanceof Error ? error.message : String(error); } -export function ErrorNotice({ error }: { error: unknown }) { +/** How a notice reads: what it asks of the reader, not how loud it is. */ +export type NoticeTone = "warning" | "info" | "error" | "success"; + +const SEVERITY: Readonly> = { + warning: "warning", + info: "info", + error: "error", + success: "ok", +}; + +/** + * Where a notice sits, so its full-bleed row lines up with its surroundings: + * `page` runs edge to edge across the padded page, `panel` across a panel's + * padding, and `inline` stays inside whatever holds it. + */ +export type NoticeBleed = "page" | "panel" | "inline"; + +/** + * Page news as console-ui's `Banner`: glyph, word and a sentence or two. An + * `id` names the text for `aria-describedby`, and `role` makes the text, not + * the glyph's word, the live region; `name` marks the notice for tests and + * scripts that look for one kind of news. + */ +export function Notice({ + tone = "warning", + bleed = "panel", + role, + id, + name, + focusOnMount, + children, +}: { + tone?: NoticeTone; + bleed?: NoticeBleed; + role?: "status" | "alert"; + id?: string; + name?: string; + /** Takes focus as it mounts, for news that replaces the control that was focused. */ + focusOnMount?: (node: HTMLElement | null) => void; + children: ReactNode; +}) { + return ( +
    + +
    + {children} +
    +
    +
    + ); +} + +export function ErrorNotice({ + error, + bleed, +}: { + error: unknown; + bleed?: NoticeBleed; +}) { return ( -
    + {errorMessage(error)} -
    + ); } diff --git a/packages/delivery/src/client/components/overview-panels.tsx b/packages/delivery/src/client/components/overview-panels.tsx index 9b32fe2fb76..434fc197130 100644 --- a/packages/delivery/src/client/components/overview-panels.tsx +++ b/packages/delivery/src/client/components/overview-panels.tsx @@ -4,14 +4,13 @@ import type { GridEnvironment, GridService } from "#shared/hub/hub-contract.ts"; import { foldHealthy, requestStanding, - serviceStanding, standingCounts, type KindPanel, type ServiceStanding, } from "#client/routes/overview-model.ts"; import { Revision, revisionLabel } from "./identifier.tsx"; import { Status, statusLabel } from "./status.tsx"; -import { RelativeTime } from "./time.tsx"; +import { RelativeTime, Section } from "@shepherdjerred/console-ui"; import { Disclosure } from "./disclosure.tsx"; /** The shared status a standing borrows its glyph and color from. */ @@ -55,24 +54,28 @@ function Counts({ * and when it was accepted, then, only when the newest deployment is a * different one, that deployment's own release and status ("r293 * canceled"). One release's number never sits beside another's status. The - * words of a settled chip are hidden from sight only. + * words of a settled status are hidden from sight only. */ -function EnvironmentChip({ environment }: { environment: GridEnvironment }) { +function EnvironmentLink({ environment }: { environment: GridEnvironment }) { const { request } = environment; const newest = requestStanding(environment); return ( {environment.name} {request === null && ( - + )} {environment.acceptedRevision !== null && ( <> - {/* A newer request holds the chip's status, so the accepted release keeps its own. */} + {/* A newer request holds the link's status, so the accepted release keeps its own. */} {request !== null && } @@ -110,48 +113,67 @@ function EnvironmentChip({ environment }: { environment: GridEnvironment }) { * One service: a link to its pipeline, then its environments in promotion * order. An arrow joins a stage to the one it promotes from. */ -function ServiceTile({ service }: { service: GridService }) { +function ServiceRow({ service }: { service: GridService }) { return ( -
  1. - - {service.title} - - {service.environments.length === 0 ? ( -

    No environments

    - ) : ( -
      + + - {service.environments.map((environment) => ( -
    1. - {environment.promotesFrom !== null && ( - - )} - -
    2. - ))} -
    - )} -
  2. + {service.title} + + + + {service.environments.length === 0 ? ( + No environments + ) : ( +
      + {service.environments.map((environment) => ( +
    1. + {environment.promotesFrom !== null && ( + + )} + +
    2. + ))} +
    + )} + + ); } -function Tiles({ services }: { services: GridService[] }) { +/** A run of services as a table: the service, then where it runs. */ +function ServiceTable({ + label, + services, +}: { + label: string; + services: GridService[]; +}) { return ( -
      - {services.map((service) => ( - - ))} -
    +
    + + + + + + + + + {services.map((service) => ( + + ))} + +
    ServiceEnvironments
    +
    ); } @@ -176,34 +198,37 @@ function useNarrow() { } /** - * A run of tiles. On a phone, services that need nobody fold behind a + * A run of services. On a phone, services that need nobody fold behind a * closed disclosure that says how many are healthy ("All 8 healthy" when * nothing else is in the run) after the ones that need someone, so a screen - * holds what matters; a wide screen shows every tile. A `whole` run (a + * holds what matters; a wide screen shows every row. A `whole` run (a * catalog group) folds only when every service in it is healthy, and * otherwise stays open together. */ -function TileRun({ +function ServiceRun({ + label, services, healthy, narrow, whole = false, }: { + label: string; services: GridService[]; healthy: ReadonlySet; narrow: boolean; whole?: boolean; }) { - if (!narrow) return ; + if (!narrow) return ; const { open, settled } = foldHealthy(services, healthy, whole); return ( <> - {open.length > 0 && } + {open.length > 0 && } {settled.length > 0 && ( 2 ? "All " : ""}${String(settled.length)} healthy`} + bleed="inline" + title={`${open.length === 0 && settled.length > 2 ? "All " : ""}${String(settled.length)} healthy`} > - + )} @@ -211,66 +236,59 @@ function TileRun({ } /** - * One panel per catalog kind. Services the catalog groups alone come first - * as plain tiles; each group of several follows under its own heading. + * One section per catalog kind. Services the catalog groups alone come first + * in the kind's own table; each group of several follows as a nested section + * under its own heading. A section counts the rows directly under it and each + * group counts its own, so no service is counted twice. */ export function OverviewPanels({ panels }: { panels: KindPanel[] }) { const narrow = useNarrow(); return ( <> - {panels.map((panel) => { - const heading = `overview-${panel.kind}`; - return ( -
    -
    -

    {panel.title}

    - {/* The panel counts the tiles directly under it; each group - below counts its own, so no service is counted twice. */} - {panel.ungrouped.length > 0 && ( + {panels.map((panel) => ( +
    0 && ( + + ) + } + > + {panel.ungrouped.length > 0 && ( + + )} + {panel.groups.map((group) => ( +
    - )} -
    - {panel.ungrouped.length > 0 && ( - + - )} - {panel.groups.map((group) => { - const id = `overview-group-${group.id}`; - return ( -
    -
    -

    {group.title}

    - -
    - -
    - ); - })} -
    - ); - })} + + ))} + + ))} ); } diff --git a/packages/delivery/src/client/components/pager.tsx b/packages/delivery/src/client/components/pager.tsx index c8ed8845376..5e77c80529d 100644 --- a/packages/delivery/src/client/components/pager.tsx +++ b/packages/delivery/src/client/components/pager.tsx @@ -1,8 +1,53 @@ -import { Link } from "@tanstack/react-router"; +import { useRouter } from "@tanstack/react-router"; +import { Pager } from "@shepherdjerred/console-ui"; /** - * Keyset paging for a newest-first list: "Older" follows the page's cursor and - * "Newest" drops it. Every other search parameter is kept, so a filter + * console-ui's `Pager` for a newest-first list. The links are real anchors; a + * plain click navigates through the router, and a modified click or a middle + * click keeps the browser's own behaviour. + */ +export function RouterPager({ + newerHref, + olderHref, +}: { + newerHref?: string | undefined; + olderHref?: string | undefined; +}) { + const router = useRouter(); + if (newerHref === undefined && olderHref === undefined) return null; + return ( + ( + { + if ( + event.defaultPrevented || + event.button !== 0 || + event.metaKey || + event.ctrlKey || + event.shiftKey || + event.altKey + ) + return; + event.preventDefault(); + router.history.push(href); + }} + > + {children} + + )} + /> + ); +} + +/** + * Keyset paging for a newest-first list: "Older" follows the page's cursor + * and "Newest" drops it. Every other search parameter is kept, so a filter * survives paging. */ export function OlderLink({ @@ -14,18 +59,15 @@ export function OlderLink({ search: Record; cursor: string | null; }) { + const router = useRouter(); + const hrefFor = (next: string | undefined) => + router.buildLocation({ to, search: { ...search, cursor: next } }).href; return ( - + ); } diff --git a/packages/delivery/src/client/components/pipeline/stage-card.tsx b/packages/delivery/src/client/components/pipeline/stage-card.tsx index 5dfb10171d5..af2bb6d087d 100644 --- a/packages/delivery/src/client/components/pipeline/stage-card.tsx +++ b/packages/delivery/src/client/components/pipeline/stage-card.tsx @@ -6,7 +6,8 @@ import type { Transition, } from "#shared/hub/hub-contract.ts"; import { Status } from "#client/components/status.tsx"; -import { Duration, RelativeTime } from "#client/components/time.tsx"; +import { Elapsed } from "#client/components/moment.tsx"; +import { ButtonLink, RelativeTime } from "@shepherdjerred/console-ui"; import { ShortSha, TargetLink, ToolLinks } from "#client/components/links.tsx"; import { Disclosure } from "#client/components/disclosure.tsx"; import { @@ -79,9 +80,7 @@ export function ongoingWords(status: PipelineAction["status"]) { function ActionRow({ action }: { action: PipelineAction }) { const detail = actionDetail(action); return ( -
  3. +
  4. {interrupted(action) ? ( ) : ( - + )}
    - + {action.target === null ? ( action.title ) : ( {action.title} )} - {detail !== null &&

    {detail}

    } -

    + {detail !== null &&

    {detail}

    } +

    {action.startedAt !== null && ( <> {action.spanLabel !== undefined && `${action.spanLabel} `} - +

    -

    +

    {stage.environmentId === null ? ( stage.title ) : ( - + {stage.title} )} @@ -211,7 +212,11 @@ export function StageCard({ )} {collapsed !== null && ( - + + } > Promote… - + )}

    ); diff --git a/packages/delivery/src/client/components/primitives.test.tsx b/packages/delivery/src/client/components/primitives.test.tsx index f9c2bfc74ef..567ef0ec7c9 100644 --- a/packages/delivery/src/client/components/primitives.test.tsx +++ b/packages/delivery/src/client/components/primitives.test.tsx @@ -29,8 +29,10 @@ describe("Facts", () => { , ), ).toBe( - '
    Sync
    Synced
    ' + - '
    Revision
    0.0.0-fixture
    ', + '
    ' + + '
    Sync
    Synced
    ' + + '
    Revision
    ' + + '
    0.0.0-fixture
    ', ); }); }); @@ -38,26 +40,29 @@ describe("Facts", () => { describe("Disclosure", () => { it("is a closed native details whose summary carries its count", () => { const html = renderToStaticMarkup( - +

    Body

    , ); - expect(html).toMatch(/^
    /u); + expect(html).toMatch( + /^
    /u, + ); + expect(html).not.toContain("open="); expect(html).toContain( - 'Older candidates' + - '7', + 'Older candidates' + + '7', ); - expect(html).toContain('

    Body

    '); + expect(html).toContain('

    Body

    '); }); it("opens on request, shows no count without one and never groups by name", () => { const html = renderToStaticMarkup( - +

    Body

    , ); - expect(html).toContain('
    '); - expect(html).not.toContain("disclosure-count"); + expect(html).toContain('
    '); + expect(html).not.toContain("ui-count"); expect(html).not.toContain("name="); }); }); @@ -104,19 +109,19 @@ describe("Status", () => { const html = renderToStaticMarkup( , ); - expect(html).toContain('class="status status-failed" data-sev="error"'); + expect(html).toContain('class="ui-glyph" data-sev="error"'); expect(html).toContain('aria-hidden="true"'); expect(html).toContain("lucide-octagon-alert"); - expect(html).toContain('CI failed'); + expect(html).toContain('CI failed'); }); it("marks a state it has not seen yet with the unknown help glyph", () => { const html = renderToStaticMarkup( , ); - expect(html).toContain('class="status status-unknown" data-sev="unknown"'); + expect(html).toContain('class="ui-glyph" data-sev="unknown"'); expect(html).toContain("lucide-circle-help"); - expect(html).toContain('Not seen yet'); + expect(html).toContain('Not seen yet'); }); }); @@ -142,7 +147,10 @@ describe("DeploymentTable", () => { it("says so when there is nothing to list", () => { expect( renderWithRouter(), - ).toBe('

    None yet

    '); + ).toBe( + '
    ' + + 'None yet
    ', + ); }); it("names each link by what it opens, keeping its visible text", () => { @@ -161,7 +169,7 @@ describe("DeploymentTable", () => { ); expect(html).toContain('aria-label="Version set r4"'); // Narrow, each cell stacks under its label. - expect(html).toContain('class="table-scroll stack-table"'); + expect(html).toContain(''); expect(html).toContain('data-label="Requested"'); }); diff --git a/packages/delivery/src/client/components/receipt.tsx b/packages/delivery/src/client/components/receipt.tsx index e45b13df046..0dcd1331cd9 100644 --- a/packages/delivery/src/client/components/receipt.tsx +++ b/packages/delivery/src/client/components/receipt.tsx @@ -8,7 +8,7 @@ import { hasTrace, plainCause } from "#shared/evidence/plain-cause.ts"; import { Disclosure } from "./disclosure.tsx"; import { Fact, Facts } from "./facts.tsx"; import { Identifier } from "./identifier.tsx"; -import { RelativeTime } from "./time.tsx"; +import { RelativeTime } from "@shepherdjerred/console-ui"; function Value({ value }: { value: ReceiptValue }) { switch (value.kind) { @@ -34,9 +34,9 @@ function Value({ value }: { value: ReceiptValue }) { function FactList({ facts }: { facts: ReceiptFact[] }) { return ( - + {facts.map((fact) => ( - + ))} @@ -61,7 +61,7 @@ export function RecordedText({ return ( <> {words !== "" &&

    {words}

    } - +
    {text}
    @@ -76,19 +76,18 @@ export function RecordedText({ export function Receipt({ parsed }: { parsed: ParsedSummary }) { if (parsed.kind === "text") return ; - const short = parsed.facts.filter((fact) => !isWideValue(fact.value)); - const wide = parsed.facts.filter((fact) => isWideValue(fact.value)); + // Short values lead, in the grid's columns; a wide one takes a row of its own. + const facts = [ + ...parsed.facts.filter((fact) => !isWideValue(fact.value)), + ...parsed.facts.filter((fact) => isWideValue(fact.value)), + ]; return (
    - {short.length > 0 && } - {wide.length > 0 && ( -
    - -
    - )} + {facts.length > 0 && } {parsed.nested.length > 0 && ( entry.label).join(", ")} + bleed="inline" + title={parsed.nested.map((entry) => entry.label).join(", ")} > {parsed.nested.map((entry) => (
    diff --git a/packages/delivery/src/client/components/status.tsx b/packages/delivery/src/client/components/status.tsx index b79b9db9108..2866a67445f 100644 --- a/packages/delivery/src/client/components/status.tsx +++ b/packages/delivery/src/client/components/status.tsx @@ -1,4 +1,4 @@ -import type { Severity } from "@shepherdjerred/console-ui"; +import { StatusGlyph, type Severity } from "@shepherdjerred/console-ui"; import { BanIcon, CircleAlertIcon, @@ -12,18 +12,34 @@ import { PauseCircleIcon, type LucideIcon, } from "lucide-react"; -import type { ReactNode } from "react"; +import { forwardRef, type ComponentProps, type ReactNode } from "react"; + +/** The running glyph: `StatusGlyph` takes any icon, so this one turns, unless motion is unwelcome. */ +const RunningIcon: LucideIcon = forwardRef< + SVGSVGElement, + ComponentProps +>(({ className = "", ...props }, ref) => ( + +)); +RunningIcon.displayName = "RunningIcon"; type StatusMeta = { readonly severity: Severity; + /** The state's own glyph, where the severity's would blur two states. */ readonly icon: LucideIcon; }; -const DEFAULT_META: StatusMeta = { - severity: "unknown", - icon: CircleHelpIcon, -}; +const DEFAULT_META: StatusMeta = { severity: "unknown", icon: CircleHelpIcon }; +/** + * How each Delivery state reads: its console-ui severity and a glyph of its + * own, so running and watching (both "info"), or queued and awaiting approval + * (both "warning"), stay apart without colour. + */ const STATUS_META: Readonly> = { succeeded: { severity: "ok", icon: CircleCheckIcon }, verified: { severity: "ok", icon: CircleCheckIcon }, @@ -32,7 +48,7 @@ const STATUS_META: Readonly> = { failed: { severity: "error", icon: OctagonAlertIcon }, alarmed: { severity: "error", icon: CircleAlertIcon }, rejected: { severity: "error", icon: OctagonAlertIcon }, - running: { severity: "info", icon: LoaderCircleIcon }, + running: { severity: "info", icon: RunningIcon }, watching: { severity: "info", icon: InfoIcon }, awaiting_approval: { severity: "warning", icon: PauseCircleIcon }, queued: { severity: "warning", icon: ClockIcon }, @@ -49,17 +65,28 @@ export function statusLabel(value: string) { } /** - * Status as a console-ui severity glyph, words, and color, so no channel - * carries it alone. `value` picks the Lucide icon and `data-sev` severity; - * `label` replaces the words when a page has its own for that state, such as a + * A Delivery state as console-ui's `StatusGlyph`: glyph, words and colour, so + * no channel carries it alone. `value` picks the severity and glyph; `label` + * replaces the words when a page has its own for that state, such as a * commit's "Deployed" or "CI failed". */ -export function Status({ value, label }: { value: string; label?: ReactNode }) { - const { severity, icon: Icon } = STATUS_META[value] ?? DEFAULT_META; +export function Status({ + value, + label, + hideLabel = false, +}: { + value: string; + label?: ReactNode; + /** Shows the glyph alone; the words stay for a screen reader. */ + hideLabel?: boolean; +}) { + const { severity, icon } = STATUS_META[value] ?? DEFAULT_META; return ( - - + ); } diff --git a/packages/delivery/src/client/components/time.test.tsx b/packages/delivery/src/client/components/time.test.tsx deleted file mode 100644 index ae652d29d20..00000000000 --- a/packages/delivery/src/client/components/time.test.tsx +++ /dev/null @@ -1,81 +0,0 @@ -import { describe, expect, it } from "vitest"; -import { renderToStaticMarkup } from "react-dom/server"; -import { - ExactTime, - RelativeTime, - clockTime, - exactTime, - titleTime, - zoneLabel, -} from "./time.tsx"; - -const MOMENT = "2026-11-21T19:27:03.000Z"; - -/** The parts a formatted moment shows, in the reader's own zone and locale. */ -function parts(iso: string, options: Intl.DateTimeFormatOptions) { - return Object.fromEntries( - new Intl.DateTimeFormat(undefined, options) - .formatToParts(new Date(iso)) - .map((part) => [part.type, part.value]), - ); -} - -describe("exactTime", () => { - it("shows a local date and a 24-hour clock, to the minute or the second", () => { - const local = parts(MOMENT, { - hour: "2-digit", - minute: "2-digit", - second: "2-digit", - hourCycle: "h23", - }); - const minute = exactTime(MOMENT); - expect(minute).toContain( - `${String(local["hour"])}:${String(local["minute"])}`, - ); - expect(minute).not.toMatch(/\b(?:AM|PM)\b|T\d|Z$/u); - expect(minute).not.toContain(`:${String(local["second"])}`); - expect(exactTime(MOMENT, "second")).toContain( - `${String(local["hour"])}:${String(local["minute"])}:${String(local["second"])}`, - ); - expect(exactTime(MOMENT)).toContain("2026"); - }); -}); - -describe("clockTime", () => { - it("shows only the clock on the same local day, and the date on another", () => { - const at = Date.parse(MOMENT) + 60_000; - expect(clockTime(MOMENT, at)).not.toContain("2026"); - expect(clockTime(MOMENT, at)).toMatch(/^\d{2}:\d{2}:\d{2}$/u); - expect(clockTime(MOMENT, at + 3 * 86_400_000)).toBe( - exactTime(MOMENT, "second"), - ); - }); -}); - -describe("zoneLabel", () => { - it("names the reader's zone as its offset from UTC, and a title carries it", () => { - const zone = zoneLabel(MOMENT); - expect(zone).toMatch(/^UTC(?:[+-]\d{1,2}(?::\d{2})?)?$/u); - expect(titleTime(MOMENT)).toBe(`${exactTime(MOMENT, "second")} ${zone}`); - }); -}); - -describe("time elements", () => { - it("a relative time keeps the exact moment in its title, and shows its clock when asked", () => { - const plain = renderToStaticMarkup(); - expect(plain).toContain(`title="${titleTime(MOMENT)}"`); - expect(plain).not.toContain('class="clock"'); - const clock = renderToStaticMarkup(); - expect(clock).toContain(''); - expect(clock).toContain(''); - }); - - it("an exact time shows the app's format, and how far off a future one is", () => { - const past = renderToStaticMarkup(); - expect(past).toContain(`>${exactTime(MOMENT)}`); - const future = new Date(Date.now() + 6 * 3_600_000).toISOString(); - const ahead = renderToStaticMarkup(); - expect(ahead).toContain(exactTime(future)); - expect(ahead).toContain("in 6 hours"); - }); -}); diff --git a/packages/delivery/src/client/components/time.tsx b/packages/delivery/src/client/components/time.tsx deleted file mode 100644 index 0288edf3528..00000000000 --- a/packages/delivery/src/client/components/time.tsx +++ /dev/null @@ -1,183 +0,0 @@ -import { useSyncExternalStore } from "react"; - -const TICK_MS = 30_000; -const subscribers = new Set<() => void>(); -let now = Date.now(); -let ticker: ReturnType | undefined; - -function subscribe(listener: () => void) { - subscribers.add(listener); - ticker ??= setInterval(() => { - now = Date.now(); - for (const subscriber of subscribers) subscriber(); - }, TICK_MS); - return () => { - subscribers.delete(listener); - if (ticker !== undefined && subscribers.size === 0) { - clearInterval(ticker); - ticker = undefined; - } - }; -} - -/** A clock shared by every relative time on the page. */ -export function useNow() { - return useSyncExternalStore( - subscribe, - () => now, - () => now, - ); -} - -const relative = new Intl.RelativeTimeFormat(undefined, { numeric: "auto" }); -/** - * The app's one absolute format: the reader's local date and a 24-hour - * clock, to the minute or, where the order of nearby moments matters, to the - * second. - */ -const exactFormats = { - minute: new Intl.DateTimeFormat(undefined, { - dateStyle: "medium", - timeStyle: "short", - hourCycle: "h23", - }), - second: new Intl.DateTimeFormat(undefined, { - dateStyle: "medium", - timeStyle: "medium", - hourCycle: "h23", - }), -} as const; -const clockFormat = new Intl.DateTimeFormat(undefined, { - timeStyle: "medium", - hourCycle: "h23", -}); - -const zoneFormat = new Intl.DateTimeFormat(undefined, { - timeZoneName: "shortOffset", -}); - -export type TimePrecision = keyof typeof exactFormats; - -/** - * The reader's time zone as its offset from UTC at a moment, such as - * `UTC-8` or `UTC+5:30`, or `UTC` itself. Daylight saving moves it, so a - * label for many moments reads it at one of them. - */ -export function zoneLabel(at: string | number) { - const name = - zoneFormat - .formatToParts(new Date(at)) - .find((part) => part.type === "timeZoneName")?.value ?? "GMT"; - return name.replace(/^GMT/u, "UTC"); -} - -/** A moment to the second with its zone: what a time's `title` says. */ -export function titleTime(iso: string) { - return `${exactTime(iso, "second")} ${zoneLabel(iso)}`; -} - -/** A moment in the app's one absolute format, in the reader's time zone. */ -export function exactTime(iso: string, precision: TimePrecision = "minute") { - return exactFormats[precision].format(new Date(iso)); -} - -/** - * A moment as a clock reading to the second, so rows a minute apart still - * sort by eye; a moment on another local day than `at` keeps its date. - */ -export function clockTime(iso: string, at: number) { - const date = new Date(iso); - return date.toDateString() === new Date(at).toDateString() - ? clockFormat.format(date) - : exactFormats.second.format(date); -} -const UNITS: [Intl.RelativeTimeFormatUnit, number][] = [ - ["day", 86_400_000], - ["hour", 3_600_000], - ["minute", 60_000], -]; - -export function relativeTime(iso: string, at: number) { - const delta = Date.parse(iso) - at; - for (const [unit, size] of UNITS) - if (Math.abs(delta) >= size) - return relative.format(Math.round(delta / size), unit); - return "just now"; -} - -export function duration(startIso: string, endIso: string | null, at: number) { - const end = endIso === null ? at : Date.parse(endIso); - const seconds = Math.max(0, Math.round((end - Date.parse(startIso)) / 1000)); - if (seconds < 60) return `${String(seconds)}s`; - const minutes = Math.floor(seconds / 60); - return minutes < 60 - ? `${String(minutes)}m ${String(seconds % 60)}s` - : `${String(Math.floor(minutes / 60))}h ${String(minutes % 60)}m`; -} - -/** - * How long ago (or until) a moment is, with the exact moment in `title`. A - * list whose rows are ordered by reading them passes `clock` to show the - * clock reading inline as well, because a touch screen cannot hover a title. - */ -export function RelativeTime({ - value, - clock = false, -}: { - value: string; - clock?: boolean; -}) { - const at = useNow(); - return ( - - ); -} - -/** - * A moment people act on by its date (an expiry, a creation stamp) in the - * app's absolute format; a moment still ahead also says how far off it is. - */ -export function ExactTime({ - value, - precision = "minute", -}: { - value: string; - precision?: TimePrecision; -}) { - const at = useNow(); - return ( - - ); -} - -export function Duration({ - start, - end, - ongoing = "running", -}: { - start: string; - end: string | null; - /** What an unfinished span measures, such as "awaiting approval for". */ - ongoing?: string; -}) { - const at = useNow(); - return ( - - {end === null ? `${ongoing} ` : ""} - {duration(start, end, at)} - - ); -} diff --git a/packages/delivery/src/client/conformance-allowlist.json b/packages/delivery/src/client/conformance-allowlist.json index 69a7750c066..2e03db829eb 100644 --- a/packages/delivery/src/client/conformance-allowlist.json +++ b/packages/delivery/src/client/conformance-allowlist.json @@ -2,109 +2,85 @@ { "rule": "bare-element-selector", "file": "src/client/styles/base.css", - "count": 5, + "count": 4, "reason": "Baseline for the layer rule: move element defaults into @layer ui.app and drop other app layer names." }, { "rule": "font-family", "file": "src/client/styles/base.css", "count": 3, - "reason": "Baseline at CU1. Delivery moves onto the shared pieces in D1–D4." + "reason": "Baseline at CU1. Delivery moves onto the shared pieces in D1\u2013D4." }, { "rule": "local-copy", "file": "src/client/styles/base.css", "count": 1, - "reason": "Baseline at CU1. Delivery moves onto the shared pieces in D1–D4." + "reason": "Baseline at CU1. Delivery moves onto the shared pieces in D1\u2013D4." }, { "rule": "bare-element-selector", "file": "src/client/styles/components.css", - "count": 50, + "count": 29, "reason": "Baseline for the layer rule: move element defaults into @layer ui.app and drop other app layer names." }, { "rule": "colour-literal", "file": "src/client/styles/components.css", "count": 2, - "reason": "Baseline at CU1. Delivery moves onto the shared pieces in D1–D4." + "reason": "Baseline at CU1. Delivery moves onto the shared pieces in D1\u2013D4." }, { "rule": "font-family", "file": "src/client/styles/components.css", - "count": 3, - "reason": "Baseline at CU1. Delivery moves onto the shared pieces in D1–D4." - }, - { - "rule": "local-copy", - "file": "src/client/styles/components.css", - "count": 3, - "reason": "Baseline at CU1. Delivery moves onto the shared pieces in D1–D4." + "count": 1, + "reason": "Baseline at CU1. Delivery moves onto the shared pieces in D1\u2013D4." }, { "rule": "bare-element-selector", "file": "src/client/styles/deployment.css", - "count": 6, + "count": 4, "reason": "Baseline for the layer rule: move element defaults into @layer ui.app and drop other app layer names." }, { "rule": "font-family", "file": "src/client/styles/deployment.css", - "count": 2, - "reason": "Baseline at CU1. Delivery moves onto the shared pieces in D1–D4." + "count": 1, + "reason": "Baseline at CU1. Delivery moves onto the shared pieces in D1\u2013D4." }, { "rule": "bare-element-selector", "file": "src/client/styles/environment.css", - "count": 17, + "count": 10, "reason": "Baseline for the layer rule: move element defaults into @layer ui.app and drop other app layer names." }, { "rule": "bare-element-selector", "file": "src/client/styles/layout.css", - "count": 29, + "count": 11, "reason": "Baseline for the layer rule: move element defaults into @layer ui.app and drop other app layer names." }, { "rule": "font-family", "file": "src/client/styles/layout.css", "count": 1, - "reason": "Baseline at CU1. Delivery moves onto the shared pieces in D1–D4." + "reason": "Baseline at CU1. Delivery moves onto the shared pieces in D1\u2013D4." }, { "rule": "local-copy", "file": "src/client/styles/layout.css", - "count": 11, - "reason": "Baseline at CU1. Delivery moves onto the shared pieces in D1–D4." + "count": 10, + "reason": "Baseline at CU1. Delivery moves onto the shared pieces in D1\u2013D4." }, { "rule": "shared-class-patch", "file": "src/client/styles/layout.css", "count": 1, - "reason": "Baseline at CU1. Delivery moves onto the shared pieces in D1–D4." - }, - { - "rule": "bare-element-selector", - "file": "src/client/styles/overview.css", - "count": 3, - "reason": "Baseline for the layer rule: move element defaults into @layer ui.app and drop other app layer names." - }, - { - "rule": "bare-element-selector", - "file": "src/client/styles/pipeline.css", - "count": 11, - "reason": "Baseline for the layer rule: move element defaults into @layer ui.app and drop other app layer names." - }, - { - "rule": "font-family", - "file": "src/client/styles/pipeline.css", - "count": 1, - "reason": "Baseline at CU1. Delivery moves onto the shared pieces in D1–D4." + "reason": "Baseline at CU1. Delivery moves onto the shared pieces in D1\u2013D4." }, { "rule": "colour-literal", "file": "src/client/styles/tokens.css", "count": 2, - "reason": "Baseline at CU1. Delivery moves onto the shared pieces in D1–D4." + "reason": "Baseline at CU1. Delivery moves onto the shared pieces in D1\u2013D4." } ] diff --git a/packages/delivery/src/client/content-recovery.tsx b/packages/delivery/src/client/content-recovery.tsx index 482ce8997fd..e1babe150ba 100644 --- a/packages/delivery/src/client/content-recovery.tsx +++ b/packages/delivery/src/client/content-recovery.tsx @@ -1,6 +1,7 @@ import type { DeploymentDetail } from "#shared/contract.ts"; import { NativeIntentHeading } from "./native-intent-heading.tsx"; -import { ExactTime } from "#client/components/time.tsx"; +import { Deadline } from "#client/components/moment.tsx"; +import { Notice } from "#client/components/notices.tsx"; type RecoveryDetail = { pipeline: Pick; @@ -27,7 +28,7 @@ export function ContentRecovery({ detail }: { detail: RecoveryDetail }) { Independent {forum ? "forum" : "site"} recovery {detail.deployment.recoveryRequired && ( -
    +

    An administrator can request native inspection and bounded repair of this frozen release. Ownership stays locked until the original @@ -39,7 +40,7 @@ export function ContentRecovery({ detail }: { detail: RecoveryDetail }) { not accept a deployment or reverse a database upgrade.

    {`toolkit deploy ${domain} recover ${detail.deployment.id} --machine --expected-generation ${String(detail.environment.generation)} --reason "Inspect and settle the exact frozen release under retained ownership"`}
    -
    + )}
    @@ -60,15 +61,15 @@ export function ContentRecovery({ detail }: { detail: RecoveryDetail }) { {intent.dispatchBarrier !== null && intent.barrierRestoredAt === null && ( -

    + Pending producer restoration. The original Activity host must be restored through its exact native journal before dispatch can resume. -

    + )} Requested by {intent.requestedBy} ·{" "} - +
    Frozen recovery operation and native receipts diff --git a/packages/delivery/src/client/deployment-detail.tsx b/packages/delivery/src/client/deployment-detail.tsx index 88066508e9c..0ee17f60058 100644 --- a/packages/delivery/src/client/deployment-detail.tsx +++ b/packages/delivery/src/client/deployment-detail.tsx @@ -3,7 +3,7 @@ import type { Principal, } from "#shared/contract.ts"; import type { DeploymentDetailV2 } from "#shared/model/contract.ts"; -import { isTerminal, messageNotice } from "./presentation.ts"; +import { isTerminal, messageTone } from "./presentation.ts"; import { SelectedArtifacts } from "./artifacts.tsx"; import { FrozenWorkerPool } from "./worker-pool.tsx"; import { FrozenPlatform } from "./frozen-platform.tsx"; @@ -17,6 +17,7 @@ import { ContentRecovery } from "./content-recovery.tsx"; import { Disclosure } from "#client/components/disclosure.tsx"; import { DeploymentEvidence, StepTimeline } from "./deployment-steps.tsx"; import { explainsFailure } from "./model/deployment-outcome.tsx"; +import { Notice } from "#client/components/notices.tsx"; export function sourceLabel(detail: Detail) { const deployment = detail.deployment; @@ -45,20 +46,20 @@ function FrozenInputs({ detail }: { detail: Detail }) { deployment.platformSnapshot === null ? ( ) : ( - + ) ) : ( - + )} {deployment.workerSnapshot !== null && ( )} - +
               
                 {JSON.stringify(
    @@ -108,12 +109,14 @@ export function DeploymentRecord({
       return (
         <>
           {message !== null && (
    -        

    {message}

    + + {message} + )} {deployment.cancelRequested && !isTerminal(deployment) && ( -

    + Cancellation requested. Waiting for the next safe boundary. -

    + )} { it("lists every step with its status and its operation id in short form", () => { expect(steps(html)).toHaveLength(5); - expect(step(html, "step-sync")).toContain("status-failed"); + expect(step(html, "step-sync")).toContain('data-sev="error"'); expect(step(html, "step-plan")).toContain( `title="delivery-${"9".repeat(40)}"`, ); @@ -148,7 +148,7 @@ describe("the step timeline", () => { it("nests each step's own evidence beneath it, with a count", () => { const plan = step(html, "step-plan"); - expect(plan).toContain('2'); + expect(plan).toContain('2'); expect(plan).toContain("tofu"); expect(plan).not.toContain("Application left Degraded"); expect(step(html, "step-sync")).toContain("Application left Degraded"); @@ -158,12 +158,14 @@ describe("the step timeline", () => { }); it("folds a succeeded step's evidence and opens a failed or running one", () => { - expect(step(html, "step-plan")).toContain('
    '); + expect(step(html, "step-plan")).toContain( + '
    ', + ); expect(step(html, "step-sync")).toContain( - '
    ', + '
    ', ); expect(step(html, "step-sync/drain")).toContain( - '
    ', + '
    ', ); }); @@ -190,7 +192,7 @@ describe("the step timeline", () => { 'worker-rollout-plan', ); expect(plan).toMatch( - /
    Plan<\/span><\/summary>.*
    \{\n {2}"target": "scout-prod"/su,
    +      /Plan<\/span><\/summary>.*
    \{\n {2}"target": "scout-prod"/su,
         );
       });
     
    @@ -265,7 +267,7 @@ describe("the evidence no listed step recorded", () => {
         const [visible = "", folded = ""] = rendered.split("3');
    +    expect(folded).toContain('3');
         expect(folded).toContain("finish evidence 7");
       });
     
    @@ -310,7 +312,7 @@ describe("the deployment record", () => {
         expect(inputs).toContain(base.pipeline.id);
         expect(inputs).toContain("Selected artifacts");
         expect(inputs).toContain("Pinned pipeline and configuration");
    -    expect(inputs).not.toContain('
    <\/summary>.*
    /su,
         );
    @@ -344,8 +346,8 @@ describe("a step its deployment outlived", () => {
         const sync = step(html, "step-sync");
         expect(sync).toMatch(/^step-interrupted"/u);
         expect(sync).toContain("interrupted · outcome unknown");
    -    expect(sync).not.toContain("status-running");
    -    expect(step(html, "step-plan")).toContain("status-succeeded");
    +    expect(sync).not.toContain("lucide-loader-circle");
    +    expect(step(html, "step-plan")).toContain('data-sev="ok"');
       });
     
       it("stops its clock at the deployment's end", () => {
    @@ -943,7 +945,7 @@ describe("what a failed deployment says while a newer request waits, and about t
         );
         // The excerpt and frames appear only inside the collapsed disclosure.
         const [prose = "", disclosure = ""] = html.split(
    -      '
    { it("opens no disclosure on the raw text", () => { const html = render(); - const opening = /
    /gu; + const opening = /
    /gu; const raw = html.split("Full error text"); expect(raw.length).toBeGreaterThan(1); // The tag just before each "Full error text" summary carries no `open`. diff --git a/packages/delivery/src/client/deployment-steps.tsx b/packages/delivery/src/client/deployment-steps.tsx index df06281aeed..e78f0362233 100644 --- a/packages/delivery/src/client/deployment-steps.tsx +++ b/packages/delivery/src/client/deployment-steps.tsx @@ -6,7 +6,8 @@ import { Disclosure } from "#client/components/disclosure.tsx"; import { Identifier } from "#client/components/identifier.tsx"; import { Receipt } from "#client/components/receipt.tsx"; import { Status } from "#client/components/status.tsx"; -import { Duration, RelativeTime } from "#client/components/time.tsx"; +import { Elapsed } from "#client/components/moment.tsx"; +import { RelativeTime } from "@shepherdjerred/console-ui"; import { readbackApplications, readbackPhase, @@ -86,7 +87,7 @@ function EvidenceList({ <>
      {visible.map((item) => entry(item))}
    {rest.length > 0 && ( - +
      {rest.map((item) => entry(item))}
    )} @@ -230,7 +231,7 @@ export function StepTimeline({ reading={reading} /> {stage.startedAt !== null && ( - @@ -247,9 +248,10 @@ export function StepTimeline({ )} {(items.length > 0 || record !== null) && ( 0 ? "Evidence" : "Step message"} + bleed="inline" + title={items.length > 0 ? "Evidence" : "Step message"} {...(items.length > 0 ? { count: items.length } : {})} - open={stage.status !== "succeeded"} + defaultOpen={stage.status !== "succeeded"} > {record !== null && (
    diff --git a/packages/delivery/src/client/forms/approval-form.tsx b/packages/delivery/src/client/forms/approval-form.tsx index 19b961f97ba..46f52edd04d 100644 --- a/packages/delivery/src/client/forms/approval-form.tsx +++ b/packages/delivery/src/client/forms/approval-form.tsx @@ -1,6 +1,6 @@ import type { SubmitEvent } from "react"; import { useMutation } from "@tanstack/react-query"; -import { errorMessage } from "#client/components/notices.tsx"; +import { Notice, errorMessage } from "#client/components/notices.tsx"; import { ConfirmButton } from "#client/components/confirm-dialog.tsx"; import { ReasonField, useReason } from "./decision.tsx"; @@ -41,19 +41,19 @@ export function ApprovalForm({ frozen worker pool or saved platform plan when present.

    {override && ( -

    + This deploy asked for an override: its set revision is not eligible for an ordinary deploy, so approving it is recorded as an override. -

    + )} {decide.error !== null && ( -

    + {errorMessage(decide.error)} -

    + )}
    ', + expect(html).toMatch( + /]*aria-describedby="row-1"[^>]*>Cancel<\/button>/u, ); - expect(html).toContain( - '', + expect(html).toMatch( + /]*disabled=""[^>]*data-variant="danger"[^>]*>Retire<\/button>/u, ); // A waiting button reads as disabled without being disabled, so it can // keep the focus the closing dialog returned to it. - expect(html).toContain( - '', - ); - }); - - it("a confirm button outside the dialog's provider fails loudly", () => { - expect(() => - renderToStaticMarkup( - { - // Static render only. - }} - > -

    Body

    -
    , - ), - ).toThrow("ConfirmDialogProvider"); - }); - - it("the dialog's question defaults to keeping state", () => { - const html = question(false); - expect(html).toContain('

    Cancel this?

    '); - expect(html).toContain('

    Body

    '); - expect(html).toMatch(/autofocus[^>]*>Keep as is/iu); - // "Keep as is" comes first, so it is also the first control in tab order. expect(html).toMatch( - /', + expect(html).not.toMatch( + /]*[^-]disabled=""[^>]*>Rebind<\/button>/u, ); }); - - it("formats relative times and durations", () => { - const now = Date.parse("2026-10-18T12:00:00.000Z"); - expect(relativeTime("2026-10-18T11:58:00.000Z", now)).toBe("2 minutes ago"); - expect( - duration("2026-10-18T11:00:00.000Z", "2026-10-18T12:05:00.000Z", now), - ).toBe("1h 5m"); - expect(duration("2026-10-18T11:59:30.000Z", null, now)).toBe("30s"); - }); }); describe("trace source stage", () => { diff --git a/packages/delivery/src/client/model/approval-queue.test.tsx b/packages/delivery/src/client/model/approval-queue.test.tsx index a27dac04bec..c7cda7cbc1c 100644 --- a/packages/delivery/src/client/model/approval-queue.test.tsx +++ b/packages/delivery/src/client/model/approval-queue.test.tsx @@ -32,9 +32,10 @@ describe("the approval queue", () => { ); expect(html).toContain('r44'); expect(html).toContain('aria-label="Version set r44"'); - // The waiting panel stands apart and counts what it holds. - expect(html).toContain('class="panel panel-waiting"'); - expect(html).toContain(' (1)'); + // The waiting section leads and counts what it holds. + expect(html).toMatch( + /^
    ]*>
    ]*>Waiting for a decision<\/h2>1<\/span>/u, + ); }); it("says an id the catalog does not hold as words, with the slug in the title", () => { @@ -90,9 +91,9 @@ describe("the approval queue", () => { ]} />, ); - expect(html).toContain('class="status status-awaiting_approval"'); + expect(html).toContain(''); expect(html).toContain( - 'awaiting approval', + 'awaiting approval', ); expect(html).not.toContain(">pending<"); }); @@ -134,17 +135,15 @@ describe("the approval queue", () => { (item) => item.approval?.status === "expired", ); expect(expired.length).toBeGreaterThan(0); - const section = html.slice( - html.indexOf('aria-labelledby="expired-heading"'), - ); - expect(section).toMatch(/
    /u); - expect(section).not.toContain('
    Expired")); + expect(section).toMatch(/
    /u); + expect(section).not.toContain('
    ${String(expired.length)}`, + `${String(expired.length)}`, ); - if (html.includes("decided-heading")) - expect(html.indexOf("decided-heading")).toBeLessThan( - html.indexOf("expired-heading"), + if (html.includes(">Recently decided")) + expect(html.indexOf(">Recently decided")).toBeLessThan( + html.indexOf(">Expired"), ); }); }); diff --git a/packages/delivery/src/client/model/approval-queue.tsx b/packages/delivery/src/client/model/approval-queue.tsx index 7a9c6f52667..30d6f4cfe6a 100644 --- a/packages/delivery/src/client/model/approval-queue.tsx +++ b/packages/delivery/src/client/model/approval-queue.tsx @@ -1,11 +1,12 @@ import { Link } from "@tanstack/react-router"; +import { Chip, Section, State } from "@shepherdjerred/console-ui"; import type { ApprovalQueueItem } from "#shared/model/contract.ts"; import { Status } from "#client/components/status.tsx"; import { RelativeTime, - relativeTime, + formatRelative, useNow, -} from "#client/components/time.tsx"; +} from "@shepherdjerred/console-ui"; import { Identifier, Revision, @@ -103,10 +104,10 @@ function ApprovalState({ item }: { item: ApprovalQueueItem }) { {item.approval?.override === true && ( - Override + Override )} {item.awaitingPlanDecision && ( - Saved plan awaits decision + Saved plan awaits decision )} ); @@ -161,12 +162,12 @@ function ApprovalRow({ const release = number === undefined ? "" : ` ${revisionLabel(number)}`; return (
    - - - ); @@ -199,9 +204,9 @@ function ApprovalTable({ names: Names; }) { return ( -
    -
    + {names.service(item)} · {names.environment(item)} @@ -178,12 +179,16 @@ function ApprovalRow({ - + +
    + +
    - - {item.requestedBy} + +
    + + {item.requestedBy} +
    - +
    +
    {caption}
    + @@ -243,23 +248,17 @@ export function ApprovalQueue({ item.approval?.status === "rejected", ); return ( - <> -
    +
    0 ? { count: waiting.length } : {})} > -

    - Waiting for a decision - {waiting.length > 0 && ( - ({waiting.length}) - )} -

    {waiting.length === 0 ? ( -

    Nothing is waiting for approval.

    + Nothing is waiting for approval. ) : ( <> {waiting.some((item) => item.approval?.override === true) && ( -

    +

    An override approval admits a set revision that is not eligible for an ordinary deploy.

    @@ -271,33 +270,35 @@ export function ApprovalQueue({ /> )} -
    +
    {decided.length > 0 && ( -
    -

    Recently decided

    +
    -
    +
    )} {expired.length > 0 && ( -
    -

    Expired

    -

    +

    +

    An approval expires when the environment's binding generation moves after the request; request the release again to decide it.

    - + -
    +
    )} - + ); } diff --git a/packages/delivery/src/client/model/deployment-model.tsx b/packages/delivery/src/client/model/deployment-model.tsx index 8e89d7347ba..845190adb44 100644 --- a/packages/delivery/src/client/model/deployment-model.tsx +++ b/packages/delivery/src/client/model/deployment-model.tsx @@ -8,7 +8,7 @@ import type { import { queries } from "#client/queries.ts"; import { Status } from "#client/components/status.tsx"; import { revisionLabel } from "#client/components/identifier.tsx"; -import { RelativeTime } from "#client/components/time.tsx"; +import { Chip, RelativeTime } from "@shepherdjerred/console-ui"; import { specializedRecoveryShown } from "./view.ts"; import { DeploymentLink, @@ -17,6 +17,7 @@ import { deploymentRevisions, } from "./selection-facts.tsx"; import { Fact, Facts } from "#client/components/facts.tsx"; +import { Notice } from "#client/components/notices.tsx"; function FrozenSelection({ detail }: { detail: DeploymentDetailV2 }) { const { deployment } = detail; @@ -99,9 +100,7 @@ function ApprovalRecord({ approval }: { approval: ApprovalV2 }) {

    Approval

    - {approval.override && ( - Override - )} + {approval.override && Override}

    {approval.actor ?? "Not decided"} @@ -120,10 +119,10 @@ function ApprovalRecord({ approval }: { approval: ApprovalV2 }) { )} {approval.status === "expired" && ( -

    + This approval expired: the environment's binding generation moved after the request, so it no longer binds the frozen selection. -

    + )} {approval.override && (

    diff --git a/packages/delivery/src/client/model/deployment-outcome.tsx b/packages/delivery/src/client/model/deployment-outcome.tsx index 47f4162b74c..22894644539 100644 --- a/packages/delivery/src/client/model/deployment-outcome.tsx +++ b/packages/delivery/src/client/model/deployment-outcome.tsx @@ -1,3 +1,4 @@ +import { Notice } from "#client/components/notices.tsx"; import type { ReactNode } from "react"; import { Link } from "@tanstack/react-router"; import type { DeploymentDetailV2 } from "#shared/model/contract.ts"; @@ -469,7 +470,7 @@ export function SupersededNote({ detail }: { detail: Detail }) { ) return null; return ( -

    + -
    + ); } @@ -515,9 +516,8 @@ function FailureCause({ story }: { story: Story }) { )} {story.traces.length > 0 && ( 1 ? { count: story.traces.length } : {})} + title="Full error text" + count={story.traces.length > 1 ? story.traces.length : undefined} > {story.traces.map((trace) => (
    diff --git a/packages/delivery/src/client/model/environment-model.tsx b/packages/delivery/src/client/model/environment-model.tsx
    index 1612d47b07c..9596c25c814 100644
    --- a/packages/delivery/src/client/model/environment-model.tsx
    +++ b/packages/delivery/src/client/model/environment-model.tsx
    @@ -14,7 +14,8 @@ import { queries } from "#client/queries.ts";
     import { ConfirmButton } from "#client/components/confirm-dialog.tsx";
     import { Disclosure } from "#client/components/disclosure.tsx";
     import { Identifier, shortIdentifier } from "#client/components/identifier.tsx";
    -import { RelativeTime } from "#client/components/time.tsx";
    +import { ClockTime } from "#client/components/moment.tsx";
    +import { Chip, RelativeTime } from "@shepherdjerred/console-ui";
     import { MonitorPanel } from "./monitor-panel.tsx";
     import {
       DeploymentLink,
    @@ -38,6 +39,7 @@ import {
       requestsRefused,
     } from "./environment-notices.tsx";
     import { Fact, Facts } from "#client/components/facts.tsx";
    +import { Notice } from "#client/components/notices.tsx";
     
     type Requested = Awaited>;
     type Actions = {
    @@ -203,9 +205,9 @@ function SelectionPanel({
             
           
           {refused !== null && (
    -        

    + {refused} -

    + )} ); @@ -231,7 +233,7 @@ function CandidateOrigin({ return (
    Accepted {deployments.length} times, last{" "} @@ -241,7 +243,7 @@ function CandidateOrigin({
      {deployments.map((entry) => (
    • - by deployment{" "} + by deployment{" "}
    • ))} @@ -293,9 +295,7 @@ function Candidate({ · recipe {selection.recipeRevisionId}{" "} · configuration{" "} {selection.configurationRevisionId} - {current && ( - Accepted now - )} + {current && Accepted now}

    @@ -405,16 +405,16 @@ function RollbackCandidates({ or cross a point-of-no-return step.

    {refused !== null && ( -

    + {refused} -

    + )} {request.error !== null && ( )} {list(shown, 1)} {older.length > 0 && ( - + {list(older, shown.length + 1)} )} diff --git a/packages/delivery/src/client/model/environment-notices.tsx b/packages/delivery/src/client/model/environment-notices.tsx index 18e20ffca2d..147534549b6 100644 --- a/packages/delivery/src/client/model/environment-notices.tsx +++ b/packages/delivery/src/client/model/environment-notices.tsx @@ -5,7 +5,7 @@ import { DeliveryClientError } from "#shared/client.ts"; import type { Deployment } from "#shared/contract.ts"; import { queries } from "#client/queries.ts"; import { Status } from "#client/components/status.tsx"; -import { errorMessage } from "#client/components/notices.tsx"; +import { Notice, errorMessage } from "#client/components/notices.tsx"; import { DeploymentLink, SetRevision, @@ -132,15 +132,15 @@ export function EnvironmentNotice({ if (!requestsRefused({ permitted, blocker })) return null; if (blocker === null) return ( -

    + {READ_ONLY} Requesting a release, rebinding and rolling back are refused. -

    + ); const link = ; if (blocker.kind === "locked") return ( -
    +

    Recovery required: deployment {link} failed and this environment is locked. @@ -151,17 +151,17 @@ export function EnvironmentNotice({ are refused. {permitted ? "" : ` ${READ_ONLY}`}

    -
    + ); return ( -

    + In flight: deployment {link}{" "} {blocker.kind === "held" ? "holds this environment." : `is ${inFlightWords(blocker.deployment.status, planWaiting)}${blocker.behind > 0 ? ` and ${String(blocker.behind)} more wait behind it` : ""}.`}{" "} Requests, rebinds and rollbacks are refused until it finishes or is canceled.{permitted ? "" : ` ${READ_ONLY}`} -

    + ); } @@ -293,7 +293,7 @@ export function RequestError({ const conflict = error instanceof DeliveryClientError && error.code === "CONFLICT"; return ( - + ); } diff --git a/packages/delivery/src/client/model/environment-status.ts b/packages/delivery/src/client/model/environment-status.ts index 72098e0f325..58e8982fd7c 100644 --- a/packages/delivery/src/client/model/environment-status.ts +++ b/packages/delivery/src/client/model/environment-status.ts @@ -1,6 +1,6 @@ import type { Deployment, VersionSetRevision } from "#shared/contract.ts"; import { isTerminal } from "#client/presentation.ts"; -import { relativeTime } from "#client/components/time.tsx"; +import { formatRelative } from "@shepherdjerred/console-ui"; import { revisionLabel } from "#client/components/identifier.tsx"; /** @@ -107,7 +107,7 @@ export function versionOptionLabel(version: VersionSetRevision, now: number) { source !== undefined && sources.size === 1 ? source.slice(0, 7) : "composed"; - return `${revisionLabel(version.revision)} · ${origin} · ${relativeTime(version.createdAt, now)}`; + return `${revisionLabel(version.revision)} · ${origin} · ${formatRelative(version.createdAt, now)}`; } /** At most two decimals, and none for a whole number: `55.42`, not `55.42128888888888`. */ diff --git a/packages/delivery/src/client/model/model-views.test.tsx b/packages/delivery/src/client/model/model-views.test.tsx index b6657c6b42e..31537a939e9 100644 --- a/packages/delivery/src/client/model/model-views.test.tsx +++ b/packages/delivery/src/client/model/model-views.test.tsx @@ -5,7 +5,6 @@ import * as fixtures from "#testing/model-fixtures.ts"; import { PipelineDefinitionSchema } from "#shared/contract.ts"; import { renderWithRouter } from "#client/test-router.tsx"; import { queries } from "#client/queries.ts"; -import { ConfirmDialogProvider } from "#client/components/confirm-dialog.tsx"; import { ApprovalQueue } from "./approval-queue.tsx"; import { DeploymentModel } from "./deployment-model.tsx"; import { EnvironmentModel } from "./environment-model.tsx"; @@ -51,23 +50,18 @@ function markup(node: ReactNode) { return renderWithRouter(node).replaceAll("", ""); } -const CLOSED_DIALOG = ''; - /** - * What a component renders below the page's providers. The page's one - * confirmation dialog follows it, closed, and no confirm button adds another. + * What a component renders below the page's providers. A closed confirmation + * renders nothing, so no confirm button adds a dialog to the markup. */ function render(node: ReactNode, seed?: (client: QueryClient) => void) { const client = new QueryClient(); seed?.(client); const html = markup( - - {node} - , + {node}, ); - expect(html.match(/` of the rendered candidate list. */ @@ -377,11 +371,11 @@ describe("environment model panels", () => { expect(candidateItems(shown)).toHaveLength(5); expect(candidateItems(older)).toHaveLength(3); expect(older).toContain( - 'Older candidates3', + 'Older candidates3', ); // The collapsed list is closed, continues the numbering, and still // offers every older candidate. - expect(older).toMatch(/^ class="disclosure">/u); + expect(older).toMatch(/^ class="ui-disclosure">/u); expect(older).toContain('
      '); for (const id of ["deployment-6", "deployment-7", "deployment-8"]) expect(older).toContain(`href="/deployments/${id}"`); @@ -404,7 +398,7 @@ describe("environment model panels", () => { expect(visible[5]).toContain("Accepted now"); expect(visible[5]).toContain(">Re-assert this selection"); expect(older).not.toContain("deployment-7"); - expect(older).toContain('2'); + expect(older).toContain('2'); expect(older).toContain('
        '); }); @@ -476,10 +470,10 @@ describe("environment model panels", () => { />, ); expect(settled).toMatch( - /

        Settled .*every evidence count/u, + /

        .*Settled .*every evidence count/su, ); expect(markup()).toMatch( - /

        An alarm fired/u, + /

        .*An alarm fired/su, ); }); }); @@ -620,8 +614,8 @@ describe("deployment model", () => { describe("approval queue", () => { test("separates waiting, override and expired approvals", () => { const html = markup(); - const waiting = html.slice(0, html.indexOf("expired-heading")); - const expired = html.slice(html.indexOf("expired-heading")); + const waiting = html.slice(0, html.indexOf(">Expired")); + const expired = html.slice(html.indexOf(">Expired")); expect(waiting).toContain("scout-prod-44"); expect(waiting).toContain("Override"); expect(expired).toContain("scout-prod-36"); @@ -796,8 +790,9 @@ describe("what stops an environment from taking a request", () => { , ); expect(notice).toMatch( - /^
        /u, + /^
        /u, ); + expect(notice).toContain('id="environment-refusal"'); expect(notice).toContain("Recovery required: deployment"); expect(notice).toContain('href="/deployments/scout-prod-37"'); expect(notice).toContain("A change may still be running outside Delivery"); @@ -823,7 +818,7 @@ describe("what stops an environment from taking a request", () => { expect( markup(), ).toMatch( - /^

        In flight:<\/strong> deployment .*is awaiting approval and 1 more wait behind it\. Requests, rebinds and rollbacks are refused until it finishes or is canceled\./u, + /^

        .*In flight:<\/strong> deployment .*is awaiting approval and 1 more wait behind it\. Requests, rebinds and rollbacks are refused until it finishes or is canceled\./su, ); const summary = markup( { ); expect(summary).toContain("In flight:"); expect(summary).toContain("awaiting plan approval"); - expect(summary).toContain('class="status status-awaiting_approval"'); + expect(summary).toContain('data-sev="warning"'); expect(markup()).toBe(""); }); @@ -854,7 +849,7 @@ describe("what stops an environment from taking a request", () => { ); expect(summary).toContain("Nothing in flight · "); expect(summary).toContain(`href="/deployments/${failed.id}"`); - expect(summary).toContain('class="status status-failed"'); + expect(summary).toContain('data-sev="error"'); expect(summary).toMatch(/newest release .*failed/u); // A failure that accepted nothing newer is the newest; one before a success is not. expect( @@ -876,7 +871,7 @@ describe("what stops an environment from taking a request", () => { expect(items.every((item) => item.includes('disabled=""'))).toBe(true); expect(html).toMatch(/]*disabled=""[^>]*>Rebind'); expect( html.match(new RegExp(`aria-describedby="[^"]*${REFUSAL_ID}"`, "gu")), ).not.toBeNull(); @@ -937,7 +932,7 @@ describe("the release form invites only a request that can succeed", () => { expect(html).toContain( ``, ); - expect(html).not.toContain('class="notice"'); + expect(html).not.toContain('
        '); }); test("beside a refused request button stands why it is refused, not what a request would do", () => { @@ -1061,7 +1056,7 @@ describe("the release form invites only a request that can succeed", () => { expect(inSight).toContain("2026.10.22"); expect(inSight).not.toContain("sha256:"); expect(folded).toContain( - 'Digests1', + 'Digests1', ); expect(folded).toContain("sha256:"); }); @@ -1108,9 +1103,9 @@ describe("human decisions", () => { expect(html).toMatch( /
        ) : ( -

        + A human with approval access must approve or reject this plan. -

        + )} ); diff --git a/packages/delivery/src/client/overview.test.tsx b/packages/delivery/src/client/overview.test.tsx index 7ca3a702267..e23751a15f2 100644 --- a/packages/delivery/src/client/overview.test.tsx +++ b/packages/delivery/src/client/overview.test.tsx @@ -12,6 +12,7 @@ import { OverviewPanels } from "./components/overview-panels.tsx"; import { foldHealthy, kindPanels, + overviewFigures, serviceStanding, standingCounts, } from "./routes/overview-model.ts"; @@ -180,6 +181,17 @@ describe("overview panels model", () => { expect(filtered({ q: "no such service" })).toEqual([]); }); + it("sums the figure strip by each service's most urgent standing, and marks only the non-zero ones", () => { + const figures = overviewFigures(GROUPS.flatMap((entry) => entry.services)); + expect(figures).toEqual([ + { label: "Services", value: 10 }, + { label: "Healthy", value: 5, severity: "ok" }, + { label: "Running", value: 0 }, + { label: "Waiting on someone", value: 1, severity: "warning" }, + { label: "Failing", value: 2, severity: "error" }, + ]); + }); + it("counts services by standing, settled first, then by urgency", () => { const [products, platform] = kindPanels(GROUPS, []); expect(standingCounts(products?.services ?? [])).toEqual([ @@ -249,7 +261,7 @@ describe("folding healthy services on a phone", () => { function tally(html: string, label: string) { const start = html.indexOf(`aria-label="${label}">`); const list = html.slice(start, html.indexOf("", start)); - return [...list.matchAll(/status-label">(?[^<]+)/gu)].map( + return [...list.matchAll(/ui-glyph-label">(?[^<]+)/gu)].map( (match) => match.groups?.["words"], ); } @@ -260,27 +272,27 @@ describe("overview panels markup", () => { ); it("names each kind panel and each group of several by its heading", () => { - expect(html).toContain( - '
        ', + expect(html).toMatch( + /

        Products<\/h2>/u, ); - expect(html).toContain('

        Products

        '); - expect(html).toContain( - '
        ', + expect(html).toMatch( + /

        Group sites<\/h3>/u, ); - expect(html).toContain('

        Group sites

        '); - // A lone service is a tile with no group heading of its own. + expect(html).toContain(">Products"); + expect(html).toContain(">Group sites"); + // A lone service is a row with no group heading of its own. expect(html).not.toContain("Group arcade"); }); it("states each count as glyph, words and color", () => { expect(html).toMatch( - /
        diff --git a/packages/delivery/src/client/router.tsx b/packages/delivery/src/client/router.tsx index 673293882d5..9fa82855574 100644 --- a/packages/delivery/src/client/router.tsx +++ b/packages/delivery/src/client/router.tsx @@ -12,6 +12,7 @@ import { Route as deploymentRoute } from "./routes/deployment.tsx"; import { Route as environmentRoute } from "./routes/environment.tsx"; import { Route as recoveryIntentRoute } from "./routes/recovery-intent.tsx"; import { listRoutes } from "./routes/lists.tsx"; +import { LIST_SECTION } from "./routes/list-page.tsx"; import { pagedOnly, syncSearchForms } from "./routes/search-schemas.ts"; const routeTree = rootRoute.addChildren([ @@ -38,6 +39,9 @@ function moveFocus(targets: readonly string[]) { for (const target of targets) { const element = document.querySelector(target); if (element === null) continue; + // A heading is not focusable until it asks to be: -1 takes focus from a + // script, never from the Tab key. + if (!element.hasAttribute("tabindex")) element.tabIndex = -1; element.focus(); requestAnimationFrame(() => { if (!element.isConnected) moveFocus(targets); @@ -79,7 +83,7 @@ export function createDeliveryRouter( const targets = event.pathChanged ? ["#main-heading"] : pagedOnly(previous, event.toLocation.search) - ? ["#list-heading", "#main-heading"] + ? [`#${LIST_SECTION} h2`, "#main-heading"] : []; if (targets.length === 0 || moveFocus(targets)) return; // The router can resolve before the page's query. Focus the heading once diff --git a/packages/delivery/src/client/routes/activity/activity-fold.test.tsx b/packages/delivery/src/client/routes/activity/activity-fold.test.tsx index 95d997d1192..3572fb05d62 100644 --- a/packages/delivery/src/client/routes/activity/activity-fold.test.tsx +++ b/packages/delivery/src/client/routes/activity/activity-fold.test.tsx @@ -232,12 +232,15 @@ function render(entries: ActivityEntry[]) { ); } -/** Each top-level row of the rendered list. */ +/** Each row of the rendered table, as the markup between its `
    ` tags. */ function rows(html: string) { - const list = html.slice(html.indexOf('
      ')); - return list.split(/
    1. (?=)/u).slice(1); + const body = html.slice(html.indexOf("
    ")); + return body.split("").slice(1); } +/** What a failed status renders: the error severity, in the glyph's own span. */ +const FAILED = 'class="ui-glyph" data-sev="error"'; + describe("the activity list", () => { it("names each stage and what it became, one row per run", () => { const html = render([ @@ -245,19 +248,19 @@ describe("the activity list", () => { stage(FIRST, "step-render", "succeeded"), entry("deployment.claimed", FIRST), ]); - // Labelled columns, then one list item per row. + // Labelled columns, then one table row per entry. expect(html).toMatch( - /^
    {caption}
    Deployment
    /u, ); const [run = "", claimed = ""] = rows(html); expect(rows(html)).toHaveLength(2); - expect(run).toContain('
      '); + expect(run).toContain('
        '); expect(run.match(/step-[a-z]+<\/span>/gu)).toEqual([ 'step-sync', 'step-render', ]); - expect(run).toContain("status-failed"); - expect(run).toContain("status-succeeded"); + expect(run).toContain('data-sev="error"'); + expect(run).toContain('data-sev="ok"'); expect(run).toContain(`href="/deployments/${FIRST}"`); // The deployment is named once, by its short id with the full id kept. expect(run.split(`title="${FIRST}"`)).toHaveLength(2); @@ -300,11 +303,11 @@ describe("the activity list", () => { requested = "", published = "", ] = rows(html); - expect(failed).toContain("status-failed"); - expect(approved).toContain("status-granted"); + expect(failed).toContain(FAILED); + expect(approved).toContain('granted'); expect(approved).toContain("Override"); expect(approved).toContain("at the saved plan"); - expect(rejected).toContain("status-rejected"); + expect(rejected).toContain('rejected'); expect(rejected).not.toContain("Override"); expect(rejected).not.toContain("at the saved plan"); expect(requested).toContain('href="/environments/arcade/prod"'); @@ -323,7 +326,7 @@ describe("the activity list", () => { entry("deployment.requested", FIRST, { environmentId: "arcade/prod" }), ]); const [approved = "", requested = ""] = rows(html); - expect(approved).toContain("status-granted"); + expect(approved).toContain('granted'); expect(approved).not.toContain("Override"); expect(requested).toContain("arcade/prod"); expect(requested).not.toContain("version set"); @@ -334,7 +337,7 @@ describe("the activity list", () => { render([entry("deployment.claimed", FIRST, {}, "operator@example.com")]), ); expect(row).toMatch( - /^.*<\/span>Deployment started<\/span>operator@example\.com<\/span>/u, + /^
    + + + + + ); } @@ -352,37 +364,50 @@ function RepeatedRun({ const [newest] = entries; const ofOneThing = !REPEATED_ACTIONS.has(newest.action); return ( -
  5. - - - {newest.actor} - - {ofOneThing || entries.length === 1 ? ( - <> - - - - ) : null} - {entries.length > 1 && ( - -
      - {entries.map((entry) => ( -
    • - {ofOneThing ? ( - - ) : ( - <> - - - - )} -
    • - ))} -
    -
    - )} -
    -
  6. +
    + + + + + ); } @@ -409,28 +434,30 @@ export function ActivityScope({ }) { return ( <> - - + + + {PROBLEM_CHOICES.map((choice) => ( + + ))} + + + {WITHIN_CHOICES.map((choice) => ( + + ))} + + ); } @@ -447,58 +474,72 @@ export function ActivityList({ entries: ActivityEntry[]; services?: readonly CatalogService[]; }) { - if (entries.length === 0) return

    No activity yet.

    ; + if (entries.length === 0) return No activity yet.; const names = catalogNames(services); const rows = foldActivity(entries); return ( -
    - -
      - {rows.map((row) => { - if (row.kind === "stages") - return ( - - ); - if (row.kind === "repeated") - return ( - - ); - const { entry } = row; - const catalog = - entry.action === "catalog.reconciled" - ? CatalogReconcileRecordSchema.parse(entry.metadata) - : null; - return ( -
    1. - - - {entry.actor} - - +
    When<\/th>Action<\/th>By<\/th>About<\/th><\/tr><\/thead>
    .*<\/span><\/td>Deployment started<\/span><\/td>operator@example\.com<\/span><\/td>/u, ); expect(row).toContain(`aria-label="Deployment ${FIRST}"`); }); @@ -342,7 +345,7 @@ describe("the activity list", () => { it("shows each row's clock reading beside its age, so rows order by eye", () => { const [row = ""] = rows(render([entry("deployment.claimed", FIRST)])); expect(row).toMatch( - /
    + + + + + + {[...new Set(entries.map((entry) => entry.actor))].join(", ")} + + +
    + +
      + {latestStages(entries).map((stage) => ( +
    1. + {stage.stage} + + {stage.writes > 1 && ( + {stage.writes} updates + )} +
    2. + ))} +
    +
    +
    + + + + + + {newest.actor} + + +
    + {ofOneThing || entries.length === 1 ? ( + <> + + + + ) : null} + {entries.length > 1 && ( + +
      + {entries.map((entry) => ( +
    • + {ofOneThing ? ( + + ) : ( + <> + + + + )} +
    • + ))} +
    +
    + )} +
    +
    + + + + + + + + + + {rows.map((row) => { + if (row.kind === "stages") + return ( + - - - {catalog !== null && } - - ); - })} - + ); + if (row.kind === "repeated") + return ( + + ); + const { entry } = row; + const catalog = + entry.action === "catalog.reconciled" + ? CatalogReconcileRecordSchema.parse(entry.metadata) + : null; + return ( + + + + + + + ); + })} + +
    WhenActionByAbout
    + + + + + + {entry.actor} + + +
    + + + {catalog !== null && } +
    +
    ); } diff --git a/packages/delivery/src/client/routes/activity/catalog-reconcile.tsx b/packages/delivery/src/client/routes/activity/catalog-reconcile.tsx index 6aecae3eb17..d4cffce08ab 100644 --- a/packages/delivery/src/client/routes/activity/catalog-reconcile.tsx +++ b/packages/delivery/src/client/routes/activity/catalog-reconcile.tsx @@ -31,17 +31,9 @@ export function CatalogReconcile({ The record already matched the catalog document.

    ) : ( - + {changed.map(([label, ids]) => ( - - {label} ({ids.length}) - - } - mono - > + {ids.join(", ")} ))} diff --git a/packages/delivery/src/client/routes/commits/commit-builds.tsx b/packages/delivery/src/client/routes/commits/commit-builds.tsx index 34a77d5af1b..02c835de72c 100644 --- a/packages/delivery/src/client/routes/commits/commit-builds.tsx +++ b/packages/delivery/src/client/routes/commits/commit-builds.tsx @@ -1,4 +1,5 @@ import { Link } from "@tanstack/react-router"; +import { Section } from "@shepherdjerred/console-ui"; import type { CarriedFailure, CommitBuild } from "#shared/hub/hub-contract.ts"; import { ShortSha } from "#client/components/links.tsx"; import { CatalogName } from "#client/components/catalog-name.tsx"; @@ -24,9 +25,8 @@ export function BuildList({ }) { if (builds.length === 0) return null; return ( -
    -

    {title}

    -

    {intro}

    +
    +

    {intro}

      {builds.map((build) => (
    • @@ -47,7 +47,7 @@ export function BuildList({
    • ))}
    -
    +
    ); } diff --git a/packages/delivery/src/client/routes/commits/commit-environments.tsx b/packages/delivery/src/client/routes/commits/commit-environments.tsx index 0d78af123c9..17091173f81 100644 --- a/packages/delivery/src/client/routes/commits/commit-environments.tsx +++ b/packages/delivery/src/client/routes/commits/commit-environments.tsx @@ -1,4 +1,5 @@ import { Link } from "@tanstack/react-router"; +import { Section } from "@shepherdjerred/console-ui"; import type { CarriedFailure, CommitEnvironment, @@ -44,18 +45,17 @@ export function EnvironmentChip({ const state = environmentView(entry); // Where the change is not live, or is live through a newer release, the // words say why; a glyph alone cannot. - const className = + const spelled = !( isLiveState(entry.state) && state === ENVIRONMENT[entry.state] - ? "env-pill" - : "env-pill env-pill-spelled"; + ); const content = nameFirst ? ( <> {label}: - + ) : ( <> - + {label} ); @@ -63,7 +63,8 @@ export function EnvironmentChip({ {content} @@ -71,7 +72,8 @@ export function EnvironmentChip({ {content} @@ -82,12 +84,8 @@ export function EnvironmentGroup({ group }: { group: CommitEnvironmentGroup }) { const pending = group.members.filter((member) => !isLiveState(member.state)); const live = group.members.filter((member) => isLiveState(member.state)); return ( -
    -

    {group.name}

    -

    +

    +

    member.state)} @@ -98,7 +96,7 @@ export function EnvironmentGroup({ group }: { group: CommitEnvironmentGroup }) {

    {pending.length > 0 && ( -
      +
        {pending.map((member) => (
      • )} {live.length > 0 && ( - {live.length} live}> + {live.length} live}>
          {live.map((member) => (
        • @@ -125,6 +123,6 @@ export function EnvironmentGroup({ group }: { group: CommitEnvironmentGroup }) {
        )} -
    +
    ); } diff --git a/packages/delivery/src/client/routes/commits/commits.tsx b/packages/delivery/src/client/routes/commits/commits.tsx index 72eac10aa1f..2f4b38d6a0a 100644 --- a/packages/delivery/src/client/routes/commits/commits.tsx +++ b/packages/delivery/src/client/routes/commits/commits.tsx @@ -12,7 +12,13 @@ import type { hub } from "#client/api.ts"; import { prefetchRouteQuery, queries } from "#client/queries.ts"; import { PageHeader } from "#client/components/page-header.tsx"; import { Status } from "#client/components/status.tsx"; -import { RelativeTime } from "#client/components/time.tsx"; +import { + Button, + Field, + RelativeTime, + Section, + State, +} from "@shepherdjerred/console-ui"; import { ShortSha } from "#client/components/links.tsx"; import { OlderLink } from "#client/components/pager.tsx"; import { pageSummary } from "#client/routes/list-page.tsx"; @@ -71,51 +77,57 @@ function Tally({ function CommitRow({ commit }: { commit: CommitSummary }) { return ( -
  7. - - - - {commit.title !== null && ( - <> - {" "} - {commit.title} - - )} - - - {commit.environments.length > 0 && ( - - {commit.environments.slice(0, MAX_TALLIES).map((group) => ( - - ))} - {commit.environments.length > MAX_TALLIES && ( - - +{commit.environments.length - MAX_TALLIES} more - - )} - - )} - {rowNotes(commit).map((note) => ( - - {note} - - ))} - - - {commit.author !== null && ( - {commit.author} - )} - {commit.seenAt !== null && } - -
  8. + + + + + + + + {commit.title !== null && ( + <> + {" "} + {commit.title} + + )} + + + +
    + {commit.environments.length > 0 && ( + + {commit.environments.slice(0, MAX_TALLIES).map((group) => ( + + ))} + {commit.environments.length > MAX_TALLIES && ( + + +{commit.environments.length - MAX_TALLIES} more + + )} + + )} + {rowNotes(commit).map((note) => ( + + {note} + + ))} +
    + + +
    + {commit.author !== null && {commit.author}} + {commit.seenAt !== null && ( + + + + )} +
    + + ); } @@ -130,10 +142,9 @@ function FindCommit() { const navigate = useNavigate({ from: "/commits" }); const [invalid, setInvalid] = useState(false); return ( -
    -

    Find a commit

    +
    - - -

    - {invalid - ? `That is not a commit SHA. ${SHA_HINT}` - : "A full SHA or its first 7 digits; spaces around it are ignored."} -

    + {(control) => ( + { + setInvalid(false); + }} + /> + )} + +
    -
    +
    ); } @@ -202,41 +205,50 @@ function CommitsContent({ title="Commits" description="Is it deployed? The newest commits, and where each one stands." /> - -
    -

    Recent commits

    - {data.items.length === 0 ? ( -

    Delivery has not seen a commit yet.

    - ) : ( -
    -

    - {pageSummary({ - count: data.items.length, - noun: ["commit", "commits"], - filtered: false, - older: search.cursor !== undefined, - more: data.nextCursor !== null, - })} -

    -
    - )} - {data.items.length > 0 && ( -
    -
    + )} + {data.items.length > 0 && ( +
    + + + + + + + + + + + {data.items.map((commit) => ( + + ))} + +
    StatusCommitChanged services live, per environmentAuthor · first seen
    +
    + )} + + +
    ); } @@ -255,7 +267,7 @@ function ServiceStanding({ entry }: { entry: CommitService }) { function ServiceRow({ entry }: { entry: CommitService }) { return ( - + - + {entry.environments.length === 0 ? ( {entry.includedIn !== undefined && entry.versionSet === null @@ -356,56 +368,56 @@ function CommitContent({ data }: { data: CommitStatus }) { {data.buildId !== null && ( )} - !isCarried(build))} - /> - isCarried(build))} - carried={carried} - /> - - {data.environments.length > 0 && ( -
    -

    By environment

    - {data.environments.map((group) => ( - - ))} -
    - )} - {data.changed.length > 0 && ( -
    -

    - By service ({data.changed.length}) -

    -
    - - - - - - - - - - {data.changed.map((entry) => ( - - ))} - -
    ServiceStatusEnvironments
    -
    -
    - )} - {data.unchangedCount > 0 && ( -

    {unchangedLine(data.unchangedCount)}

    - )} +
    + !isCarried(build))} + /> + isCarried(build))} + carried={carried} + /> + + {data.environments.length > 0 && ( +
    + {data.environments.map((group) => ( + + ))} +
    + )} + {data.changed.length > 0 && ( +
    +
    + + + + + + + + + + {data.changed.map((entry) => ( + + ))} + +
    ServiceStatusEnvironments
    +
    +
    + )} + {data.unchangedCount > 0 && ( +

    + {unchangedLine(data.unchangedCount)} +

    + )} +
    ); } diff --git a/packages/delivery/src/client/routes/deployment.tsx b/packages/delivery/src/client/routes/deployment.tsx index 134c25dbb80..1d0eed0ea2e 100644 --- a/packages/delivery/src/client/routes/deployment.tsx +++ b/packages/delivery/src/client/routes/deployment.tsx @@ -13,10 +13,10 @@ import { delivery } from "#client/api.ts"; import { prefetchRouteQuery, queries } from "#client/queries.ts"; import { PageHeader } from "#client/components/page-header.tsx"; import { Status } from "#client/components/status.tsx"; -import { RelativeTime } from "#client/components/time.tsx"; +import { RelativeTime } from "@shepherdjerred/console-ui"; import { ToolLinks } from "#client/components/links.tsx"; import { ConfirmButton } from "#client/components/confirm-dialog.tsx"; -import { ErrorNotice } from "#client/components/notices.tsx"; +import { ErrorNotice, Notice } from "#client/components/notices.tsx"; import { ApprovalForm } from "#client/forms/approval-form.tsx"; import { DecisionOutcome } from "#client/forms/decision.tsx"; import { @@ -136,8 +136,8 @@ function DeploymentContent({ detail }: { detail: DeploymentDetailV2 }) { {/* Only the status is live: the relative time beside it changes every minute. */} - - {deployment.kind} +
    {" "} + {deployment.kind}{" "} + {" "} requested by {deployment.requestedBy}{" "} @@ -176,9 +176,9 @@ function DeploymentContent({ detail }: { detail: DeploymentDetailV2 }) { }} /> ) : ( -

    + A human with approval access must review this deployment. -

    + ))} {principal !== undefined && canDeploy(principal) && (
    diff --git a/packages/delivery/src/client/routes/environment.tsx b/packages/delivery/src/client/routes/environment.tsx index 185f9229dac..7cc723a7671 100644 --- a/packages/delivery/src/client/routes/environment.tsx +++ b/packages/delivery/src/client/routes/environment.tsx @@ -5,7 +5,7 @@ import type { EnvironmentPageDetail } from "#shared/hub/hub-contract.ts"; import { prefetchRouteQuery, queries } from "#client/queries.ts"; import { PageHeader } from "#client/components/page-header.tsx"; import { ToolLinks } from "#client/components/links.tsx"; -import { useNow } from "#client/components/time.tsx"; +import { useNow } from "@shepherdjerred/console-ui"; import { RuntimePanel } from "#client/components/integrations.tsx"; import { DeploymentTable } from "#client/components/deployment-table.tsx"; import { EnvironmentState } from "#client/components/environment-state.tsx"; diff --git a/packages/delivery/src/client/routes/list-page.test.tsx b/packages/delivery/src/client/routes/list-page.test.tsx index 19cd4cd4110..ef8fcb522b1 100644 --- a/packages/delivery/src/client/routes/list-page.test.tsx +++ b/packages/delivery/src/client/routes/list-page.test.tsx @@ -164,7 +164,8 @@ describe("FilterProblems", () => { clearTo="/deployments" />, ); - expect(html).toContain('role="status" class="notice error"'); + expect(html).toContain('class="ui-banner" data-sev="error"'); + expect(html).toContain('“bogus” is not a status.'); expect(html).toContain("Choose one of queued, running."); expect(html).toContain('href="/deployments"'); expect(html).toContain("Clear filters"); diff --git a/packages/delivery/src/client/routes/list-page.tsx b/packages/delivery/src/client/routes/list-page.tsx index ed54cabb6b9..58ed57eae61 100644 --- a/packages/delivery/src/client/routes/list-page.tsx +++ b/packages/delivery/src/client/routes/list-page.tsx @@ -1,5 +1,6 @@ -import type { ReactNode } from "react"; +import type { ComponentProps, ReactNode } from "react"; import { Link } from "@tanstack/react-router"; +import { Banner, Button, Field, Section } from "@shepherdjerred/console-ui"; import type { CatalogService } from "./catalog-filter.ts"; import { formSearch } from "./search-schemas.ts"; @@ -51,14 +52,17 @@ export function FilterForm({ label, onSearch, children, + end, }: { label: string; onSearch: (form: HTMLFormElement) => void; children: ReactNode; + /** Muted text at the toolbar's end, such as how many rows the filters leave. */ + end?: ReactNode; }) { return (
    {children} - + + {end === undefined ? null : ( +

    {end}

    + )}
    ); } +/** A text filter in the toolbar: console-ui's inline `Field` around a plain input the form reads by `name`. */ +export function FilterInput({ + label, + ...input +}: { label: string } & ComponentProps<"input">) { + return ( + + {(control) => } + + ); +} + +/** A choice filter in the toolbar: an inline `Field` around a select the form reads by `name`. */ +export function FilterSelect({ + label, + ...select +}: { label: string } & ComponentProps<"select">) { + return ( + + {(control) => - - - + + + + + {STATUSES.map((status) => ( + + ))} + )} - + ); } @@ -295,7 +294,7 @@ function ArtifactsPage() { title="Artifacts" description="Builds, their qualification, and the immutable artifacts they published." /> - @@ -314,26 +313,25 @@ function ArtifactsPage() { }} > - - + + + + {QUALIFICATIONS.map((qualification) => ( + + ))} + )} - + ); } @@ -379,16 +377,15 @@ function ActivityPage() { ...queries.activity(filters.query), enabled: filters.problems.length === 0, }); - const now = useNow(); if (filters.problems.length === 0 && query.isLoadingError) return ; return ( <> - + { @@ -398,36 +395,30 @@ function ActivityPage() { }} > - - - + + + {filters.problems.length > 0 ? ( ) : ( - + {({ items, nextCursor }) => { // One row can fold multiple events. Show both counts. const rows = foldActivity(items).length; @@ -464,7 +455,7 @@ function ActivityPage() { }} )} - + ); } diff --git a/packages/delivery/src/client/routes/overview-model.ts b/packages/delivery/src/client/routes/overview-model.ts index 80af2fc4d3e..e28fe2615eb 100644 --- a/packages/delivery/src/client/routes/overview-model.ts +++ b/packages/delivery/src/client/routes/overview-model.ts @@ -190,3 +190,43 @@ export function standingCounts( return count === 0 ? [] : [{ standing, count }]; }); } + +/** One headline number of the overview's figure strip. */ +export type OverviewFigure = { + label: string; + value: number; + /** Set only while the figure is not zero, so an empty count never reads as a problem. */ + severity?: "ok" | "info" | "warning" | "error"; +}; + +/** + * The strip above the lists: how many services Delivery records and how many + * stand healthy, running, waiting on someone or failing. Every service counts + * once, by its most urgent environment; a service with no environment is in + * the total only. + */ +export function overviewFigures( + services: readonly GridService[], +): OverviewFigure[] { + const counts = standingCounts([...services]); + const of = (...standings: ServiceStanding[]) => + counts + .filter(({ standing }) => standings.includes(standing)) + .reduce((sum, { count }) => sum + count, 0); + const figure = ( + label: string, + value: number, + severity: NonNullable, + ): OverviewFigure => ({ + label, + value, + ...(value === 0 ? {} : { severity }), + }); + return [ + { label: "Services", value: services.length }, + figure("Healthy", of("succeeded"), "ok"), + figure("Running", of("running"), "info"), + figure("Waiting on someone", of("awaiting_approval", "queued"), "warning"), + figure("Failing", of("failed", "recovery_required", "alarmed"), "error"), + ]; +} diff --git a/packages/delivery/src/client/routes/overview.tsx b/packages/delivery/src/client/routes/overview.tsx index 8b705b844b5..63a098a033a 100644 --- a/packages/delivery/src/client/routes/overview.tsx +++ b/packages/delivery/src/client/routes/overview.tsx @@ -1,5 +1,6 @@ import { createRoute, useNavigate } from "@tanstack/react-router"; import { useQuery } from "@tanstack/react-query"; +import { FigureStrip, State } from "@shepherdjerred/console-ui"; import { RouteData } from "#client/routes/route-data.tsx"; import { GridEnvironmentStatusSchema, @@ -13,14 +14,19 @@ import { import { OverviewPanels } from "#client/components/overview-panels.tsx"; import { PageHeader } from "#client/components/page-header.tsx"; import { statusLabel } from "#client/components/status.tsx"; -import { FilterProblems } from "./list-page.tsx"; +import { + FilterForm, + FilterInput, + FilterProblems, + FilterSelect, +} from "./list-page.tsx"; import { plainChoices, problemsOf, resolveChoice, unknownFilters, } from "./catalog-filter.ts"; -import { kindPanels } from "./overview-model.ts"; +import { kindPanels, overviewFigures } from "./overview-model.ts"; import { PipelineSearchSchema, formSearch } from "./search-schemas.ts"; import { Route as rootRoute } from "./root.tsx"; @@ -66,61 +72,63 @@ function OverviewContent({ data }: { data: HubGrid }) { title="Overview" description="Every active service and where it runs, as Delivery last recorded it. This is the deployment record, not live runtime health." /> - -
    -
    { - event.preventDefault(); - void navigate({ - search: PipelineSearchSchema.parse( - formSearch(event.currentTarget), - ), - }); - }} - > - - - -
    -

    - {shown === total && problems.length === 0 - ? `${String(total)} services` - : `${String(shown)} of ${String(total)} services`} -

    + + +
    + {problems.length > 0 ? ( + + ) : panels.length === 0 ? ( + + {total === 0 + ? "No active service is registered with Delivery yet." + : "No services match these filters."} + + ) : ( + + )}
    - {problems.length > 0 ? ( - - ) : panels.length === 0 ? ( -

    - {total === 0 - ? "No active service is registered with Delivery yet." - : "No services match these filters."} -

    - ) : ( - - )} ); } diff --git a/packages/delivery/src/client/routes/pipelines.tsx b/packages/delivery/src/client/routes/pipelines.tsx index f890e2fd455..a02004bef14 100644 --- a/packages/delivery/src/client/routes/pipelines.tsx +++ b/packages/delivery/src/client/routes/pipelines.tsx @@ -1,4 +1,5 @@ import { Link, createRoute, useNavigate } from "@tanstack/react-router"; +import { Section, State } from "@shepherdjerred/console-ui"; import { useQuery } from "@tanstack/react-query"; import { RouteData } from "#client/routes/route-data.tsx"; import { @@ -15,7 +16,7 @@ import { } from "#client/components/attention-panel.tsx"; import { PageHeader } from "#client/components/page-header.tsx"; import { Status, statusLabel } from "#client/components/status.tsx"; -import { RelativeTime } from "#client/components/time.tsx"; +import { RelativeTime } from "@shepherdjerred/console-ui"; import { ShortSha, ToolLinks } from "#client/components/links.tsx"; import { ciStatus, @@ -28,7 +29,12 @@ import { resolveChoice, unknownFilters, } from "./catalog-filter.ts"; -import { FilterProblems } from "./list-page.tsx"; +import { + FilterForm, + FilterInput, + FilterProblems, + FilterSelect, +} from "./list-page.tsx"; import { PipelineSearchSchema, formSearch } from "./search-schemas.ts"; import { Route as rootRoute } from "./root.tsx"; @@ -84,9 +90,10 @@ function StageStrip({ pipeline }: { pipeline: HubService }) { - + Build
  9. @@ -96,16 +103,13 @@ function StageStrip({ pipeline }: { pipeline: HubService }) { {env.recoveryRequired ? ( ) : ( - + )} {env.name} @@ -148,22 +152,26 @@ function LastActivity({ pipeline }: { pipeline: HubService }) { function PipelineRow({ pipeline }: { pipeline: HubService }) { return ( - - + + {pipeline.title} {pipeline.id} - + - + - + - + @@ -205,86 +213,77 @@ function PipelinesContent({ data }: { data: HubOverview }) { description="Every pipeline from commit to runtime: its newest CI run, and where each environment stands." actions={} /> - {/* What needs someone leads, as on the overview. */} - -
    -
    -

    - Pipelines{" "} - - ({pipelines.length} - {pipelines.length === data.services.length - ? "" - : ` of ${String(data.services.length)}`} - ) - -

    -
    -
    { - event.preventDefault(); - void navigate({ - search: PipelineSearchSchema.parse( - formSearch(event.currentTarget), - ), - }); - }} +
    + {/* What needs someone leads, as on the overview. */} + +
    - - - - - {problems.length > 0 ? ( - - ) : pipelines.length === 0 ? ( -

    - {data.services.length === 0 - ? "No services publish through Delivery yet." - : "No pipelines match these filters."} -

    - ) : ( -
    - - - - - - - - - - - - {pipelines.map((pipeline) => ( - - ))} - -
    NameLatest CI runSource revisionStagesLast activity
    -
    - )} -
    + + + {problems.length > 0 ? ( + + ) : pipelines.length === 0 ? ( + + {data.services.length === 0 + ? "No services publish through Delivery yet." + : "No pipelines match these filters."} + + ) : ( +
    + + + + + + + + + + + + {pipelines.map((pipeline) => ( + + ))} + +
    NameLatest CI runSource revisionStagesLast activity
    +
    + )} +
    +
); } diff --git a/packages/delivery/src/client/routes/recovery-intent.tsx b/packages/delivery/src/client/routes/recovery-intent.tsx index faee79217f3..1221676c71d 100644 --- a/packages/delivery/src/client/routes/recovery-intent.tsx +++ b/packages/delivery/src/client/routes/recovery-intent.tsx @@ -5,7 +5,7 @@ import type { delivery } from "#client/api.ts"; import { prefetchRouteQuery, queries } from "#client/queries.ts"; import { PageHeader } from "#client/components/page-header.tsx"; import { Status } from "#client/components/status.tsx"; -import { RelativeTime } from "#client/components/time.tsx"; +import { RelativeTime } from "@shepherdjerred/console-ui"; import { DeploymentLink } from "#client/model/selection-facts.tsx"; import { Route as rootRoute } from "./root.tsx"; import { Fact, Facts } from "#client/components/facts.tsx"; @@ -66,7 +66,7 @@ function RecoveryIntentContent({ hold, rechecks this fingerprint and generation, and keeps the deployment's result and the accepted selection.

- +

{intent.fingerprint}

diff --git a/packages/delivery/src/client/routes/root.tsx b/packages/delivery/src/client/routes/root.tsx index 35d5ba3575a..4f3ebc5ba2c 100644 --- a/packages/delivery/src/client/routes/root.tsx +++ b/packages/delivery/src/client/routes/root.tsx @@ -1,3 +1,4 @@ +import { Notice } from "#client/components/notices.tsx"; import { Link, Outlet, @@ -6,9 +7,9 @@ import { } from "@tanstack/react-router"; import type { ReactNode } from "react"; import type { QueryClient } from "@tanstack/react-query"; +import { State } from "@shepherdjerred/console-ui"; import { LoadingBlockDefaults } from "@shepherdjerred/loaded/react.tsx"; import type { ChangeFeed } from "#client/change-feed.ts"; -import { ConfirmDialogProvider } from "#client/components/confirm-dialog.tsx"; import { PageHeader } from "#client/components/page-header.tsx"; import { DeliveryShell } from "#client/shell/shell-nav.tsx"; import { DeliveryClientError } from "#shared/client.ts"; @@ -20,18 +21,16 @@ function RootLayout() { return (
- - - Loading… -

- } - renderError={([failure]) => } - > - -
-
+ + Loading… + + } + renderError={([failure]) => } + > + +
); @@ -90,9 +89,9 @@ export function RouteError({ title={final ? "This page cannot be shown" : "Something went wrong"} takeFocus /> -
+ {errorText(error)} -
+

{final ? ( (recovery ?? Return to the overview) diff --git a/packages/delivery/src/client/routes/route-data.tsx b/packages/delivery/src/client/routes/route-data.tsx index 3c87fae075e..04f9b60cda7 100644 --- a/packages/delivery/src/client/routes/route-data.tsx +++ b/packages/delivery/src/client/routes/route-data.tsx @@ -3,13 +3,17 @@ import { LoadingBlock } from "@shepherdjerred/loaded/react.tsx"; import type { UseQueryResult } from "@tanstack/react-query"; import type { ReactNode } from "react"; import { RouteError } from "./root.tsx"; +import { Notice } from "#client/components/notices.tsx"; /** The full page's required read, including Delivery's route-level recovery. */ export function RouteData({ query, + bleed = "page", children, }: { query: UseQueryResult; + /** Where the refresh notice sits; a read inside a list section says `inline`. */ + bleed?: "page" | "inline"; children: (data: T) => ReactNode; }) { function retry() { @@ -25,9 +29,9 @@ export function RouteData({ {({ page }, { errors }) => ( <> {errors.length > 0 && ( -

+ Showing the last known data. The most recent refresh failed. -

+ )} {children(page)} diff --git a/packages/delivery/src/client/routes/service.tsx b/packages/delivery/src/client/routes/service.tsx index 567d4cb4e12..4f8d267afc3 100644 --- a/packages/delivery/src/client/routes/service.tsx +++ b/packages/delivery/src/client/routes/service.tsx @@ -3,8 +3,10 @@ import { Outlet, createRoute, useMatchRoute, + useRouter, } from "@tanstack/react-router"; -import { NavTabs } from "@shepherdjerred/console-ui"; +import { NavTabs, Section, State } from "@shepherdjerred/console-ui"; +import { RouterPager } from "#client/components/pager.tsx"; import { useQuery } from "@tanstack/react-query"; import { createContext, useContext } from "react"; import { RouteData } from "#client/routes/route-data.tsx"; @@ -12,7 +14,7 @@ import type { hub } from "#client/api.ts"; import { prefetchRouteQuery, queries } from "#client/queries.ts"; import { PageHeader } from "#client/components/page-header.tsx"; import { Status } from "#client/components/status.tsx"; -import { RelativeTime } from "#client/components/time.tsx"; +import { RelativeTime } from "@shepherdjerred/console-ui"; import { ShortSha, ToolLinks } from "#client/components/links.tsx"; import { PipelineGraph } from "#client/components/pipeline/pipeline-graph.tsx"; import { pipelineStages } from "#client/components/pipeline/pipeline-view-model.ts"; @@ -133,19 +135,18 @@ function PipelinePage() { }); const stages = pipelineStages(data.stages, ci.data); return ( -
-

- Promotion -

-

- Each stage shows the newest run that reached it. Stages can show - different revisions while a change moves through. -

- -
+
+
+

+ Each stage shows the newest run that reached it. Stages can show + different revisions while a change moves through. +

+ +
+
); } @@ -173,103 +174,97 @@ function ExecutionsContent({ }) { const { serviceId } = serviceRoute.useParams(); const { cursor } = executionsRoute.useSearch(); + const router = useRouter(); + const hrefFor = (next: string | undefined) => + router.buildLocation({ + to: "/pipelines/$serviceId/executions", + params: { serviceId }, + search: next === undefined ? {} : { cursor: next }, + }).href; return ( -
-

Executions

- {data.items.length === 0 ? ( -

No builds or composed version sets yet.

- ) : ( -
- - - - - - - - - - - - {data.items.map((execution) => ( - - + + + + + + ))} + +
ChangeStatusVersion setEnvironmentsStarted
- {execution.build === null ? ( - execution.versionSet === null ? ( - execution.id +
+
+ {data.items.length === 0 ? ( + No builds or composed version sets yet. + ) : ( +
+ + + + + + + + + + + + {data.items.map((execution) => ( + + - - - - - - ))} - -
ChangeStatusVersion setEnvironmentsStarted
+ {execution.build === null ? ( + execution.versionSet === null ? ( + execution.id + ) : ( + + Composed{" "} + {revisionLabel(execution.versionSet.revision)} + + ) ) : ( - Composed{" "} - {revisionLabel(execution.versionSet.revision)} + + {execution.build.pipelineNumber !== null && + ` · #${String(execution.build.pipelineNumber)}`} - ) - ) : ( - - - {execution.build.pipelineNumber !== null && - ` · #${String(execution.build.pipelineNumber)}`} - - )} - - - - {execution.versionSet === null - ? "—" - : revisionLabel(execution.versionSet.revision)} - -
    - {execution.deployments.map((deployment) => ( -
  • - - {" "} - {deployment.environmentId} - -
  • - ))} -
-
- -
-
- )} -
+ + + {execution.versionSet === null + ? "—" + : revisionLabel(execution.versionSet.revision)} + +
    + {execution.deployments.map((deployment) => ( +
  • + + {" "} + {deployment.environmentId} + +
  • + ))} +
+
+ +
+
)} - -
+ + + ); } diff --git a/packages/delivery/src/client/styles/base.css b/packages/delivery/src/client/styles/base.css index 78c98578d96..289b5194f47 100644 --- a/packages/delivery/src/client/styles/base.css +++ b/packages/delivery/src/client/styles/base.css @@ -1,6 +1,7 @@ /* - * Delivery's base element rules (`main a`, `main h1`, tables, form controls, - * `dialog`...) live in console-ui's reserved `ui.app` layer, which + * Delivery's base element rules (`main a`, `main h1`, form controls, and the + * tables that are not yet `.ui-table`) live in console-ui's reserved `ui.app` + * layer, which * console-ui orders between `ui.tokens` and `ui.components`: they style plain * content, and every console-ui component (`HeaderBar`, `NavTabs`, `Sidebar`, * `.ui-menu`) beats them. Delivery's class rules stay unlayered. @@ -9,8 +10,7 @@ @layer ui.app { main h1, main h2, - main h3, - dialog h2 { + main h3 { line-height: var(--leading-tight); font-weight: var(--weight-semibold); color: var(--ui-ink); @@ -20,34 +20,29 @@ font-size: var(--text-xl); letter-spacing: -0.01em; } - main h2, - dialog h2 { + main h2 { font-size: var(--text-lg); } main h3 { font-size: var(--text-md); } - main p, - dialog p { + main p { margin: 0 0 var(--space-2); overflow-wrap: anywhere; } main small { font-size: var(--text-xs); } - main a, - dialog a { + main a { color: var(--ui-accent); text-decoration: underline; text-decoration-color: color-mix(in srgb, currentcolor 45%, transparent); text-underline-offset: 2px; } - main a:hover, - dialog a:hover { + main a:hover { text-decoration-color: currentcolor; } - main :is(input:not([type="checkbox"]), select, textarea), - dialog :is(input:not([type="checkbox"]), select, textarea) { + main :is(input:not([type="checkbox"]), select, textarea) { background: var(--ui-panel); color: var(--ui-ink); border: 1px solid var(--ui-btn-edge); @@ -57,29 +52,24 @@ max-width: 100%; font-size: var(--text-sm); } - main :is(input:not([type="checkbox"]), select, textarea)::placeholder, - dialog :is(input:not([type="checkbox"]), select, textarea)::placeholder { + main :is(input:not([type="checkbox"]), select, textarea)::placeholder { color: var(--ui-faint); } - main :is(input:not([type="checkbox"]), select, textarea):focus-visible, - dialog :is(input:not([type="checkbox"]), select, textarea):focus-visible { + main :is(input:not([type="checkbox"]), select, textarea):focus-visible { border-color: var(--ui-accent); outline: 2px solid var(--ui-accent); outline-offset: 1px; } - main textarea, - dialog textarea { + main textarea { width: 100%; min-height: 72px; padding: 6px var(--control-pad-x); resize: vertical; } - main :is(input, select, textarea):user-invalid, - dialog :is(input, select, textarea):user-invalid { + main :is(input, select, textarea):user-invalid { border-color: var(--ui-sev-error); } - main label, - dialog label { + main label { display: grid; grid-template-columns: minmax(0, 1fr); gap: var(--space-1); @@ -87,30 +77,29 @@ font-weight: var(--weight-medium); font-size: var(--text-sm); } - main table { + .table-scroll table { width: 100%; border-collapse: collapse; line-height: var(--leading-snug); font-size: var(--text-md); font-variant-numeric: tabular-nums; } - main th, - main td { + .table-scroll :is(th, td) { text-align: start; vertical-align: top; padding: var(--row-pad-y) var(--row-pad-x); border-bottom: 1px solid var(--ui-line-soft); } - main :is(th, td):first-child { + .table-scroll :is(th, td):first-child { padding-inline-start: var(--panel-pad-x); } - main :is(th, td):last-child { + .table-scroll :is(th, td):last-child { padding-inline-end: var(--panel-pad-x); } - main tbody tr:hover > :is(th, td) { + .table-scroll tbody tr:hover > :is(th, td) { background: var(--ui-hover); } - main tbody th { + .table-scroll tbody th { font-weight: var(--weight-medium); color: var(--ui-ink); } @@ -126,13 +115,13 @@ * Sentence-case labels across column headers, definition terms and eyebrows, * matching console-ui's `.ui-table thead th` and `.ui-field-label`. */ - main thead th { + .table-scroll thead th { font-size: var(--text-2xs); line-height: var(--leading-snug); font-weight: var(--weight-medium); color: var(--ui-muted); } - main thead th { + .table-scroll thead th { height: 30px; padding-block: 0; vertical-align: middle; @@ -145,8 +134,7 @@ color: var(--ui-muted); font-weight: var(--weight-regular); } - main pre, - dialog pre { + main pre { font-family: var(--font-mono); font-size: var(--text-mono); line-height: var(--leading-snug); @@ -168,33 +156,19 @@ min-height: var(--target-min); line-height: var(--target-min); } + /* A link in a stacked row is a touch target of its own. */ + @media (pointer: coarse) { + td[data-label] a { + display: inline-flex; + align-items: center; + min-height: var(--target-min); + } + } abbr[title] { text-decoration: none; } - dialog { - margin: auto; - border: 1px solid var(--ui-line); - border-radius: 10px; - background: var(--ui-panel); - color: var(--ui-ink); - padding: 18px 20px 16px; - width: min(460px, calc(100vw - 32px)); - box-shadow: var(--shadow-overlay); - } - dialog:modal { - overscroll-behavior: contain; - } - dialog::backdrop { - background: var(--backdrop); - overscroll-behavior: contain; - } - dialog h2 { - margin-bottom: var(--space-2); - } } -.activity-columns, -.facts dt, .eyebrow { font-size: var(--text-2xs); line-height: var(--leading-snug); diff --git a/packages/delivery/src/client/styles/components.css b/packages/delivery/src/client/styles/components.css index 134fe577e96..8cc622d8523 100644 --- a/packages/delivery/src/client/styles/components.css +++ b/packages/delivery/src/client/styles/components.css @@ -1,51 +1,3 @@ -/* Status: console-ui severity glyph + words, so no channel carries it alone. */ -.status { - display: inline-flex; - align-items: center; - gap: 5px; - font-size: var(--text-xs); - line-height: var(--leading-snug); - font-weight: var(--weight-medium); - color: var(--ui-sev-ink, var(--ui-muted)); - white-space: nowrap; - vertical-align: middle; -} -.status-glyph { - width: 13.5px; - height: 13.5px; - flex: none; - color: var(--ui-sev, var(--ui-muted)); -} -.status-not_started, -.status-unmonitored, -.status-canceled, -.status-expired { - color: var(--ui-muted); -} -.status-not_started .status-glyph, -.status-unmonitored .status-glyph, -.status-canceled .status-glyph, -.status-expired .status-glyph { - color: var(--ui-muted); -} -.status-running .status-glyph { - animation: spin 1.4s linear infinite; -} -@keyframes spin { - to { - transform: rotate(360deg); - } -} -/* Where the pill shows its glyph only, a screen reader still reads its words. */ -.env-pill .status-label, -.action .status-label { - position: absolute; - width: 1px; - height: 1px; - overflow: hidden; - clip-path: inset(50%); - white-space: nowrap; -} @media (forced-colors: active) { .stage-card { border-top-width: 4px; @@ -104,9 +56,7 @@ border-color: var(--ui-sev-error); } main button:disabled, -main button[aria-disabled="true"], -dialog button:disabled, -dialog button[aria-disabled="true"] { +main button[aria-disabled="true"] { opacity: 0.55; cursor: not-allowed; } @@ -138,26 +88,6 @@ dialog button[aria-disabled="true"] { justify-content: flex-start; } -/* Notices: console-ui banner look (head surface + 3px severity accent bar). */ -.notice { - border: 1px solid var(--ui-line); - border-inline-start: 3px solid var(--ui-sev-warning); - background: var(--ui-head); - color: var(--ui-ink); - padding: 8px 12px; - border-radius: var(--radius-small); - overflow-wrap: anywhere; -} -.notice.error { - border-inline-start-color: var(--ui-sev-error); -} -.notice.info { - border-inline-start-color: var(--ui-sev-info); -} -.notice.success { - border-inline-start-color: var(--ui-sev-ok); -} - .empty { color: var(--ui-muted); } @@ -179,13 +109,6 @@ dialog button[aria-disabled="true"] { min-height: var(--target-min); white-space: nowrap; } -.pipeline-table .tool-links { - gap: 0 var(--space-2); - font-size: var(--text-xs); -} -.pipeline-table .tool-link { - padding-inline: var(--space-0); -} time { white-space: nowrap; font-variant-numeric: tabular-nums; @@ -195,9 +118,6 @@ time { font-size: var(--text-mono); white-space: nowrap; } -.pipeline-table td { - vertical-align: middle; -} .last-activity { display: inline-flex; flex-direction: column; @@ -205,6 +125,7 @@ time { white-space: nowrap; } .execution-cell { + white-space: nowrap; display: inline-flex; flex-direction: column; gap: var(--space-1); @@ -218,41 +139,12 @@ time { flex-wrap: wrap; gap: var(--space-1); } -/* An environment as a link: its state as a glyph, then its name. */ -.env-pill { - display: inline-flex; - gap: 5px; - align-items: center; - min-height: var(--target-min); - border: 1px solid var(--ui-line); - border-radius: var(--radius-chip); - background: var(--ui-panel); - padding: 1px 7px 1px 5px; - text-decoration: none; - color: var(--ui-ink); - font-size: var(--text-xs); - line-height: var(--leading-snug); -} -.env-pill:hover { - background: var(--ui-hover); - text-decoration: none; -} -.env-pill .status { - position: relative; -} -.env-pill.env-pill-spelled .status-label { - position: static; - width: auto; - height: auto; - overflow: visible; - clip-path: none; - white-space: normal; -} + .env-name { overflow-wrap: anywhere; } -.attention ul, -.activity, +.activity-stages, +.activity-repeated, .evidence, .workflows, .steps, @@ -262,26 +154,20 @@ time { .alarms, .candidates, .intents, -.diff ul, -.commit-list { +.diff ul { list-style: none; margin: 0; padding: 0; } /* One row treatment for every list of records. */ -.attention li, -.activity li, .evidence li, .alarms li, .candidates > li, -.intents li, -.commit-row { +.intents li { padding: var(--row-pad-y) 0; border-bottom: 1px solid var(--ui-line-soft); line-height: var(--leading-snug); } -.attention li:last-child, -.activity li:last-child, .alarms li:last-child, .candidates > li:last-child, .intents li:last-child { @@ -291,172 +177,6 @@ time { margin: var(--space-1) 0 0; padding-left: var(--space-5); } -/* Kind, lead, summary and time sit in the same columns on every row. */ -.attention li { - display: grid; - grid-template-columns: 6rem minmax(0, 22rem) minmax(0, 1fr) 8.5rem; - gap: var(--space-1) var(--space-3); - align-items: baseline; -} -.attention li > .badge { - justify-self: start; -} -.attention-lead a { - color: var(--ui-ink); - font-weight: var(--weight-medium); - text-decoration: none; -} -.attention-lead a:hover { - text-decoration: underline; -} -.attention-lead, -.attention-summary { - overflow-wrap: anywhere; -} -.attention time { - grid-column: 4; - justify-self: end; - text-align: end; - color: var(--ui-muted); - font-size: var(--text-xs); - font-variant-numeric: tabular-nums; -} -.attention-toggle { - margin-top: var(--space-2); -} -@media (width <= 720px) { - .attention li { - grid-template-columns: auto minmax(0, 1fr); - } - .attention-lead, - .attention-summary { - grid-column: 1 / -1; - } - .attention time { - grid-column: 2; - grid-row: 1; - } -} - -/* Badges: sentence case mono tags matching Hub's `.change-kind`. */ -.badge { - font-family: var(--font-mono); - font-size: 11.5px; - line-height: var(--leading-snug); - font-weight: var(--weight-semibold); - padding: 1px 6px; - border-radius: 4px; - background: var(--ui-sev-error-soft); - color: var(--ui-sev-error-text); -} -.badge-approval { - background: var(--ui-sev-warning-soft); - color: var(--ui-sev-warning-text); -} -.badge-override { - background: var(--ui-sev-info-soft); - color: var(--ui-sev-info-text); -} -.badge-current { - background: var(--ui-sev-ok-soft); - color: var(--ui-sev-ok-text); - margin-inline-start: var(--space-2); -} - -/* Activity: when, what, who, then what it was about, under one row of labels. */ -.activity-columns, -.activity li { - display: grid; - grid-template-columns: 7.5rem minmax(0, 14rem) minmax(0, 8rem) minmax(0, 1fr); - gap: var(--space-1) var(--space-3); - align-items: baseline; -} -.activity li { - font-size: var(--text-sm); -} -.activity-columns { - padding: 6px 0; - border-block: 1px solid var(--ui-line); -} -.activity-when time { - white-space: normal; -} -.activity-action { - font-weight: var(--weight-medium); - overflow-wrap: anywhere; -} -.activity-actor { - color: var(--ui-muted); - overflow-wrap: anywhere; -} -.activity-entity { - overflow-wrap: anywhere; -} -/* Facts: labelled values in one definition list (components/facts.tsx). */ -.facts { - display: grid; - grid-template-columns: repeat(auto-fit, minmax(11rem, 1fr)); - gap: var(--space-2) var(--space-4); - margin: 0 0 var(--space-3); - line-height: var(--leading-snug); -} -.facts > div { - min-width: 0; -} -.facts dt { - margin-bottom: var(--space-0); -} -.facts dd { - margin: 0; - font-weight: var(--weight-medium); - color: var(--ui-ink); - overflow-wrap: anywhere; -} -.catalog-result .facts, -.facts:last-child { - margin-bottom: 0; -} -/* Disclosure: a native details with an optional count (components/disclosure.tsx). */ -.disclosure > summary { - cursor: pointer; - display: inline-flex; - align-items: center; - gap: var(--space-2); - list-style: none; - font-weight: var(--weight-medium); - color: var(--ui-ink); -} -.disclosure > summary::-webkit-details-marker { - display: none; -} -.disclosure > summary::before { - content: ""; - flex: none; - margin-inline: var(--space-1); - border-block: 4px solid transparent; - border-inline-start: 6px solid var(--ui-muted); -} -.disclosure[open] > summary::before { - transform: rotate(90deg); -} -.disclosure-label { - min-width: 0; - overflow-wrap: anywhere; -} -.disclosure-count { - padding: 0 6px; - border-radius: var(--radius-pill); - background: var(--ui-track); - color: var(--ui-muted); - font-family: var(--font-mono); - font-size: 11.5px; - font-weight: var(--weight-medium); - line-height: var(--leading-snug); - font-variant-numeric: tabular-nums; -} -.disclosure-body { - padding: var(--space-2) 0 var(--space-1) var(--space-4); -} /* Identifier: a short id that keeps its full value (components/identifier.tsx). */ .identifier { position: relative; @@ -562,8 +282,11 @@ time { margin: 0; } .dialog-body { - margin-bottom: var(--space-4); - color: var(--ui-muted); + display: grid; + gap: var(--space-2); +} +.dialog-body > p { + margin: 0; } .digest abbr { white-space: nowrap; @@ -618,132 +341,105 @@ label.checkbox input { accent-color: var(--ui-accent); } -/* Commits subgrid table. */ -.commit-table { - display: grid; - grid-template-columns: max-content minmax(0, 2fr) minmax(0, 1.5fr) max-content; - column-gap: var(--space-3); -} -.commit-columns, -.commit-list, -.commit-row { - grid-column: 1 / -1; - display: grid; - grid-template-columns: subgrid; -} -.commit-columns, -.commit-row { - align-items: baseline; -} -.commit-columns { - color: var(--ui-muted); - font-size: var(--text-2xs); - font-weight: var(--weight-medium); - padding: 6px 0; - border-block: 1px solid var(--ui-line); -} -.commit-columns > :last-child { - text-align: end; -} -.commit-row > .status { - justify-self: start; -} -.commit-subject { - color: var(--ui-ink); - text-decoration: none; +.commit-statement, +.commit-builds { + overflow-wrap: anywhere; } -.commit-subject:hover { - text-decoration: underline; +.env-group-summary { + margin: 0 0 var(--space-2); } -.commit-subject, -.commit-title, -.commit-author, -.commit-note { +.release-parts { overflow-wrap: anywhere; } -.commit-headline { - margin-inline-start: var(--space-1); - font-weight: var(--weight-medium); + +/* The audit trail's nested lists: a deployment's stages and a folded run's entries. */ +.activity-stages { + display: flex; + flex-wrap: wrap; + gap: var(--space-1) var(--space-3); } -.commit-detail { - display: grid; +.activity-stages > li { + display: inline-flex; + flex-wrap: wrap; gap: var(--space-1); + align-items: baseline; } -.tallies { +.activity-repeated > li { display: flex; flex-wrap: wrap; - gap: var(--space-1); - align-items: center; + gap: var(--space-0) var(--space-3); + align-items: baseline; + padding: var(--space-0) 0; } -.commit-meta { +[data-part="where"] { + margin-inline-start: var(--space-2); color: var(--ui-muted); - font-size: var(--text-xs); +} +.tallies { display: flex; flex-wrap: wrap; - gap: 0 var(--space-2); - justify-content: flex-end; + gap: var(--space-1) var(--space-3); + align-items: center; } .commit-title { color: var(--ui-ink); display: block; font-weight: var(--weight-semibold); } -.commit-row .commit-note { - font-size: var(--text-xs); + +/* A full-bleed piece (banner, description list, disclosure, table) inside a padded page or panel. */ +.bleed-page { + margin-inline: calc(-1 * var(--page-pad-x)); } -.commit-row:last-child { - border-bottom: 0; +.bleed-panel { + margin-inline: calc(-1 * var(--panel-pad-x)); } -.commit-find-hint { - flex-basis: 100%; - margin: 0; - color: var(--ui-muted); - font-size: var(--text-xs); +/* A page of sections: console-ui's full-bleed sections right under the header bar. */ +.page-sections { + margin-inline: calc(-1 * var(--page-pad-x)); + margin-block-start: calc(-1 * var(--page-gap)); } -.commit-find-error { - color: var(--ui-sev-error-text); - font-weight: var(--weight-medium); -} -.commit-statement, -.commit-builds { - overflow-wrap: anywhere; +.result-line { + display: flex; + flex-wrap: wrap; + align-items: baseline; + gap: var(--space-1) var(--space-3); + padding: 0 var(--ui-gutter) var(--space-2); + color: var(--ui-muted); + font-size: var(--text-sm); } -.commit-table + .pager:not(:empty) { - border-top: 1px solid var(--ui-line); - padding-top: var(--space-2); +.result-line p { + margin: 0; } -.env-group { - margin-top: var(--space-2); + +/* A running status turns; the reduced-motion rule in base.css stops it. */ +.glyph-running { + animation: spin 1.4s linear infinite; } -.panel .env-group > h3 { - margin-top: 0; - margin-bottom: var(--space-1); +@keyframes spin { + to { + transform: rotate(360deg); + } } -.env-group-summary { - margin: 0 0 var(--space-2); + +/* A summary line: its parts sit apart whether or not the markup puts a space between them. */ +.detail-summary { + display: inline-flex; + flex-wrap: wrap; + align-items: center; + gap: var(--space-1) var(--space-3); } -@media (width <= 720px) { - .activity-columns { - display: none; - } - .activity li { - grid-template-columns: minmax(0, auto) minmax(0, 1fr); - gap: 0 var(--space-2); - } - .activity-subject { - grid-column: 1 / -1; - } - .commit-columns { - display: none; - } - .commit-table { - grid-template-columns: minmax(0, 1fr); - } - .commit-meta { - justify-content: flex-start; - } + +/* What an audit row is about: its parts sit apart whether or not the markup puts a space between them. */ +.activity-subject { + display: flex; + flex-wrap: wrap; + gap: var(--space-0) var(--space-3); + align-items: baseline; + min-width: 0; } -.release-parts { - overflow-wrap: anywhere; +/* A pipeline's name breaks between words, never inside one. */ +.pipeline-name { + overflow-wrap: normal; } diff --git a/packages/delivery/src/client/styles/deployment.css b/packages/delivery/src/client/styles/deployment.css index 88f6a5459ae..52f5b56d5ab 100644 --- a/packages/delivery/src/client/styles/deployment.css +++ b/packages/delivery/src/client/styles/deployment.css @@ -101,13 +101,6 @@ .step-key { overflow-wrap: anywhere; } -.step-head .status { - max-width: 100%; - white-space: normal; -} -.step-head .status-label { - overflow-wrap: anywhere; -} .step-meta, .evidence-meta { color: var(--ui-muted); @@ -135,12 +128,6 @@ font-size: var(--text-mono); overflow-wrap: anywhere; } -.receipt .facts { - margin: var(--space-1) 0 0; -} -.receipt-wide .facts { - grid-template-columns: minmax(0, 1fr); -} .receipt-nested { margin: 0; } @@ -152,66 +139,3 @@ .receipt-nested:last-child > .receipt-json { margin-bottom: 0; } - -.activity-subject { - display: flex; - flex-wrap: wrap; - gap: var(--space-0) var(--space-3); - align-items: baseline; - min-width: 0; -} -.activity .activity-stages { - display: flex; - flex-wrap: wrap; - gap: var(--space-1) var(--space-3); - list-style: none; - margin: 0; - padding: 0; -} -.activity .activity-stages > li { - display: inline-flex; - flex-wrap: wrap; - gap: var(--space-1); - align-items: baseline; - padding: 0; - border: 0; -} -.activity .activity-repeated { - list-style: none; - margin: 0; - padding: 0; -} -.activity .activity-repeated > li { - display: flex; - flex-wrap: wrap; - gap: var(--space-0) var(--space-3); - align-items: baseline; - margin: 0; - padding: var(--space-0) 0; - border: 0; -} -.activity-count { - color: var(--ui-muted); - font-variant-numeric: tabular-nums; -} -.activity-where { - margin-inline-start: var(--space-2); - color: var(--ui-muted); -} -.activity-when .clock { - display: block; - font-family: var(--font-mono); - font-size: var(--text-mono); - font-variant-numeric: tabular-nums; -} -.activity-when .clock > [aria-hidden="true"] { - display: none; -} -@media (width <= 720px) { - .activity-when .clock { - display: inline; - } - .activity-when .clock > [aria-hidden="true"] { - display: inline; - } -} diff --git a/packages/delivery/src/client/styles/environment.css b/packages/delivery/src/client/styles/environment.css index b330b8c4d92..c0876c61561 100644 --- a/packages/delivery/src/client/styles/environment.css +++ b/packages/delivery/src/client/styles/environment.css @@ -4,16 +4,6 @@ .environment-in-flight { text-decoration: none; } -.environment-in-flight .status-label { - text-decoration: underline; -} - -.environment-notice > p { - margin: 0; -} -.environment-notice > p + p { - margin-top: var(--space-1); -} .release-notes { display: grid; @@ -51,9 +41,6 @@ margin: 0; padding: 0; } -.candidate-origin .disclosure > summary { - font-size: var(--text-xs); -} .worker-group { list-style: none; margin: 0; @@ -61,10 +48,6 @@ display: grid; gap: var(--space-1); } -.candidates + .disclosure > .disclosure-body { - padding-inline-start: 0; - padding-bottom: 0; -} .worker-table td { vertical-align: middle; @@ -85,28 +68,6 @@ color: var(--ui-muted); font-size: var(--text-xs); } -.worker-table .disclosure > summary { - color: var(--ui-muted); - font-size: var(--text-xs); - font-weight: var(--weight-regular); -} -.worker-provenance .facts { - grid-template-columns: minmax(0, 1fr); - gap: var(--space-1); - margin: 0; -} -.worker-provenance .facts > div { - display: grid; - grid-template-columns: 7.5rem minmax(0, 1fr); - gap: var(--space-2); - align-items: baseline; -} -.worker-provenance .facts dd { - font-weight: var(--weight-regular); -} -.worker-provenance .facts dd.mono { - word-break: break-all; -} .worker-route { display: block; } @@ -141,8 +102,4 @@ .worker-table td:first-child { flex: 1 1 100%; } - .worker-provenance .facts > div { - grid-template-columns: minmax(0, 1fr); - gap: 0; - } } diff --git a/packages/delivery/src/client/styles/layout.css b/packages/delivery/src/client/styles/layout.css index 90c09b9c1c9..31a747645ac 100644 --- a/packages/delivery/src/client/styles/layout.css +++ b/packages/delivery/src/client/styles/layout.css @@ -203,11 +203,6 @@ main > :empty { overflow-x: auto; max-width: 100%; } -.pager { - display: flex; - gap: var(--space-4); -} - /* Inline bordered filter toolbars matching console-ui's `.ui-field[data-layout="inline"]`. */ main .filters { display: flex; @@ -260,119 +255,8 @@ main .filters > label > :is(input, select):focus-visible { gap: var(--space-2) var(--space-3); align-items: end; } -.panel > .filters { - margin-bottom: var(--space-3); -} -.result-summary { - display: flex; - flex-wrap: wrap; - align-items: baseline; - gap: var(--space-1) var(--space-3); - margin-bottom: var(--space-2); - font-size: var(--text-sm); -} -.result-summary p { - margin: 0; -} -.list-panel .pager:not(:empty) { - border-top: 1px solid var(--ui-line); - padding-top: var(--space-2); - margin-top: var(--space-2); -} -.list-panel h2:focus { - outline: none; -} -.list-panel h2:focus-visible { - outline: 2px solid var(--ui-accent); -} - -/* - * A table of records that, narrower than 600px, reads as one stacked block per - * row: the row header, then each cell under its `data-label`. - */ -.stack-table { - container-type: inline-size; -} -@container (width < 600px) { - .stack-table thead { - display: none; - } - .stack-table :is(table, tbody, tr, th, td) { - display: block; - } - .stack-table tr { - padding: var(--space-2) var(--panel-pad-x); - border-bottom: 1px solid var(--ui-line-soft); - } - .stack-table :is(th, td) { - border: 0; - padding: var(--space-1) 0; - } - .stack-table :is(th, td):first-child, - .stack-table :is(th, td):last-child { - padding-inline: 0; - } - .stack-table td { - display: grid; - grid-template-columns: 6rem minmax(0, 1fr); - gap: var(--space-2); - align-items: baseline; - } - .stack-table td > * { - grid-column: 2; - min-width: 0; - max-width: 100%; - overflow-wrap: anywhere; - } - .stack-table td::before { - content: attr(data-label); - font-size: var(--text-xs); - color: var(--ui-muted); - } -} - -@media (width <= 720px) { - .build-catalog thead, - .pipeline-table thead { - display: none; - } - .build-catalog tr, - .pipeline-table tr { - display: block; - padding: var(--space-2) var(--panel-pad-x); - border-bottom: 1px solid var(--ui-line-soft); - } - .build-catalog :is(th, td):first-child, - .build-catalog :is(th, td):last-child, - .pipeline-table :is(th, td):first-child, - .pipeline-table :is(th, td):last-child { - padding-inline: 0; - } - .build-catalog td, - .pipeline-table td { - display: grid; - grid-template-columns: 7.5rem minmax(0, 1fr); - gap: var(--space-2); - align-items: baseline; - border: 0; - padding: var(--space-1) 0; - } - .build-catalog th { - display: block; - border: 0; - padding: 0 0 var(--space-1); - } - .build-catalog td::before, - .pipeline-table td::before { - content: attr(data-label); - font-size: var(--text-xs); - color: var(--ui-muted); - } -} - @media (pointer: coarse) { main button, - dialog button, details > summary { min-height: var(--control-height); } diff --git a/packages/delivery/src/client/styles/overview.css b/packages/delivery/src/client/styles/overview.css index d5795b847e3..6746d93cfbd 100644 --- a/packages/delivery/src/client/styles/overview.css +++ b/packages/delivery/src/client/styles/overview.css @@ -1,209 +1,139 @@ /* - * The overview: every active service as a tile, in one panel per catalog - * kind, styled with console-ui surfaces and severity borders. + * The overview: a figure strip, what needs someone, the filters, then one + * table of services per catalog kind. Built from console-ui's Section, + * FigureStrip, ui-table, StatusGlyph and Button; what is here is layout only, + * on `--ui-*` tokens. */ -/* What needs a person comes first and is edged in the tone of its worst item. */ -.attention-failed, -.attention-waiting { - border-inline-start-width: 3px; +/* What needs a person: kind, lead, summary and time sit in the same columns on every row. */ +.attention { + list-style: none; + margin: 0; + padding: 0; +} +.attention-row { + display: grid; + grid-template-columns: 6rem minmax(0, 22rem) minmax(0, 1fr) 8.5rem; + gap: var(--ui-space-1) var(--ui-space-3); + align-items: baseline; + padding: var(--ui-space-2) var(--ui-gutter); + border-top: 1px solid var(--ui-line-soft); + line-height: 1.4; } -.attention-failed { - border-inline-start-color: var(--ui-sev-error); +.attention-kind { + justify-self: start; } -.attention-waiting { - border-inline-start-color: var(--ui-sev-warning); +.attention-lead { + font-weight: var(--ui-weight-medium); } -.attention .section-heading { - margin-bottom: var(--space-1); +.attention-lead, +.attention-summary { + overflow-wrap: anywhere; } -.attention-count { - color: var(--ui-faint); - font-size: var(--text-sm); +.attention-when { + grid-column: 4; + justify-self: end; + text-align: end; + color: var(--ui-muted); + font-size: var(--ui-text-sm); font-variant-numeric: tabular-nums; } +@media (width <= 720px) { + .attention-row { + grid-template-columns: auto minmax(0, 1fr); + } + .attention-lead, + .attention-summary { + grid-column: 1 / -1; + } + .attention-when { + grid-column: 2; + grid-row: 1; + } +} -.overview-toolbar { - display: flex; - flex-wrap: wrap; - justify-content: space-between; - align-items: center; - gap: var(--space-2) var(--space-4); +/* The filters sit under a hairline; it overlaps the strip's own line when nothing needs attention. */ +.overview-filter { + margin-top: -1px; + border-top: 1px solid var(--ui-line); } -.overview-total { - margin: 0; +.filter-count { + margin-block: 0; color: var(--ui-muted); - font-size: var(--text-sm); + font-size: var(--ui-text-md); font-variant-numeric: tabular-nums; } -.overview-kind .section-heading { - align-items: center; -} -.overview-counts, -.overview-tiles, -.overview-chips { +.overview-counts { list-style: none; margin: 0; padding: 0; -} -.overview-counts { display: flex; flex-wrap: wrap; - gap: var(--space-2); -} -/* A catalog group of several services: a labelled run of tiles in its panel. */ -.overview-group { - margin-top: var(--space-4); -} -.overview-group .section-heading { - margin-bottom: var(--space-1); -} -.overview-group h3 { - margin: 0; - font-size: var(--text-sm); - line-height: var(--leading-snug); - font-weight: var(--weight-semibold); - color: var(--ui-muted); - overflow-wrap: anywhere; -} -/* Every run of tiles in a panel shares one track size, so their columns line up. */ -.overview-tiles { - display: grid; - grid-template-columns: repeat(auto-fill, minmax(min(100%, 13rem), 1fr)); - gap: var(--space-2); + gap: var(--ui-space-2) var(--ui-space-3); } -/* One service: its name, then where it runs. */ -.overview-tile { - min-width: 0; - padding: 8px 10px; - border: 1px solid var(--ui-line); - border-inline-start: 3px solid var(--ui-line); - border-radius: var(--radius-small); - background: var(--ui-head); -} -.overview-standing-failed, -.overview-standing-recovery_required, -.overview-standing-alarmed { - border-inline-start-color: var(--ui-sev-error); -} -.overview-standing-awaiting_approval, -.overview-standing-queued { - border-inline-start-color: var(--ui-sev-warning); -} -.overview-standing-running { - border-inline-start-color: var(--ui-sev-info); -} -.overview-standing-succeeded { - border-inline-start-color: var(--ui-sev-ok); +/* Every table gives the name the same width, so environments line up from one section to the next. */ +@media (width > 720px) { + .overview-name { + width: 16rem; + } } -/* A tile's title is its own line, never a link inside prose, so its color and weight mark it. */ +/* A service's name is its own cell, so its color and weight mark it as the link. */ .overview-service { - display: block; - margin-bottom: var(--space-1); color: var(--ui-ink); - font-weight: var(--weight-semibold); - line-height: var(--leading-snug); + font-weight: var(--ui-weight-medium); text-decoration: none; - overflow-wrap: anywhere; } .overview-service:hover { text-decoration: underline; } -.overview-none { + +/* A service's environments in promotion order; an arrow joins a stage to the one it promotes from. */ +.overview-environments { + list-style: none; margin: 0; - min-height: var(--target-min); - color: var(--ui-muted); - font-size: var(--text-xs); - line-height: var(--target-min); -} -.overview-chips { + padding: 0; display: flex; flex-wrap: wrap; - gap: var(--space-1); + gap: var(--ui-space-1) var(--ui-space-4); } -.overview-chips li { +.overview-environment { display: inline-flex; align-items: center; - gap: var(--space-1); + gap: var(--ui-space-1); min-width: 0; max-width: 100%; } .overview-arrow { color: var(--ui-muted); } -/* An environment as a link: name, standing, accepted revision and its age. */ -.overview-chip { +/* An environment as a link: name, standing, accepted release and its age. */ +.env-link { display: inline-flex; flex-wrap: wrap; align-items: center; - gap: 0 5px; + gap: 0 var(--ui-space-2); min-height: var(--target-min); min-width: 0; max-width: 100%; - padding: 1px 6px; - border: 1px solid var(--ui-line); - border-radius: var(--radius-chip); - background: var(--ui-panel); color: var(--ui-ink); - font-size: var(--text-xs); - line-height: var(--leading-snug); + font-size: var(--ui-text-sm); + line-height: 1.4; text-decoration: none; } -.overview-chip:hover { - background: var(--ui-hover); - border-color: var(--ui-btn-edge); - text-decoration: none; -} -.overview-chip .env-name { - font-weight: var(--weight-semibold); -} -.overview-chip .status { - max-width: 100%; - white-space: normal; - overflow-wrap: anywhere; - position: relative; +.env-link:hover .env-name { + text-decoration: underline; } -.overview-chip-succeeded > .status-succeeded .status-label { - position: absolute; - width: 1px; - height: 1px; - overflow: hidden; - clip-path: inset(50%); - white-space: nowrap; -} -.overview-chip time { - color: var(--ui-muted); +.env-link .env-name { + font-weight: var(--ui-weight-medium); } .overview-accepted { display: inline-flex; flex-wrap: wrap; align-items: baseline; - gap: 0 var(--space-1); + gap: 0 var(--ui-space-1); min-width: 0; max-width: 100%; -} -.badge-queued { - background: var(--ui-sev-warning-soft); - color: var(--ui-sev-warning-text); -} - -@media (width <= 600px) { - .overview-tiles { - grid-template-columns: repeat(2, minmax(0, 1fr)); - gap: 6px; - } - .overview-tile { - padding: 6px 8px; - } - .overview-service { - font-size: var(--text-sm); - } - .overview-chip { - padding-inline: var(--space-1); - } - .overview-kind .disclosure { - margin-top: var(--space-1); - } + color: var(--ui-muted); } diff --git a/packages/delivery/src/client/styles/pipeline.css b/packages/delivery/src/client/styles/pipeline.css index cacc6baacf4..8b29ba2595c 100644 --- a/packages/delivery/src/client/styles/pipeline.css +++ b/packages/delivery/src/client/styles/pipeline.css @@ -1,15 +1,22 @@ /* - * CodePipeline-style stage graph: an ordered list of stage cards on the - * console-ui palette. + * The promotion graph: an ordered list of stage nodes joined by transition + * arrows. Delivery's own widget, built from console-ui tokens, StatusGlyph and + * Disclosure; a stage's state is its glyph and word, never a colour edge. */ +.pipeline-lede { + margin: 0; + padding: 0 var(--ui-gutter) var(--ui-space-2); + color: var(--ui-muted); + font-size: var(--ui-text-md); +} .pipeline-scroll { overflow-x: auto; - padding: var(--space-2) var(--space-0) var(--space-4); + padding: var(--ui-space-2) var(--ui-gutter) var(--ui-space-4); scroll-snap-type: x proximity; container-type: inline-size; } .pipeline { - --stage-gap: var(--space-3); + --stage-gap: var(--ui-space-3); list-style: none; margin: 0; padding: 0; @@ -26,22 +33,22 @@ display: flex; align-items: center; justify-content: center; - gap: var(--space-2); + gap: var(--ui-space-2); min-height: 44px; - font-size: var(--text-xs); - line-height: var(--leading-tight); + font-size: var(--ui-text-sm); + line-height: 1.3; color: var(--ui-muted); } .transition-label { min-width: 0; } -/* Stacked, the arrow points down from one card to the next. */ +/* Stacked, the arrow points down from one node to the next. */ .transition-arrow { flex: none; display: block; width: 1.5px; height: 32px; - background: var(--ui-btn-edge); + background: var(--ui-muted); position: relative; } .transition-arrow::after { @@ -50,17 +57,17 @@ left: -4px; bottom: -1px; border: 4.5px solid transparent; - border-top: 6px solid var(--ui-btn-edge); + border-top: 6px solid var(--ui-muted); border-bottom: 0; } .transition-approval .transition-label { color: var(--ui-sev-warning-text); - font-weight: var(--weight-semibold); + font-weight: var(--ui-weight-strong); } .transition-disabled .transition-arrow { background: repeating-linear-gradient( 180deg, - var(--ui-btn-edge) 0 6px, + var(--ui-muted) 0 6px, transparent 6px 10px ); } @@ -71,134 +78,97 @@ min-width: 0; background: var(--ui-panel); border: 1px solid var(--ui-line); - border-top: 3px solid var(--ui-sev-unknown); - border-radius: var(--radius); - padding: var(--space-3); + border-radius: var(--ui-radius-md); + padding: var(--ui-space-3); display: flex; flex-direction: column; - gap: var(--space-2); -} -.stage-succeeded { - border-top-color: var(--ui-sev-ok); -} -.stage-failed { - border-top-color: var(--ui-sev-error); -} -.stage-running { - border-top-color: var(--ui-sev-info); -} -.stage-awaiting_approval, -.stage-queued, -.stage-pending { - border-top-color: var(--ui-sev-warning); + gap: var(--ui-space-2); } .stage-header { display: flex; flex-wrap: wrap; justify-content: space-between; align-items: baseline; - gap: var(--space-1) var(--space-2); + gap: var(--ui-space-1) var(--ui-space-2); } -.stage-header h3 { +.stage-title { min-width: 0; + margin: 0; + font-size: var(--ui-text-base); + font-weight: var(--ui-weight-strong); overflow-wrap: anywhere; } -.stage-header h3 a { +.stage-link { color: inherit; text-decoration: none; } -.stage-header h3 a:hover { +.stage-link:hover { text-decoration: underline; } .stage-revision { - font-family: var(--font-mono); - font-size: var(--text-mono); margin: 0; + font-family: var(--ui-font-mono); + font-size: var(--ui-text-sm); } .stage-standing { - font-size: var(--text-sm); - font-weight: var(--weight-medium); margin: 0; + font-size: var(--ui-text-md); + font-weight: var(--ui-weight-medium); overflow-wrap: anywhere; } .stage-summary { - font-size: var(--text-sm); - color: var(--ui-muted); margin: 0; + color: var(--ui-muted); + font-size: var(--ui-text-md); } -.stage-card .disclosure > summary { - font-size: var(--text-sm); - line-height: var(--leading-snug); - padding-block: var(--space-1); -} -.stage-card .disclosure > summary::before { - margin-inline-start: 0; -} -.stage-card .disclosure-body { - padding: var(--space-1) 0 0; +.stage-promote { + align-self: flex-start; } +/* A stage's actions: rows split by hairlines, each a glyph and its words. */ .actions { list-style: none; padding: 0; margin: 0; - display: grid; - gap: 6px; } .action { display: grid; grid-template-columns: auto minmax(0, 1fr); - gap: var(--space-2); - padding: 8px; - border: 1px solid var(--ui-line-soft); - border-radius: var(--radius-small); - background: var(--ui-head); - font-size: var(--text-sm); - line-height: var(--leading-snug); -} -.action > .status { - align-self: start; - position: relative; - margin-top: 2px; + align-items: start; + gap: var(--ui-space-2); + padding: var(--ui-space-2) 0; + border-top: 1px solid var(--ui-line-soft); + font-size: var(--ui-text-md); + line-height: 1.4; } .action-body { display: flex; flex-wrap: wrap; align-items: baseline; - column-gap: var(--space-2); + column-gap: var(--ui-space-2); min-width: 0; } -.action-body strong, +.action-title, .action-body .tool-links { flex: 0 0 100%; min-width: 0; } -.action-body strong a { - color: var(--ui-ink); - text-decoration: none; -} -.action-body strong a:hover { - text-decoration: underline; +.action-title { + overflow-wrap: anywhere; } -.action-body p { +.action-text { margin: 0; color: var(--ui-muted); overflow-wrap: anywhere; } -.action-body strong { - overflow-wrap: anywhere; -} .action-meta { - font-size: var(--text-xs); + font-size: var(--ui-text-sm); } .action .tool-link { white-space: normal; overflow-wrap: anywhere; - line-height: var(--leading-snug); + line-height: 1.4; padding-block: 2px; - font-size: var(--text-xs); -} -.action .tool-link > span { - white-space: nowrap; + font-size: var(--ui-text-sm); } @container (width > 720px) { @@ -227,15 +197,13 @@ align-items: start; justify-content: start; min-height: 0; - padding: 0 0 var(--space-2); + padding: 0 0 var(--ui-space-2); } .transition-arrow { - width: calc(var(--stage-gap) + var(--space-4)); + width: calc(var(--stage-gap) + var(--ui-space-4)); height: 1.5px; margin-inline-start: calc(-1 * var(--stage-gap)); - margin-block-start: calc( - (var(--text-xs) * var(--leading-tight) - 1.5px) / 2 - ); + margin-block-start: calc((var(--ui-text-sm) * 1.3 - 1.5px) / 2); } .transition-arrow::after { left: auto; @@ -243,13 +211,13 @@ right: -1px; top: -4px; border: 4.5px solid transparent; - border-left: 6px solid var(--ui-btn-edge); + border-left: 6px solid var(--ui-muted); border-right: 0; } .transition-disabled .transition-arrow { background: repeating-linear-gradient( 90deg, - var(--ui-btn-edge) 0 6px, + var(--ui-muted) 0 6px, transparent 6px 10px ); } diff --git a/packages/delivery/src/client/worker-pool.test.tsx b/packages/delivery/src/client/worker-pool.test.tsx index f868889bc52..bdc5a6010bb 100644 --- a/packages/delivery/src/client/worker-pool.test.tsx +++ b/packages/delivery/src/client/worker-pool.test.tsx @@ -7,7 +7,6 @@ import { WorkerVersionSchema, workerHostSpecification, } from "#shared/worker-contract.ts"; -import { ConfirmDialogProvider } from "#client/components/confirm-dialog.tsx"; import { renderWithRouter } from "#client/test-router.tsx"; import { WorkerPoolPanel, groupWorkers } from "./worker-pool.tsx"; @@ -79,14 +78,12 @@ function panel(options: { versions?: typeof VERSIONS; permitted?: boolean }) { ); return renderWithRouter( - - Promise.resolve()} - /> - + Promise.resolve()} + /> , ).replaceAll("", ""); } @@ -101,7 +98,7 @@ describe("retained workers", () => { const html = panel({}); // A closed disclosure, labelled with how many artifacts it holds. const artifacts = html.indexOf( - '
Retained artifacts with no desired host3', + 'Retained artifacts with no desired host3', ); expect(artifacts).toBeGreaterThan(-1); const hosted = rows(html.slice(0, artifacts)); @@ -132,17 +129,17 @@ describe("retained workers", () => { expect(retained.match(/scout-prod-workflows · prod / scout-prod', + 'scout-prod-workflows · prod / scout-prod', ); const provenance = retained.slice(retained.indexOf("worker-provenance")); expect(provenance).toContain( - `
Image
docker.io/shepherdjerred/scout-for-lol@${digest}
`, + `
Image
docker.io/shepherdjerred/scout-for-lol@${digest}
`, ); expect(provenance).toContain( - `
Build
${build}
`, + `
Build
${build}
`, ); expect(provenance).toContain( - '
Artifact
scout-prod/image/b · build artifact-build-b
', + '
Artifact
scout-prod/image/b · build artifact-build-b
', ); expect(provenance).toContain(`href="/deployments/${INTRODUCED}"`); expect(provenance).toContain("
scout-prod · scout-prod-workflows
"); @@ -154,9 +151,10 @@ describe("retained workers", () => { expect(selected).not.toContain("Request retirement"); const described = /id="(?[^"]+)"/u.exec(retained)?.groups?.["id"]; expect(described).toBeDefined(); - expect(retained).toContain( - ``, + expect(retained).toMatch( + /]*data-variant="danger"[^>]*>Request retirement<\/button>/u, ); + expect(retained).toContain(`aria-describedby="${described ?? ""}"`); expect(panel({ permitted: false })).not.toContain("Request retirement"); }); @@ -170,7 +168,7 @@ describe("retained workers", () => { expect(group).toContain("3 builds"); expect(group).toContain("1 · retained each"); expect(group).toContain( - 'scout-prod-workflows · prod / scout-prod3', + 'scout-prod-workflows · prod / scout-prod3', ); expect(group.match(/>Build details { const html = panel({ versions: [SELECTED, worker("c", 0), elsewhere] }); const [group = ""] = rows(html.slice(html.indexOf("Retained artifacts"))); expect(group).toContain("2 builds"); - expect(group).toContain('2 hosts'); + expect(group).toContain('2 hosts'); expect(group).toContain("Zero · artifacts retained"); }); test("a pool with no desired host says so above its collapsed artifacts", () => { const html = panel({ versions: [worker("c", 0)] }); expect(html).toContain("No worker build has a desired host."); - expect(html).toContain('1'); + expect(html).toContain('1'); expect(rows(html)).toHaveLength(1); }); - test("every row asks through the page's one dialog", () => { - expect(panel({}).match(/ { + expect(panel({})).not.toContain("

Frozen worker pool

{snapshot.workerOperation === "baseline" && ( -

+ Host-only baseline adoption independently verifies existing workers. It does not accept or change the full application release. -

+ )}

Selected build{" "} @@ -62,10 +62,10 @@ export function FrozenWorkerPool({

)} {snapshot.workerOperation === "retire" && ( -

+ Retirement requested for {snapshot.retiringWorkerId}. Scale to zero requires fresh routing and drain proof during execution. -

+ )}

These exact desired hosts are bound to this deployment and its approval. @@ -133,9 +133,9 @@ function WorkerSummary({ - +

- + {worker.buildId} @@ -235,7 +235,8 @@ function WorkerGroupRow({ {workers.length} builds {selected === undefined && ( -

+ Retirement becomes available after acceptance records a frozen worker pool. -

+ )} {retirement.error !== null && } {hosted.length === 0 ? ( @@ -450,7 +451,8 @@ export function WorkerPoolPanel({ )} {unhosted.length > 0 && (