Public: anyone can read this; the crew can change it.

Empty words: move the apps and forges pages onto the shared table #15906

Merged opened this

Check · Review · Land · Live done — Landed and live in production.

Merged

mason/forge:mason/15902-empty-words-move-the-apps-and-forges-pag → main 6 commits fork 2 threads · 2 unresolved

  • Merged. mason/15902-empty-words-move-the-apps-and-forges-pag was merged into main as 1152d5c.

Review

Sign in to review this change.
12 files changed +111 −78
src/core/empty_words.ts +27 −24
@@ -5,45 +5,44 @@
55 * every kind and holds each to its sentence and its single link.
66 */
77
8 export type EmptyKind = "board" | "inbox" | "runs" | "apps" | "people" | "waves"
9 | "builds"
10 | "releases"
11 | "forks"
12 | "repos"
13 | "commits"
14 | "displays"
15 | "issues"
16 | "pulls"
17 | "branches"
18 | "labels"
19 | "events";
20
218 export interface EmptyWords {
229 /** One sentence, plain words, ending in a full stop. */
2310 readonly sentence: string;
24 /**
25 * Why it is empty, in one calm sentence, only where the page does not already say it: a list that
26 * names what it is carries none (nothing explains itself twice).
27 */
11 /** Said under the sentence, only where the page does not already say what the list is. */
2812 readonly reason?: string;
2913 /** The one action's words, only where one exists. */
3014 readonly label?: string;
31 /**
32 * Where the action goes, only where that place exists unscoped; a repository's list hands in its
33 * own (`emptyList(kind, { href })`), and a label with no href and none handed in draws no link.
34 */
15 /** Where the action goes, only where that place exists unscoped; a list hands in its own. */
3516 readonly href?: string;
3617 }
3718
38 export const EMPTY_WORDS: Readonly<Record<EmptyKind, EmptyWords>> = {
19 const TABLE = {
3920 board: { sentence: "No board yet.", label: "Start from a question", href: "/boards/data" },
4021 inbox: { sentence: "Nothing is waiting on you.", label: "Tell the crew something", href: "/tell" },
4122 runs: { sentence: "No run is open.", label: "Start with an issue", href: "/issues" },
4223 apps: { sentence: "Nothing runs here yet.", label: "New app", href: "/apps/new" },
4324 waves: { sentence: "No waves yet.", label: "Tell the crew", href: "/tell" },
4425 people: { sentence: "Nobody has joined yet.", label: "Invite someone", href: "/admin/limits" },
45 builds: { sentence: "No builds yet.", label: "Pin one from a branch" },
26 // Lists whose place exists only inside a page that already offers the next step (a form just
27 // below): no label, so no link.
28 appReleases: { sentence: "No release yet.", reason: "A release is recorded when production first serves a new version." },
29 templates: { sentence: "No template is marked." },
30 variants: { sentence: "No variants yet.", reason: "Register a branch to run it as a variant." },
31 cloudAccounts: { sentence: "No cloud account is sealed yet.", reason: "Add one below: pick a provider, name it, paste its credential." },
32 cloudReads: { sentence: "No credential has been read yet." },
33 vendorCalls: { sentence: "No vendor call today.", reason: "Rows are kept 90 days." },
34 forgeNames: { sentence: "No other name yet.", reason: "Add one below, or allow one when a forge asks." },
35 forgesOwn: { sentence: "No forge has asked for a name, and none has one of its own." },
36 refused: { sentence: "No first ask has been refused." },
37 databases: { sentence: "No database yet.", reason: "An app's SQLite files appear here once it has written one under its data directory." },
38 rows: { sentence: "No rows." },
39 talkRepos: { sentence: "No repository yet." },
40 talkFiles: { sentence: "No files touched yet." },
41 talkPulls: { sentence: "No open pull yet." },
42 talkHidden: { sentence: "Not a repository you can see." },
43 talkIdle: { sentence: "Nothing running yet." },
4644 releases: { sentence: "No releases yet.", reason: "A pull landed on the forge's own repository is recorded here." },
45 builds: { sentence: "No builds yet.", label: "Pin one from a branch" },
4746 forks: { sentence: "No forks yet.", reason: "A fork is a copy under another name that can propose changes back here, and follows this one until it has work of its own." },
4847 repos: { sentence: "No repositories yet.", label: "New repository", href: "/new" },
4948 commits: { sentence: "No commits yet.", reason: "Push a branch and its history shows up here." },
@@ -53,4 +52,8 @@ export const EMPTY_WORDS: Readonly<Record<EmptyKind, EmptyWords>> = {
5352 labels: { sentence: "No labels yet." },
5453 events: { sentence: "No events yet." },
5554 displays: { sentence: "No displays yet.", reason: "Add a display.json to a repository's default branch to make one." },
56 };
55 } as const satisfies Readonly<Record<string, EmptyWords>>;
56
57 export type EmptyKind = keyof typeof TABLE;
58
59 export const EMPTY_WORDS: Readonly<Record<EmptyKind, EmptyWords>> = TABLE;
src/web/empty_words.ts +27 −12
@@ -5,21 +5,26 @@
55 * `test/empty-states.test.ts` walks every kind and holds each to its sentence and its single link.
66 */
77
8 import type { Html } from "./html.ts";
9 import { EMPTY_WORDS, type EmptyKind } from "../core/empty_words.ts";
8 import { html, type Html } from "./html.ts";
9 import { EMPTY_WORDS, type EmptyKind, type EmptyWords } from "../core/empty_words.ts";
1010 import { btn, empty, type IconName } from "./ui.ts";
1111
1212 export { EMPTY_WORDS, type EmptyKind };
1313
14 const ICONS: Readonly<Record<EmptyKind, IconName>> = {
14 /** The kinds drawn as a block with a picture; every other kind is a quiet line (`emptyLine`). */
15 const ICONS = {
1516 board: "activity",
1617 inbox: "check",
1718 runs: "bot",
18 apps: "repo",
19 apps: "rocket",
1920 people: "users",
2021 waves: "activity",
21 builds: "pin",
2222 releases: "activity",
23 appReleases: "tag",
24 variants: "branch",
25 databases: "folder",
26 rows: "search",
27 builds: "pin",
2328 forks: "fork",
2429 repos: "repo",
2530 commits: "commit",
@@ -29,32 +34,42 @@ const ICONS: Readonly<Record<EmptyKind, IconName>> = {
2934 branches: "branch",
3035 labels: "tag",
3136 events: "activity",
32 };
37 } as const satisfies Partial<Record<EmptyKind, IconName>>;
3338
3439 export interface EmptyOptions {
3540 /** Where the action goes, when it is not the table's (a repository's own issues, say). */
3641 href?: string;
3742 /** Leave the link out: the viewer cannot take the action, or the page already offers it. */
3843 noAction?: boolean;
44 /** A reason that fits this one list (a filter that matched nothing), over the table's. */
45 reason?: string;
46 /** Alias of `reason`, for a list whose reason is read live. */
47 note?: string;
3948 /** A filtered view names its filter ("No closed issues"); the reason stays the table's. */
4049 title?: string;
41 /** A list whose reason is its own (an origin's list, read live) hands it in. */
42 note?: string;
4350 /** A page that has its own action (a link back to the unfiltered list) hands it in. */
4451 action?: Html;
4552 bind?: string | undefined;
4653 }
outdated

Hard to read: a ?? b ? x : y plus !. Name reason and href once. And add tests for reason, per-call reason and no-label.

4754
48 export function emptyList(kind: EmptyKind, o: EmptyOptions = {}): Html {
49 const w = EMPTY_WORDS[kind];
50 const note = o.note ?? w.reason;
55 export function emptyList(kind: keyof typeof ICONS, o: EmptyOptions = {}): Html {
56 const w: EmptyWords = EMPTY_WORDS[kind];
57 const reason = o.reason ?? o.note ?? w.reason;
5158 const href = o.href ?? w.href;
5259 const action = o.action ?? (o.noAction || w.label === undefined || href === undefined ? undefined : btn(w.label, { href, variant: "link" }));
5360 return empty({
5461 icon: ICONS[kind],
5562 title: o.title ?? w.sentence,
56 ...(note === undefined ? {} : { note }),
63 ...(reason === undefined ? {} : { note: reason }),
5764 ...(action === undefined ? {} : { action }),
5865 bind: o.bind,
5966 });
6067 }
68
69 /** A list of none inside a block that already has its next step (a form just below): one muted
70 * line, the sentence and its reason, no picture and no link, so the form stays in view. */
71 export function emptyLine(kind: Exclude<EmptyKind, keyof typeof ICONS>, o: { reason?: string } = {}): Html {
72 const w: EmptyWords = EMPTY_WORDS[kind];
73 const reason = o.reason ?? w.reason;
74 return html`<p class="muted small">${reason === undefined ? w.sentence : `${w.sentence} ${reason}`}</p>`;
75 }
src/web/pages/app_releases.ts +3 −5
@@ -10,7 +10,8 @@ import { releaseFacts } from "../../release/app_words.ts";
1010 import { loadRepo, notFoundPage, pageHead, repoBase } from "../chrome.ts";
1111 import { html } from "../html.ts";
1212 import { page } from "../layout.ts";
13 import { empty, row, sha, time } from "../ui.ts";
13 import { row, sha, time } from "../ui.ts";
14 import { emptyList } from "../empty_words.ts";
1415
1516 export function appReleasesPage(ctx: Ctx): Response {
1617 notePhase(ctx.request, "session", takeSessionTime(ctx.request));
@@ -23,10 +24,7 @@ export function appReleasesPage(ctx: Ctx): Response {
2324 body: html`<div class="narrow-wide">
2425 ${pageHead("Releases", { sub: `Each version ${repo.ownerName}/${repo.name} first served in production.` })}
2526 ${releases.length === 0
26 ? empty({
27 title: "No release yet",
28 note: "A release is recorded when production first serves a new version.",
29 })
27 ? emptyList("appReleases", { noAction: true })
3028 : html`<ul class="list" aria-label="Releases">${releases.map((r) =>
3129 row({
3230 title: html`${r.version} · ${r.subject}`,
src/web/pages/app_templates.ts +2 −1
@@ -13,6 +13,7 @@ import { field, readForm } from "../form.ts";
1313 import { html } from "../html.ts";
1414 import { flashTo, page } from "../layout.ts";
1515 import { btn, empty, field as formField, icon, row } from "../ui.ts";
16 import { emptyLine } from "../empty_words.ts";
1617 import { accountSections } from "./origins.ts";
1718
1819 function denied(ctx: Ctx): Response | undefined {
@@ -59,7 +60,7 @@ export function appTemplatesPage(ctx: Ctx): Response {
5960 });
6061 const body = html`<section class="settings-block">
6162 <p class="muted">The repositories New app can copy.</p>
62 ${rows.length === 0 ? html`<p class="muted">No template is marked.</p>` : html`<ul class="list setting-list">${rows}</ul>`}
63 ${rows.length === 0 ? emptyLine("templates") : html`<ul class="list setting-list">${rows}</ul>`}
6364 <form method="post" action="/settings/app-templates">
6465 <input type="hidden" name="marked" value="1" />
6566 ${formField({ label: "Mark a repository", name: "repo", placeholder: "owner/name", mono: true, required: true })}
src/web/pages/app_variants.ts +3 −2
@@ -22,7 +22,8 @@ import { crumbsFor, loadRepo, notFoundPage, repoBase, repoHeader, repoPalette, s
2222 import { field as formValue, readForm, type Form } from "../form.ts";
2323 import { html, when, type Html } from "../html.ts";
2424 import { flashTo, page } from "../layout.ts";
25 import { badge, btn, confirmAction, disclosure, empty, field, listCard, row } from "../ui.ts";
25 import { badge, btn, confirmAction, disclosure, field, listCard, row } from "../ui.ts";
26 import { emptyList } from "../empty_words.ts";
2627
2728 const hidden = (error: string): boolean => error === "unauthorized" || error === "not_found" || error === "forbidden";
2829
@@ -79,7 +80,7 @@ export async function variantBoardPage(ctx: Ctx): Promise<Response> {
7980 <h2 class="mt">Variants</h2>
8081 <p class="muted small">A branch kept running beside production, with values of its own: ${budget}.</p>
8182 ${board.cards.length === 0
82 ? empty({ title: "No variants yet", note: "Register a branch to run it as a variant." })
83 ? emptyList("variants", { noAction: true })
8384 : listCard(board.cards.map((c) => variantRow(base, c, writer)))}
8485 ${when(writer && board.cards.length < VARIANTS_MAX, () => html`<form method="post" action="${base}/variants" class="mt">
8586 <h3>Run a branch as a variant</h3>
src/web/pages/cloud.ts +4 −3
@@ -32,6 +32,7 @@ import { field, readForm } from "../form.ts";
3232 import { html, type Html } from "../html.ts";
3333 import { flashTo, page } from "../layout.ts";
3434 import { btn, confirmAction, icon, row, time } from "../ui.ts";
35 import { emptyLine } from "../empty_words.ts";
3536 import { accountSections } from "./origins.ts";
3637
3738 const BACK = "/settings/cloud";
@@ -100,7 +101,7 @@ function accountsCard(accounts: CloudAccount[], reads: CloudRead[], uses: Map<st
100101 <p class="muted small">Paste a credential once; the forge checks it read-only, seals it, and never shows it again.</p>
101102 ${rows.length > 0
102103 ? html`<ul class="list setting-list">${rows}</ul>`
103 : html`<p class="muted small">No cloud account is sealed yet. Add one below: pick a provider, name it, paste its credential.</p>`}
104 : emptyLine("cloudAccounts")}
104105 </section>
105106 <section class="settings-block">
106107 <h2>Add an account</h2>
@@ -123,7 +124,7 @@ function readsCard(reads: CloudRead[]): Html {
123124 return html`<section class="settings-block">
124125 <h2>Every read</h2>
125126 ${reads.length === 0
126 ? html`<p class="muted small">No credential has been read yet.</p>`
127 ? emptyLine("cloudReads")
127128 : html`<ul class="list">
128129 ${reads.map((r) =>
129130 row({
@@ -227,7 +228,7 @@ export function cloudAuditPage(ctx: Ctx): Response {
227228 html`<section class="settings-block">
228229 <h2>Today's vendor calls</h2>
229230 ${rows.length === 0
230 ? html`<p class="muted small">No vendor call today. Rows are kept 90 days.</p>`
231 ? emptyLine("vendorCalls")
231232 : html`<ul class="list">
232233 ${rows.map((r) =>
233234 row({
src/web/pages/data_view.ts +5 −7
@@ -11,7 +11,8 @@ import { PAGE_SIZE, rows, tables, topValues, type RowsResult } from "../../data/
1111 import { query } from "../../data/query.ts";
1212 import type { Source } from "../../data/sources.ts";
1313 import { html, type Html } from "../html.ts";
14 import { btn, empty, field, iconBtn, pager, row } from "../ui.ts";
14 import { btn, field, iconBtn, pager, row } from "../ui.ts";
15 import { emptyList } from "../empty_words.ts";
1516
1617 /** Longest SQL an address may carry. */
1718 export const SQL_MAX = 4000;
@@ -96,10 +97,7 @@ export async function dataBody(view: DataView, q: URLSearchParams): Promise<Html
9697 const envOf = (s: Source) => s.id.split(":")[2] ?? "";
9798 const files =
9899 sources.length === 0
99 ? empty({
100 title: "No database yet",
101 note: "An app's SQLite files appear here once it has written one under its data directory.",
102 })
100 ? emptyList("databases", { noAction: true })
103101 : view.byEnv
104102 ? html`${[...new Set(sources.map(envOf))].map(
105103 (env) => html`<h2>${env}</h2><ul class="list">${sources.filter((s) => envOf(s) === env).map(fileRow)}</ul>`,
@@ -192,7 +190,7 @@ export async function dataBody(view: DataView, q: URLSearchParams): Promise<Html
192190 </form>
193191 ${note ? html`<p class="muted small">${note}</p>` : null}
194192 ${exact && text !== "" ? html`<p class="muted small">Rows where ${col ?? ""} equals “${text}”. Filtering again finds rows that contain the text.</p>` : null}
195 ${shown.rows.length === 0 ? empty({ title: "No rows", note: text !== "" ? "Nothing matches that filter." : "This table is empty." }) : grid(cols, shown.rows, `${tableName} in ${source.label}`, header, true)}
193 ${shown.rows.length === 0 ? emptyList("rows", { noAction: true, reason: text !== "" ? "Nothing matches that filter." : "This table is empty." }) : grid(cols, shown.rows, `${tableName} in ${source.label}`, header, true)}
196194 ${pager({
197195 note: `${shown.total} rows`,
198196 words: { prev: "Previous page", next: "Next page" },
@@ -226,7 +224,7 @@ export async function dataBody(view: DataView, q: URLSearchParams): Promise<Html
226224 const ms = Math.max(1, Math.round(performance.now() - t0));
227225 out = result.ok
228226 ? html`${out}
229 ${result.rows.length === 0 ? empty({ title: "No rows" }) : grid(result.columns, result.rows, "Query result", (c) => html`<th scope="col">${c}</th>`, false)}
227 ${result.rows.length === 0 ? emptyList("rows", { noAction: true }) : grid(result.columns, result.rows, "Query result", (c) => html`<th scope="col">${c}</th>`, false)}
230228 <p class="muted small">${String(result.rowsRead)} rows read${result.truncated ? " (cut)" : ""} · ${String(result.elapsedMs)} ms</p>`
231229 : html`${out}<p role="alert" class="muted">${result.message} · ${String(ms)} ms</p>`;
232230 }
src/web/pages/forges-refused.ts +2 −1
@@ -12,6 +12,7 @@ import { notFoundPage, pageHead } from "../chrome.ts";
1212 import { html } from "../html.ts";
1313 import { page } from "../layout.ts";
1414 import { time } from "../ui.ts";
15 import { emptyLine } from "../empty_words.ts";
1516
1617 export { REFUSED_SHOWN };
1718
@@ -27,7 +28,7 @@ export function forgesRefusedPage(ctx: Ctx): Response {
2728 body: html`<div class="narrow-wide" data-refused>
2829 ${pageHead("Refused first asks", { sub: `The last ${REFUSED_SHOWN} first asks the forge turned away, newest first.` })}
2930 ${rows.length === 0
30 ? html`<p class="muted">No first ask has been refused.</p>`
31 ? emptyLine("refused")
3132 : html`<ul class="list setting-list">
3233 ${rows.map(
3334 (r) => html`<li data-refusal>
src/web/pages/hosted-forges.ts +3 −6
@@ -34,6 +34,7 @@ import { backTo, field as formField, readForm } from "../form.ts";
3434 import { html, type Html } from "../html.ts";
3535 import { flashTo, page } from "../layout.ts";
3636 import { badge, btn, field, row, time } from "../ui.ts";
37 import { emptyLine } from "../empty_words.ts";
3738 import { accountSections } from "./origins.ts";
3839
3940 /** What the switch turns on, in the words the page and every pointer to it use. */
@@ -179,9 +180,7 @@ export async function hostedForgesPage(ctx: Ctx): Promise<Response> {
179180 </ul>
180181 <h3 class="mt" id="reach-also">and also:</h3>
181182 ${view.everyForge.length === 0
182 ? html`<p class="muted small">
183 No other name yet. Add one below, or allow one when a forge asks.
184 </p>`
183 ? emptyLine("forgeNames")
185184 : html`<ul class="list setting-list" data-reach-every>
186185 ${view.everyForge.map((g) =>
187186 row({
@@ -216,9 +215,7 @@ export async function hostedForgesPage(ctx: Ctx): Promise<Response> {
216215 </form>
217216 <h3 class="mt" id="reach-forges">and for one forge only:</h3>
218217 ${view.forges.length === 0
219 ? html`<p class="muted small">
220 No forge has asked for a name, and none has one of its own.
221 </p>`
218 ? emptyLine("forgesOwn")
222219 : html`${waiting.length === 0
223220 ? null
224221 : html`<p class="small" role="status" data-reach-waiting>
src/web/pages/talk_preview.ts +8 −7
@@ -16,6 +16,7 @@ import type { User } from "../../core/users.ts";
1616 import type { Work } from "../../core/talk_work.ts";
1717 import type { Ctx } from "../../http/context.ts";
1818 import { html, raw, type Html } from "../html.ts";
19 import { emptyLine } from "../empty_words.ts";
1920
2021 export interface Pane {
2122 readonly html: Html;
@@ -27,27 +28,27 @@ export const VIEWS = ["preview", "code", "diff"] as const;
2728 export type View = (typeof VIEWS)[number];
2829
2930 export function talkPane(ctx: Ctx, user: User, name: string | undefined, works: ReadonlyMap<string, Work>, view: View = "preview", apps?: Apps): Pane {
30 const empty = (words: string): Pane => ({
31 const empty = (words: Html): Pane => ({
3132 frame: undefined,
32 html: html`<aside class="talk-pane" aria-label="Preview"><p class="muted small">${words}</p></aside>`,
33 html: html`<aside class="talk-pane" aria-label="Preview">${words}</aside>`,
3334 });
34 if (name === undefined) return empty("No repository yet.");
35 if (name === undefined) return empty(emptyLine("talkRepos"));
3536 const ws = workspaceOf(ctx.app, user, name, apps);
36 if (ws === undefined) return empty("Not a repository you can see.");
37 if (ws === undefined) return empty(emptyLine("talkHidden"));
3738 const { pull, url } = ws;
3839 const tab = (id: View, label: string): Html => html`<a href="?pane=${id}"${view === id ? raw(' aria-current="page"') : null}>${label}</a>`;
3940 const files = [...new Map([...works.values()].flatMap((w) => w.links).filter((l) => l.href.includes("/blob/")).map((l) => [l.href, l] as const)).values()].slice(0, 12);
4041 const panel =
4142 view === "code"
4243 ? files.length === 0
43 ? html`<p class="muted small">No files touched yet.</p>`
44 ? emptyLine("talkFiles")
4445 : html`<ul class="list">${files.map((f) => html`<li><a href="${f.href}">${f.label}</a></li>`)}</ul>`
4546 : view === "diff"
4647 ? pull === undefined
47 ? html`<p class="muted small">No open pull yet.</p>`
48 ? emptyLine("talkPulls")
4849 : html`<p><a class="btn" href="/${name}/pulls/${String(pull)}/files">Diff of pull #${String(pull)}</a></p>`
4950 : url === undefined
50 ? html`<p class="muted small">Nothing running yet.</p>`
51 ? emptyLine("talkIdle")
5152 : html`<iframe class="talk-frame" data-frame src="${url}" title="Live preview of ${name}" referrerpolicy="no-referrer" sandbox="allow-scripts allow-same-origin allow-forms allow-popups"></iframe>`;
5253 return {
5354 frame: ws.origin,
test/empty-states.test.ts +27 −2
@@ -9,9 +9,10 @@ import { join } from "node:path";
99 import { createRepo } from "../src/actions/repos.ts";
1010 import { createApp, type App } from "../src/app.ts";
1111 import { createSession } from "../src/core/sessions.ts";
12 import type { EmptyWords } from "../src/core/empty_words.ts";
1213 import { createUser } from "../src/core/users.ts";
1314 import { serve, type Servers } from "../src/http/server.ts";
14 import { EMPTY_WORDS, emptyList } from "../src/web/empty_words.ts";
15 import { EMPTY_WORDS, emptyLine, emptyList, type EmptyKind } from "../src/web/empty_words.ts";
1516
1617 let dir: string;
1718 let app: App;
@@ -106,7 +107,7 @@ test("the six lists take their empty sentence from one table, each with a single
106107 // people: the signed-in admin is always one, so test/keys-people-list.test.ts holds its sentence
107108 const pages: Record<string, string> = { board: "/boards", inbox: "/live/on-you", runs: "/root/fresh/runs", apps: "/apps", waves: "/root/fresh/waves" };
108109 for (const [kind, path] of Object.entries(pages)) {
109 const w = EMPTY_WORDS[kind as keyof typeof EMPTY_WORDS];
110 const w: EmptyWords = EMPTY_WORDS[kind as EmptyKind];
110111 const blocks = emptyBlocks(await (await fetch(servers.url + path, { headers: { cookie } })).text());
111112 const mine = blocks.filter((b) => b.includes(w.sentence));
112113 expect(mine.length).toBe(1);
@@ -134,6 +135,30 @@ test("emptyList takes its link from the table unless the page names one, and can
134135 expect(people.match(/<a\s/g)?.length).toBe(1);
135136 });
136137
138 test("a kind with a reason draws it under the sentence", () => {
139 const out = String(emptyList("appReleases"));
140 expect(out).toContain(EMPTY_WORDS.appReleases.sentence);
141 expect(out).toContain(EMPTY_WORDS.appReleases.reason!);
142 });
143
144 test("a reason given by the page wins over the table's", () => {
145 const out = String(emptyList("databases", { reason: "Nothing matches that filter." }));
146 expect(out).toContain("Nothing matches that filter.");
147 expect(out).not.toContain(EMPTY_WORDS.databases.reason);
148 });
149
150 test("a kind with no label draws no link, even when the page names a place", () => {
151 expect(String(emptyList("rows"))).not.toMatch(/<a\s/);
152 expect(String(emptyList("rows", { href: "/somewhere" }))).not.toContain("/somewhere");
153 });
154
155 test("emptyLine is one muted line: sentence and reason, no picture, no link", () => {
156 const out = String(emptyLine("forgeNames"));
157 expect(out).toBe(`<p class="muted small">${EMPTY_WORDS.forgeNames.sentence} ${EMPTY_WORDS.forgeNames.reason}</p>`);
158 expect(String(emptyLine("templates"))).toBe(`<p class="muted small">${EMPTY_WORDS.templates.sentence}</p>`);
159 expect(String(emptyLine("talkFiles", { reason: "Ask the crew." }))).toContain("No files touched yet. Ask the crew.");
160 });
161
137162 // One table for every list page a fresh admin can open (#13947): a page that draws an empty state
138163 // has exactly one link or form in it, or is named in ALLOWED with the reason it has none. A failing
139164 // page is named in the failure, so the fix points at the page.
test/empty-words-all.test.ts −8
@@ -29,9 +29,6 @@ const OWN_WORDS: Readonly<Record<string, number>> = {
2929 "src/web/pages/account.ts": 2,
3030 "src/web/pages/accounts.ts": 1,
3131 "src/web/pages/admin-limits.ts": 1,
32 "src/web/pages/app_releases.ts": 1,
33 "src/web/pages/app_templates.ts": 1,
34 "src/web/pages/app_variants.ts": 1,
3532 "src/web/pages/audit.ts": 1,
3633 "src/web/pages/bets.ts": 3,
3734 "src/web/pages/billing.ts": 2,
@@ -42,10 +39,8 @@ const OWN_WORDS: Readonly<Record<string, number>> = {
4239 "src/web/pages/browse.ts": 1,
4340 "src/web/pages/build_shots.ts": 1,
4441 "src/web/pages/capacity.ts": 1,
45 "src/web/pages/cloud.ts": 3,
4642 "src/web/pages/commits.ts": 1,
4743 "src/web/pages/contribute.ts": 1,
48 "src/web/pages/data_view.ts": 3,
4944 "src/web/pages/display.ts": 1,
5045 "src/web/pages/economics.ts": 1,
5146 "src/web/pages/family.ts": 1,
@@ -53,9 +48,7 @@ const OWN_WORDS: Readonly<Record<string, number>> = {
5348 "src/web/pages/flags.ts": 1,
5449 "src/web/pages/flow-panel.ts": 1,
5550 "src/web/pages/flows-all.ts": 1,
56 "src/web/pages/forges-refused.ts": 1,
5751 "src/web/pages/grants.ts": 1,
58 "src/web/pages/hosted-forges.ts": 2,
5952 "src/web/pages/inventory.ts": 1,
6053 "src/web/pages/issues.ts": 1,
6154 "src/web/pages/looks.ts": 1,
@@ -69,7 +62,6 @@ const OWN_WORDS: Readonly<Record<string, number>> = {
6962 "src/web/pages/settings.ts": 1,
7063 "src/web/pages/sources.ts": 1,
7164 "src/web/pages/system.ts": 6,
72 "src/web/pages/talk_preview.ts": 3,
7365 "src/web/pages/teams.ts": 1,
7466 "src/web/pages/trusted.ts": 1,
7567 "src/web/pages/visitors.ts": 1,

↑↓ navigate ↵ open ⌘↵ its app esc close

Keyboard shortcuts

Docs