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

Move the remaining own-worded "No …" empty states onto the empty-words table #15898

Merged opened this

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

Merged

scout/forge:scout/15897-move-the-remaining-own-worded-no-empty-s → main 0 commits fork 2 threads · 2 unresolved

  • Merged. scout/15897-move-the-remaining-own-worded-no-empty-s was merged into main as 5ba3e23.

Review

Sign in to review this change.
29 files changed +156 −52
src/core/empty_words.ts +46
@@ -57,3 +57,49 @@ const TABLE = {
5757 export type EmptyKind = keyof typeof TABLE;
5858
5959 export const EMPTY_WORDS: Readonly<Record<EmptyKind, EmptyWords>> = TABLE;
60
61 /**
62 * The sentence-only empty states: a small note under a card heading, with no action of its own (the
63 * page already carries the door). Each key is its sentence in camelCase, so a reader finds a note
64 * by the words on the page. Pages call `emptyNote(key)` (`src/web/empty_words.ts`) and should not
65 * word their own; `test/empty-notes.test.ts` holds each to one plain sentence and counts the seven
66 * that do, which stay because they carry a link, a variable or a reason a plain sentence cannot.
67 */
68 export const NOTE_WORDS = {
69 nothingToApply: "Nothing to apply.",
70 noDescription: "No description.",
71 noDevicesDeclared: "No devices declared.",
72 noDependenciesListed: "No dependencies listed.",
73 nothingIsWaitingToBeSent: "Nothing is waiting to be sent.",
74 nothingYet: "Nothing yet.",
75 noFlowLinesMatch: "No flow lines match.",
76 notSignedInOnAnyBrowser: "Not signed in on any browser.",
77 noAccessCodesYet: "No access codes yet. Mint one when a script, a CI job, or another machine needs to act as you.",
78 noComputerKeysYet: "No computer keys yet. Add one and git over SSH stops asking for a password.",
79 none: "None.",
80 nothingToPropose: "Nothing to propose.",
81 nothingFound: "Nothing found.",
82 noGateHasRunYet: "No gate has run yet.",
83 nothingQueuedGatingOrLandedInTheLastHour: "Nothing queued, gating or landed in the last hour.",
84 noFileIsTouchedBy3OrMoreOpenPulls: "No file is touched by 3 or more open pulls.",
85 noChangeYet: "No change yet.",
86 noRepositoryRunsOnItsOwn: "No repository runs on its own.",
87 nothingOfferedYet: "Nothing offered yet.",
88 noFlagIsDeclaredYet: "No flag is declared yet.",
89 nothingProposedToTheParentForgeYet: "Nothing proposed to the parent forge yet.",
90 noProcessesWereRead: "No processes were read.",
91 noSamplesYet: "No samples yet.",
92 noStallsInTheLastHour: "No stalls in the last hour.",
93 noFullMinuteMeasuredYet: "No full minute measured yet.",
94 noTelemetryReadsInTheLast10Minutes: "No telemetry reads in the last 10 minutes.",
95 noForgeHasBeenSentFromHere: "No forge has been sent from here.",
96 nothingWaitingWhenTheAgentAsks: "Nothing waiting: when the agent asks before acting, it shows here.",
97 noAccessTokens: "No access tokens.",
98 noIssuesYet: "No issues yet.",
99 noBetsYet: "No bets yet. The planner proposes them from the open work.",
100 noScopesYet: "No scopes yet.",
101 noAgentIsConnected: "No agent is connected.",
102 nobodyIsOnThisTeamYet: "Nobody is on this team yet.",
103 } as const;
104
105 export type NoteKey = keyof typeof NOTE_WORDS;
src/web/comments.ts +2 −1
@@ -6,6 +6,7 @@
66 */
77
88 import type { Mark } from "../core/marks.ts";
9 import { emptyNote } from "./empty_words.ts";
910 import { html, when, type Html } from "./html.ts";
1011 import { renderMarkdown } from "./markdown.ts";
1112 import { icon, originTag, time, userLink, type IconName } from "./ui.ts";
@@ -32,7 +33,7 @@ export function commentCard(card: CommentCard): Html {
3233 const idAttr = card.id === "" ? html`` : html`data-comment-id="${card.id}" `;
3334 const bodyHtml =
3435 card.body.trim() === ""
35 ? html`<p class="muted">No description.</p>`
36 ? emptyNote("noDescription")
3637 : renderMarkdown(card.body);
3738 const byline =
3839 card.originAuthor != null && card.originAuthor !== ""
src/web/empty_words.ts +6 −1
@@ -6,7 +6,7 @@
66 */
77
88 import { html, type Html } from "./html.ts";
9 import { EMPTY_WORDS, type EmptyKind, type EmptyWords } from "../core/empty_words.ts";
9 import { EMPTY_WORDS, NOTE_WORDS, type EmptyKind, type EmptyWords, type NoteKey } from "../core/empty_words.ts";
1010 import { btn, empty, type IconName } from "./ui.ts";
1111
1212 export { EMPTY_WORDS, type EmptyKind };
@@ -73,3 +73,8 @@ export function emptyLine(kind: Exclude<EmptyKind, keyof typeof ICONS>, o: { rea
7373 const reason = o.reason ?? w.reason;
7474 return html`<p class="muted small">${reason === undefined ? w.sentence : `${w.sentence} ${reason}`}</p>`;
7575 }
76
77 /** A sentence-only empty state: the table's words in a muted paragraph, escaped by `html`. */
78 export function emptyNote(key: NoteKey): Html {
79 return html`<p class="muted">${NOTE_WORDS[key]}</p>`;
80 }
src/web/fleet-act.ts +2 −1
@@ -5,6 +5,7 @@
55 */
66
77 import { pickedWords, UNDO_WINDOW_MS, type Plan } from "../actions/fleet.ts";
8 import { emptyNote } from "./empty_words.ts";
89 import type { FleetValue, Operation } from "../core/fleet_ops.ts";
910 import { digestOf } from "../fleet/digest.ts";
1011 import type { FleetKind } from "../fleet/selection.ts";
@@ -107,7 +108,7 @@ export function previewSection(
107108 </p>
108109 ${lines(plan.rows)}
109110 ${change === 0
110 ? html`<p class="muted">Nothing to apply.</p>`
111 ? emptyNote("nothingToApply")
111112 : html`<form method="post" action="/fleet" class="form-actions">
112113 <input type="hidden" name="q" value="${plan.query}" />
113114 <input type="hidden" name="step" value="apply" />
src/web/pages/account.ts +4 −3
@@ -10,6 +10,7 @@
1010 */
1111
1212 import { UPSTREAM_REPO } from "../../core/upstream.ts";
13 import { emptyNote } from "../empty_words.ts";
1314 import { resendVerification } from "../../actions/verify.ts";
1415 import { clientAddress } from "../../http/peer.ts";
1516 import { emailVerified } from "../../core/verify.ts";
@@ -844,7 +845,7 @@ export function sessionsCard(
844845 return block(
845846 "Signed-in browsers",
846847 html`${sessions.length === 0
847 ? html`<p class="muted">Not signed in on any browser.</p>`
848 ? emptyNote("notSignedInOnAnyBrowser")
848849 : html`<ul class="list setting-list">
849850 ${sessions.map((x) =>
850851 row({
@@ -913,7 +914,7 @@ function tokensView(ctx: Ctx): Html {
913914 // so the list says so beside it (#12466).
914915 const actsAsAdmin = ctx.auth.user!.isAdmin ? badge(ACTS_AS_ADMIN_WORDS) : null;
915916 const list = tokens.length === 0
916 ? html`<p class="muted">No access codes yet. Mint one when a script, a CI job, or another machine needs to act as you.</p>`
917 ? emptyNote("noAccessCodesYet")
917918 : html`<ul class="list setting-list">
918919 ${tokens.map((t) =>
919920 row({
@@ -1085,7 +1086,7 @@ function keysView(
10851086 ${block(
10861087 "Computer keys",
10871088 keys.length === 0
1088 ? html`<p class="muted">No computer keys yet. Add one and git over SSH stops asking for a password.</p>`
1089 ? emptyNote("noComputerKeysYet")
10891090 : html`<ul class="list setting-list">
10901091 ${keys.map((k) =>
10911092 row({
src/web/pages/accounts.ts +3 −2
@@ -6,6 +6,7 @@
66 */
77
88 import { sshOn } from "../../settings/ssh.ts";
9 import { emptyNote } from "../empty_words.ts";
910 import {
1011 listAccounts,
1112 removeAccount,
@@ -377,7 +378,7 @@ export function personSignInsPage(ctx: Ctx): Response {
377378 const signIns = html`<section class="settings-block" id="sign-ins">
378379 <h2>Signed in now</h2>
379380 ${sessions.length === 0
380 ? html`<p class="muted">Not signed in on any browser.</p>`
381 ? emptyNote("notSignedInOnAnyBrowser")
381382 : html`<ul class="list setting-list">
382383 ${sessions.slice(0, 5).map((x) =>
383384 row({
@@ -419,7 +420,7 @@ export function personSignInsPage(ctx: Ctx): Response {
419420 <h2>Access tokens</h2>
420421 <p class="muted">Revoking one ends it at once; the person can sign in again.</p>
421422 ${tokens.length === 0
422 ? html`<p class="muted">No access tokens.</p>`
423 ? emptyNote("noAccessTokens")
423424 : html`<ul class="list setting-list">
424425 ${tokens.map((t) =>
425426 row({
src/web/pages/bets.ts +4 −3
@@ -11,6 +11,7 @@ import {
1111 backBet, betEstimate, capBet, endBet, giveVerdict, oneLine, proposeBets, stopBet, writeLeft,
1212 } from "../../actions/bets.ts";
1313 import { type Bet, betReceipts, type BetReceipt, betRuns, betScopes, betSpentSince, getBet, listBets } from "../../core/bets.ts";
14 import { emptyNote } from "../empty_words.ts";
1415 import { getUserById } from "../../core/users.ts";
1516 import { canAdmin, type Repo } from "../../core/repos.ts";
1617 import { capStanding, dayStart, money } from "../../crew/bet_cap.ts";
@@ -121,7 +122,7 @@ function proposedRow(ctx: Ctx, repo: Repo, b: Bet, backed: readonly Bet[], now:
121122 const why = mayBack(backed, b.appetite)
122123 ?? (estimate === null || estimate.short === 0 ? null : WALLET_WAY_OUT);
123124 const issues = scopes.length === 0
124 ? html`<p class="muted">No issues yet.</p>`
125 ? emptyNote("noIssuesYet")
125126 : html`<details><summary>${scopes.length} ${scopes.length === 1 ? "issue" : "issues"}</summary>
126127 <ul>${scopes.map((s) => html`<li><a href="${repoBase(repo)}/issues/${s.number}">#${s.number} ${s.title}</a></li>`)}</ul>
127128 </details>`;
@@ -178,7 +179,7 @@ export function betsPage(ctx: Ctx): Response {
178179 const body = html`${repoHeader(ctx, repo, "issues")}
179180 ${pageHead("Bets", { sub: `A few named wholes, each with a share of the week. ${running} of ${MAX_BACKED} running. Builders pick only from running bets, the owner's own asks and small fixes.` })}
180181 ${bets.length === 0
181 ? html`<p class="muted">No bets yet. The planner proposes them from the open work.</p>`
182 ? emptyNote("noBetsYet")
182183 : html`${rows([...(owner ? proposed.map((b) => proposedRow(ctx, repo, b, backed, now)) : []), ...rest.map((b) => betRow(ctx, repo, b, now, owner, receipts))])}`}
183184 ${owner
184185 ? html`<form method="post" action="${repoBase(repo)}/bets/propose" class="mt">${btn("Ask the planner to propose bets", { variant: "secondary" })}</form>`
@@ -244,7 +245,7 @@ export function betPage(ctx: Ctx): Response {
244245 ${owner ? html`<h2 class="mt">Done looks like</h2>
245246 <ul>${bet.journeys.split("\n").filter((j) => j !== "").map((j) => html`<li>${j}</li>`)}</ul>` : null}
246247 <h2 class="mt">Scopes</h2>
247 ${scopes.length === 0 ? html`<p class="muted">No scopes yet.</p>` : rows(scopeRows)}
248 ${scopes.length === 0 ? emptyNote("noScopesYet") : rows(scopeRows)}
248249 ${leftBox}
249250 ${owner ? html`<div class="mt">${ownerActions(repo, bet)}</div>` : null}
250251 ${liveMount({ repo: repoBase(repo) })}`;
src/web/pages/billing.ts +2 −1
@@ -6,6 +6,7 @@
66 */
77
88 import { sshOn } from "../../settings/ssh.ts";
9 import { emptyNote } from "../empty_words.ts";
910 import { ledBlock } from "./visitors.ts";
1011 import { BILLING_WORDS, STRIPE_WORDS, connectStripe, disconnectStripe, grantPlan, planGrant, readBilling, saveSigningSecret, type BillingError, type StripeWords } from "../../actions/billing.ts";
1112 import { retryOrder } from "../../actions/order.ts";
@@ -263,7 +264,7 @@ function billingView(ctx: Ctx, shown?: Shown, status = 200, refusal?: Refused):
263264 <h2>Plans</h2>
264265 <p class="muted small">Choose the plan each forge is on.</p>
265266 ${rows.length === 0
266 ? html`<p class="muted">No forge has been sent from here.</p>`
267 ? emptyNote("noForgeHasBeenSentFromHere")
267268 : html`<ul class="list setting-list">${rows}</ul>`}
268269 </section>
269270 ${ledBlock(ctx)}
src/web/pages/boards-gates.ts +2 −1
@@ -10,6 +10,7 @@
1010 */
1111
1212 import type { Database } from "bun:sqlite";
13 import { emptyNote } from "../empty_words.ts";
1314 import type { App } from "../../app.ts";
1415 import { gatesForReader } from "../../actions/runs.ts";
1516 import { getRepoById } from "../../core/repos.ts";
@@ -107,7 +108,7 @@ export function gatesSection(app: App, owner: boolean, now: number, reader?: Use
107108 return fold(
108109 "Last gates",
109110 top.length === 0 ? "no gate has run yet" : `the last ${String(top.length)}: ${String(top.length - red)} green or cut off, ${String(red)} red`,
110 top.length === 0 ? html`<p class="muted">No gate has run yet.</p>` : html`<ul class="list">${top.map((l) => gateRow(l, now))}</ul>`,
111 top.length === 0 ? emptyNote("noGateHasRunYet") : html`<ul class="list">${top.map((l) => gateRow(l, now))}</ul>`,
111112 { id: "gates" },
112113 );
113114 }
src/web/pages/boards-held.ts +2 −1
@@ -6,6 +6,7 @@
66 */
77
88 import { HOLDS } from "../../crew/held.ts";
9 import { emptyNote } from "../empty_words.ts";
910 import type { HeldRow } from "../../flow/held.ts";
1011 import { html, type Html } from "../html.ts";
1112 import { meter } from "../ui.ts";
@@ -38,7 +39,7 @@ export function heldCard(rows: readonly HeldRow[]): Html {
3839 "Ready, and why it waits",
3940 rows.length === 0 ? "no repository runs on its own" : `${count(can)} can start now, ${count(held)} ${held === 1 ? "is" : "are"} held`,
4041 html`${rows.length === 0
41 ? html`<p class="muted">No repository runs on its own.</p>`
42 ? emptyNote("noRepositoryRunsOnItsOwn")
4243 : html`<div class="table-scroll">
4344 <table class="table" data-dense aria-label="Ready, and why it waits">
4445 <thead>
src/web/pages/chain.ts +2 −1
@@ -6,6 +6,7 @@
66 */
77
88 import { FAMILY_WORDS } from "../../actions/family_words.ts";
9 import { emptyNote } from "../empty_words.ts";
910 import { FOLLOW_MODE_REFUSALS, followModeSaid, setFollowMode, severForge, takeForgeCode, takeForgeWords } from "../../actions/follow.ts";
1011 import { FOLLOWS_NOTHING, PROPOSE_NEEDS_WRITE } from "../../actions/follow_words.ts";
1112 import { forgeProposals, proposeToParentForge, type ForgeProposal } from "../../actions/upstream.ts";
@@ -83,7 +84,7 @@ const STATE_WORDS = { open: "open", merged: "merged", closed: "closed" } as cons
8384 export function proposalSection(base: string, proposals: readonly ForgeProposal[], writer: boolean): Html {
8485 return html`<h2 class="mt">Proposals</h2>
8586 ${proposals.length === 0
86 ? html`<p class="muted">Nothing proposed to the parent forge yet.</p>`
87 ? emptyNote("nothingProposedToTheParentForgeYet")
8788 : html`<ul class="list" aria-label="Proposals to the parent forge">
8889 ${proposals.map(
8990 (p) => html`<li>
src/web/pages/confirms.ts +2 −1
@@ -8,6 +8,7 @@
88 */
99
1010 import { sshOn } from "../../settings/ssh.ts";
11 import { emptyNote } from "../empty_words.ts";
1112 import { REFUSED, sayYes, waitingConfirms } from "../../actions/conversation_confirms.ts";
1213 import { notePhase, takeSessionTime, timePhase } from "../../core/route_timing.ts";
1314 import { ASKING } from "../../crew/conversation_confirm.ts";
@@ -33,7 +34,7 @@ function confirmsPage(ctx: Ctx, shown?: Html): Response {
3334 <section class="settings-block" id="waiting">
3435 <h2>Waiting for you</h2>
3536 ${waiting.length === 0
36 ? html`<p class="muted">Nothing waiting: when the agent asks before acting, it shows here.</p>`
37 ? emptyNote("nothingWaitingWhenTheAgentAsks")
3738 : html`<ul class="list setting-list" id="confirms-list">
3839 ${waiting.map((w) =>
3940 row({
src/web/pages/economics.ts +2 −1
@@ -14,6 +14,7 @@
1414 */
1515
1616 import { sshOn } from "../../settings/ssh.ts";
17 import { emptyNote } from "../empty_words.ts";
1718 import { ECONOMICS_WORDS, changeEconomics, readEconomics } from "../../actions/economics.ts";
1819 import { MARGIN_MAX, POSITION_MAX, POSITION_MIN, PRICE_MAX_CENTS, SLOTS_MAX, usdOfCents } from "../../core/slider.ts";
1920 import { OWNED_NODE_LABEL_DEFAULT } from "../../core/placement_policy.ts";
@@ -151,7 +152,7 @@ export function economicsPage(ctx: Ctx): Response {
151152 <section class="settings-block">
152153 <h2>Changes</h2>
153154 ${history.length === 0
154 ? html`<p class="muted">No change yet.</p>`
155 ? emptyNote("noChangeYet")
155156 : html`<ul class="list setting-list">
156157 ${history}
157158 </ul>`}
src/web/pages/findings.ts +2 −1
@@ -7,6 +7,7 @@
77 */
88
99 import { acceptFinding, REASON_MAX, REASON_MIN } from "../../actions/scan_accept.ts";
10 import { emptyNote } from "../empty_words.ts";
1011 import { lastScan, listFindings, type FindingRow } from "../../checks/scan_store.ts";
1112 import { canWrite } from "../../core/repos.ts";
1213 import type { Ctx } from "../../http/context.ts";
@@ -60,7 +61,7 @@ export function findingsPage(ctx: Ctx): Response {
6061 <section class="mt">
6162 <h2>Findings</h2>
6263 ${rows.length === 0
63 ? html`<p class="muted">Nothing found.</p>`
64 ? emptyNote("nothingFound")
6465 : html`<ul class="list">
6566 ${rows.map((f) => findingRow(f, base, writer))}
6667 </ul>`}
src/web/pages/flags.ts +2 −1
@@ -7,6 +7,7 @@
77 */
88
99 import { sshOn } from "../../settings/ssh.ts";
10 import { emptyNote } from "../empty_words.ts";
1011 import { readFlags } from "../../actions/flags_view.ts";
1112 import { checkInput, FLAGS_ADMIN_ONLY, flagRegistry, usesLine, winnerOffer, mayManageFlags, useFlagRegistry, type FlagValue } from "../../core/flags.ts";
1213 import { makeWinnerDefault } from "../../actions/flag_winner.ts";
@@ -110,7 +111,7 @@ export function flagsPage(ctx: Ctx): Response {
110111 const body = html`<section class="settings-block">
111112 <h2>Flags</h2>
112113 ${names.length === 0
113 ? html`<p class="muted">No flag is declared yet.</p>`
114 ? emptyNote("noFlagIsDeclaredYet")
114115 : html`<ul class="list setting-list">
115116 ${rows}
116117 </ul>`}
src/web/pages/flow-panel.ts +4 −3
@@ -8,6 +8,7 @@
88 */
99
1010 import { lineSaid } from "../../git/pace.ts";
11 import { emptyNote } from "../empty_words.ts";
1112 import { MERGE_QUEUE_HELP } from "../../flow/help.ts";
1213 import { helpAsked, pageHelp } from "../page_help.ts";
1314 import { HELD_EXPLAINED } from "./boards-held.ts";
@@ -327,7 +328,7 @@ function queueCard(rows: readonly QueueRow[]): Html {
327328 "Merge queue",
328329 `${queued === 0 ? "nothing queued" : `${count(queued)} queued`}; ${count(landedHour)} landed in the last hour`,
329330 html`${rows.length === 0
330 ? html`<p class="muted">Nothing queued, gating or landed in the last hour.</p>`
331 ? emptyNote("nothingQueuedGatingOrLandedInTheLastHour")
331332 : html`<div class="table-scroll">
332333 <table class="table" data-dense aria-label="Merge queue">
333334 <thead>
@@ -367,7 +368,7 @@ function outList(t: StageFlow, hour: number | null, now: number): Html {
367368 return card(
368369 html`<h2>${STAGE_LABEL[t.key]}: ${String(items.length)} ${OUTFLOW[t.key].label} ${hourWords(hour)}</h2>
369370 ${items.length === 0
370 ? html`<p class="muted">None.</p>`
371 ? emptyNote("none")
371372 : html`<ul>
372373 ${items.map(
373374 (i) =>
@@ -405,7 +406,7 @@ function hotFilesCard(app: App, reader: Reader): Html {
405406 "Hot files",
406407 top.length === 0 ? "no file is touched by 3 or more open pulls" : `${count(top.length)} ${top.length === 1 ? "file" : "files"} touched by 3 or more open pulls`,
407408 html`${top.length === 0
408 ? html`<p class="muted">No file is touched by 3 or more open pulls.</p>`
409 ? emptyNote("noFileIsTouchedBy3OrMoreOpenPulls")
409410 : html`<ul>
410411 ${top.map(
411412 (r) =>
src/web/pages/flows-all.ts +2 −1
@@ -5,6 +5,7 @@
55 */
66
77 import { sshOn } from "../../settings/ssh.ts";
8 import { emptyNote } from "../empty_words.ts";
89 import { ALL_KINDS, parseKind, readAllFlows } from "../../flows/all.ts";
910 import type { Health } from "../../flows/view.ts";
1011 import type { Ctx } from "../../http/context.ts";
@@ -47,7 +48,7 @@ export function allFlowsPage(ctx: Ctx): Response {
4748 );
4849 const body = html`${pageHead("Flows across the forge", { sub: `${lines.length} ${lines.length === 1 ? "line" : "lines"}${lines.length > SHOWN ? `, the newest ${SHOWN} shown` : ""}.` })}
4950 ${filters}
50 ${rows.length === 0 ? html`<p class="muted">No flow lines match.</p>` : listCard(rows)}`;
51 ${rows.length === 0 ? emptyNote("noFlowLinesMatch") : listCard(rows)}`;
5152 const response = page({ ctx, title: "Flows · admin", body: settingsLayout(accountSections("adminflows", { admin: true, ssh: sshOn(ctx.app.db) }), body, "Account settings") });
5253 notePhase(ctx.request, "render", performance.now() - rendering);
5354 return response;
src/web/pages/fork-offers.ts +2 −1
@@ -7,6 +7,7 @@ import { forkParentFor, type Repo } from "../../core/repos.ts";
77 import type { Ctx } from "../../http/context.ts";
88 import { sizeLine, type OfferSizeResult } from "../../git/offer_size.ts";
99 import { loadRepo, notFoundPage, pageHead, repoBase } from "../chrome.ts";
10 import { emptyNote } from "../empty_words.ts";
1011 import { html, type Html } from "../html.ts";
1112 import { page } from "../layout.ts";
1213 import { confirmAction, time } from "../ui.ts";
@@ -76,7 +77,7 @@ export function sentOffersPage(ctx: Ctx): Response {
7677 title: "Offers",
7778 body: html`<div class="narrow-wide">
7879 ${pageHead("Offers", { sub: `What ${fork.ownerName}/${fork.name} has sent upstream, newest first.` })}
79 ${list ?? html`<p class="muted">Nothing offered yet</p>`}
80 ${list ?? emptyNote("nothingOfferedYet")}
8081 </div>`,
8182 }));
8283 }
src/web/pages/grants.ts +2 −1
@@ -8,6 +8,7 @@
88 * `screens/oauthgrants.ts` shares.
99 */
1010 import { myOAuthGrants, revokeOAuthGrant, revokedWords } from "../../actions/oauth_grants.ts";
11 import { emptyNote } from "../empty_words.ts";
1112 import type { OAuthGrant } from "../../core/oauth_grants.ts";
1213 import { notePhase, takeSessionTime, timePhase } from "../../core/route_timing.ts";
1314 import type { Ctx } from "../../http/context.ts";
@@ -47,7 +48,7 @@ function grantRow(g: OAuthGrant): Html {
4748 function grantsView(grants: readonly OAuthGrant[]): Html {
4849 const list =
4950 grants.length === 0
50 ? html`<p class="muted">No agent is connected.</p>`
51 ? emptyNote("noAgentIsConnected")
5152 : html`<ul class="list setting-list" data-grants>
5253 ${grants.map(grantRow)}
5354 </ul>`;
src/web/pages/maintenance.ts +2 −1
@@ -5,6 +5,7 @@
55 */
66
77 import { json } from "../../http/respond.ts";
8 import { emptyNote } from "../empty_words.ts";
89 import { notePhase, takeSessionTime } from "../../core/route_timing.ts";
910 import { dutyStates, switchDuty } from "../../maintain/pause.ts";
1011 import { DISMISS_DAYS, REASON_MAX, dismiss, dismissals, dismissalWords } from "../../maintain/dismiss.ts";
@@ -323,7 +324,7 @@ export async function maintenanceUnquiet(ctx: Ctx): Promise<Response> {
323324 function staleRows(withActions: boolean, pulls: ReturnType<typeof stalePulls>): Html {
324325 const form = (id: string, what: "nudge" | "close", label: string): Html =>
325326 html`<form method="post" action="/maintenance/stale/${id}/${what}" class="inline">${btn(label, { variant: "outline" })}</form>`;
326 if (pulls.length === 0) return html`<p class="muted">None.</p>`;
327 if (pulls.length === 0) return emptyNote("none");
327328 return html`<dl class="status-rows">${pulls.map(
328329 (p) => html`<div class="status-row" data-pull="${p.repo}#${String(p.number)}"><dt><a href="/${p.repo}/pulls/${String(p.number)}">${p.repo}#${String(p.number)}</a></dt>
329330 <dd>${p.title} <span class="muted">${String(p.ageDays)} days</span>
src/web/pages/org.ts +2 −1
@@ -10,6 +10,7 @@
1010 */
1111
1212 import { USERNAME_PATTERN } from "../username_pattern.ts";
13 import { emptyNote } from "../empty_words.ts";
1314 import {
1415 addTeamMember,
1516 createOrg,
@@ -634,7 +635,7 @@ export function teamPage(ctx: Ctx): Response {
634635 <section class="settings-block">
635636 <h2>Members</h2>
636637 ${members.length === 0
637 ? html`<p class="muted">Nobody is on this team yet.</p>`
638 ? emptyNote("nobodyIsOnThisTeamYet")
638639 : html`<ul class="list setting-list">
639640 ${members.map((m) =>
640641 row({
src/web/pages/system.ts +6 −5
@@ -22,6 +22,7 @@
2222 * against its size (#10853, `spawn/usage.ts`).
2323 */
2424 import { askingOf, type Asker } from "../../perf/asking.ts";
25 import { emptyNote } from "../empty_words.ts";
2526 import { sentinelRepoPath, withheldFindings, type WithheldFinding } from "../../crew/sentinel.ts";
2627 import { ownRepoRate, rateLine, RATE_MIN, type Rate } from "../../checks/deepsec_rate.ts";
2728 import { turnStatsOf } from "../../http/app_turn.ts";
@@ -298,7 +299,7 @@ export function inProcessSection(rows: readonly ChildHour[]): Html {
298299 const KIND_ORDER = ["forge", "crew", "check", "app", "host"] as const;
299300 function procTable(v: SystemView): Html {
300301 const groups = KIND_ORDER.flatMap((k) => v.groups.filter((g) => g.kind === k));
301 if (groups.length === 0) return html`<p class="muted">No processes were read.</p>`;
302 if (groups.length === 0) return emptyNote("noProcessesWereRead");
302303 return html`<div class="table-scroll"><table class="table" data-dense aria-label="Processes by what launched them">
303304 <thead><tr><th scope="col">pid</th><th scope="col">command</th><th scope="col" class="num">cpu</th><th scope="col" class="num">mem</th><th scope="col" class="num">age</th></tr></thead>
304305 ${groups.map(
@@ -373,7 +374,7 @@ function memorySection(ctx: Ctx): Html {
373374 const series = (title: string, pick: (h: (typeof hours)[number]) => number) =>
374375 html`<div><h3 class="small">${title}</h3>${chartBox("line", hours.map((h) => ({ label: hhmm(h.at).slice(11), value: pick(h) / 1_048_576 })), title)}</div>`;
375376 return html`<section class="settings-block" id="sys-memory"><h2>Forge memory</h2>${hours.length === 0
376 ? html`<p class="muted">No samples yet.</p>`
377 ? emptyNote("noSamplesYet")
377378 : html`<div class="plots">${series("RSS (MiB, hourly mean)", (h) => h.rssMean)}${series("JS heap (MiB, hourly mean)", (h) => h.heapMean)}</div>
378379 <div class="table-scroll"><table class="table" aria-label="Forge memory by hour">
379380 <thead><tr><th scope="col">Hour (UTC)</th><th scope="col" class="num">RSS mean</th><th scope="col" class="num">RSS max</th><th scope="col" class="num">Heap mean</th><th scope="col" class="num">Heap max</th></tr></thead>
@@ -560,7 +561,7 @@ export function restoreSection(l: RestoreLine): Html {
560561 export function stallSection(rows: readonly RouteStall[], worst: Html = html``): Html {
561562 return html`<section class="settings-block"><h2>Main-thread stalls, last hour</h2>${
562563 rows.length === 0
563 ? html`<p class="muted">No stalls in the last hour.</p>`
564 ? emptyNote("noStallsInTheLastHour")
564565 : html`<div class="table-scroll"><table class="table" aria-label="Main-thread stalls by route, last hour">
565566 <thead><tr><th scope="col">Route</th><th scope="col" class="num">Stall ms</th><th scope="col" class="num">Stalls</th></tr></thead>
566567 <tbody>${rows.map((r) => html`<tr data-route="${r.route}"><td class="mono">${r.route}</td><td class="num mono">${String(Math.round(r.ms))}</td><td class="num mono">${String(r.count)}</td></tr>`)}</tbody>
@@ -612,7 +613,7 @@ export function lagSection(rows: readonly LagReading[]): Html {
612613 const over = overBar(rows);
613614 return html`<div id="sys-lag" data-readings="${String(rows.length)}" data-over="${String(over)}"><section class="settings-block"><h2>Loop lag, last ${String(LAG_READINGS)} minutes</h2>${
614615 rows.length === 0
615 ? html`<p class="muted">No full minute measured yet.</p>`
616 ? emptyNote("noFullMinuteMeasuredYet")
616617 : html`<div class="row-meta">${over === 0 ? badge(`all ${String(rows.length)} under ${String(LAG_BAR_MS)} ms`) : badge(`${String(over)} of ${String(rows.length)} over ${String(LAG_BAR_MS)} ms`, { tone: "danger" })}</div>
617618 <div class="table-scroll"><table class="table" aria-label="Worst loop lag each minute against the ${String(LAG_BAR_MS)} ms bar">
618619 <thead><tr><th scope="col">Minute</th><th scope="col" class="num">Worst ms</th><th scope="col">What ran</th></tr></thead>
@@ -654,7 +655,7 @@ export function readersSection(rows: readonly ReaderPace[]): Html {
654655 const secs = (ms: number | null): string => (ms === null ? "—" : `${(ms / 1000).toFixed(1)} s`);
655656 return html`<section class="settings-block"><h2>Telemetry readers</h2>${
656657 rows.length === 0
657 ? html`<p class="muted">No telemetry reads in the last 10 minutes.</p>`
658 ? emptyNote("noTelemetryReadsInTheLast10Minutes")
658659 : html`<div class="table-scroll"><table class="table" aria-label="Telemetry readers, last 10 minutes">
659660 <thead><tr><th scope="col">Route</th><th scope="col">Reader</th><th scope="col" class="num">Reads, 10 min</th><th scope="col" class="num">Mean interval</th><th scope="col"></th></tr></thead>
660661 <tbody>${rows.map((r) => html`<tr data-route="${r.route}" data-reader="${r.reader}"><td class="mono">${r.route}</td><td class="mono">${r.reader}</td><td class="num mono">${String(r.reads)}</td><td class="num mono">${secs(r.meanIntervalMs)}</td><td>${r.tooFast ? badge("faster than the flow copy changes", { tone: "danger" }) : null}</td></tr>`)}</tbody>
src/web/pages/week.ts +2 −1
@@ -5,6 +5,7 @@
55 * and nothing else on the page changes anything.
66 */
77 import { takeProposal } from "../../actions/week.ts";
8 import { emptyNote } from "../empty_words.ts";
89 import { whileFull, whileFullLine } from "../../checks/full_window_recheck.ts";
910 import { allowanceLine } from "../../crew/week_read.ts";
1011 import { polishSpend } from "../../crew/polish_share.ts";
@@ -55,7 +56,7 @@ function screen(base: string, retro: Retro, taken: ReadonlySet<number>, writer:
5556 ${block(
5657 "Proposed changes",
5758 proposals.length === 0
58 ? html`<p class="muted">Nothing to propose.</p>`
59 ? emptyNote("nothingToPropose")
5960 : html`<p class="muted">${writer ? "Nothing changes until you tap." : "Only someone who writes here can take it."}</p>
6061 <ul class="list setting-list">${proposals.map((pr, idx) =>
6162 row({
src/web/render/deps-manifest.ts +2 −1
@@ -8,6 +8,7 @@
88 */
99
1010 import { html, type Html } from "../html.ts";
11 import { emptyNote } from "../empty_words.ts";
1112 import { fileSize } from "../ui.ts";
1213 import type { Json } from "./json-doc.ts";
1314 import type { Rendered, RenderInput } from "./renderers.ts";
@@ -222,7 +223,7 @@ export function depsManifest(input: RenderInput): Rendered {
222223 const more = s.total - s.rows.length;
223224 return html`<h3>${s.title}</h3><div class="table-scroll"><table class="table" data-dense aria-label="${s.title}"><thead><tr>${s.columns.map((c) => html`<th scope="col">${c}</th>`)}</tr></thead><tbody>${rows}</tbody></table></div>${more > 0 ? html`<p class="muted small">${more} more not shown</p>` : html``}`;
224225 });
225 const content = html`<div class="package-view"><h2>${doc.title}</h2>${doc.facts.length > 0 ? html`<p class="muted small">${doc.facts.join(" · ")}</p>` : html``}${blocks.length > 0 ? blocks : html`<p class="muted">No dependencies listed.</p>`}</div>`;
226 const content = html`<div class="package-view"><h2>${doc.title}</h2>${doc.facts.length > 0 ? html`<p class="muted small">${doc.facts.join(" · ")}</p>` : html``}${blocks.length > 0 ? blocks : emptyNote("noDependenciesListed")}</div>`;
226227 const n = doc.sections.reduce((a, s) => a + s.total, 0);
227228 return { content, lines: 0, summary: `${n} ${n === 1 ? "entry" : "entries"} · ${fileSize(input.size)}` };
228229 }
src/web/settings/devices.ts +2 −1
@@ -7,6 +7,7 @@
77 */
88
99 import { sshOn } from "../../settings/ssh.ts";
10 import { emptyNote } from "../empty_words.ts";
1011 import type { Ctx } from "../../http/context.ts";
1112 import { DEVICE_ERRORS, declare, setCap, grant, revoke, devicesWithStatus, remove, statusLine } from "../../actions/devices.ts";
1213 import { allAppSlugs } from "../../core/device_grants.ts";
@@ -119,7 +120,7 @@ export async function devicesPage(ctx: Ctx): Promise<Response> {
119120 accountSections("devices", { admin: true, ssh: sshOn(ctx.app.db) }),
120121 html`<section class="settings-block">
121122 <p class="muted">Printers on your network, as the forge sees them; only addresses like 192.168.1.161 are accepted.</p>
122 ${when(devices.length === 0, () => html`<p class="muted">No devices declared.</p>`)}
123 ${when(devices.length === 0, () => emptyNote("noDevicesDeclared"))}
123124 ${when(devices.length > 0, () => html`<ul class="list setting-list">${devices.map((d) => card(ctx, d))}</ul>`)}
124125 <form class="edit-row mt" method="post" action="/settings/devices">
125126 <input type="hidden" name="kind" value="printer" />
src/web/studio/feed.ts +2 −1
@@ -9,6 +9,7 @@
99 */
1010
1111 import { TELL_LIMIT_WORDS, TELL_TEXT_MAX } from "../../actions/tell_from.ts";
12 import { emptyNote } from "../empty_words.ts";
1213 import { COMPOSER_FIELDS, TELL_MAX, sharedDraft, shareToken } from "../share_target.ts";
1314 import { chipCounts } from "../../feed/chips.ts";
1415 import { chipsOf, KIND_CHIPS, type KindChip } from "../../core/feed_chips.ts";
@@ -343,7 +344,7 @@ export function publicFeed(ships: readonly PublicShip[], signIn: string): Html {
343344 return html`<div class="stack">
344345 ${btn("Sign in to tell the crew", { href: signIn, variant: "primary" })}
345346 ${ships.length === 0
346 ? html`<p class="muted">Nothing yet.</p>`
347 ? emptyNote("nothingYet")
347348 : html`<ul class="list">
348349 ${ships.map((s) =>
349350 row({ href: s.href, title: html`${s.app} · ${s.title}`, meta: time(s.at) }),
src/web/studio/share_receive.ts +2 −1
@@ -10,6 +10,7 @@
1010 * `html`.
1111 */
1212 import { keepThought } from "../../actions/thought.ts";
13 import { emptyNote } from "../empty_words.ts";
1314 import { expireCookie, setCookie } from "../../auth/cookies.ts";
1415 import type { Ctx } from "../../http/context.ts";
1516 import { cookieValue } from "../../http/context.ts";
@@ -78,7 +79,7 @@ export function shareHeld(ctx: Ctx): Response {
7879 title: "Shared words · held",
7980 body: html`<h1>Tell the crew</h1>
8081 ${draft === undefined
81 ? html`<p class="muted">Nothing is waiting to be sent.</p>`
82 ? emptyNote("nothingIsWaitingToBeSent")
8283 : html`<p class="muted small">Nothing is sent until you tap Send.</p>
8384 <form class="stack" method="post" action="/tell/share">
8485 <textarea class="input" name="${COMPOSER_FIELDS.text}" rows="6" required aria-label="Tell the crew">${draft}</textarea>
test/empty-notes.test.ts added +41
@@ -0,0 +1,41 @@
1 /**
2 * Sentence-only empty states come from one table (`NOTE_WORDS`, #15897): each is one plain sentence
3 * group, and the pages that still word their own `<p class="muted">No …</p>` are counted, so the
4 * count can only go down.
5 */
6 import { expect, test } from "bun:test";
7 import { Glob } from "bun";
8 import { NOTE_WORDS } from "../src/core/empty_words.ts";
9 import { emptyNote } from "../src/web/empty_words.ts";
10
11 test("every note is plain words ending in a full stop", () => {
12 for (const [key, s] of Object.entries(NOTE_WORDS)) {
13 expect(`${key}: ${/^(No|Not|Nothing|Nobody|None)\b[^<>]*\.$/.test(s)}`).toBe(`${key}: true`);
14 }
15 });
16
17 test("emptyNote draws the table's sentence in one muted paragraph", () => {
18 expect(String(emptyNote("noGateHasRunYet"))).toBe('<p class="muted">No gate has run yet.</p>');
19 expect(String(emptyNote("noFlagIsDeclaredYet"))).toContain(NOTE_WORDS.noFlagIsDeclaredYet);
20 });
21
22 // Pages that word their own empty note, by file. Move one onto NOTE_WORDS and lower its count.
23 const OWN_WORDS: Readonly<Record<string, number>> = {
24 "src/web/pages/next.ts": 1,
25 "src/web/pages/now.ts": 1,
26 "src/web/pages/waves.ts": 1,
27 "src/web/pages/sources.ts": 1,
28 "src/web/pages/contribute.ts": 1,
29 "src/web/studio/cut_over.ts": 1,
30 "src/web/studio/data_move.ts": 1,
31 };
32
33 test("the pages that still word their own empty note are the ones named, no more", async () => {
34 const found: Record<string, number> = {};
35 for await (const f of new Glob("src/web/**/*.ts").scan(".")) {
36 if (f === "src/web/client.ts") continue; // script text, not a page
37 const n = [...(await Bun.file(f).text()).matchAll(/<p class="muted">(No|Nothing|Nobody|Not) /g)].length;
38 if (n > 0) found[f] = n;
39 }
40 expect(found).toEqual(OWN_WORDS);
41 });
test/empty-words-all.test.ts +2 −15
@@ -24,16 +24,10 @@ const OWN_FORM = /empty\(\{\s*(?:icon: [^,]+,\s*)?title: [`"]No |empty\("No |<p
2424 // What is left is split into #15899 (admin, system), #15900 (boards, bets, flows), #15901
2525 // (repository pages), #15902 (apps, forges) and #15903 (studio, renderers); #15851 waits for them.
2626 const OWN_WORDS: Readonly<Record<string, number>> = {
27 "src/web/comments.ts": 1,
2827 "src/web/diff-view.ts": 1,
29 "src/web/pages/account.ts": 2,
30 "src/web/pages/accounts.ts": 1,
3128 "src/web/pages/admin-limits.ts": 1,
3229 "src/web/pages/audit.ts": 1,
33 "src/web/pages/bets.ts": 3,
34 "src/web/pages/billing.ts": 2,
35 "src/web/pages/boards-gates.ts": 1,
36 "src/web/pages/boards-held.ts": 1,
30 "src/web/pages/billing.ts": 1,
3731 "src/web/pages/boards-holds.ts": 1,
3832 "src/web/pages/boards.ts": 1,
3933 "src/web/pages/browse.ts": 1,
@@ -42,13 +36,8 @@ const OWN_WORDS: Readonly<Record<string, number>> = {
4236 "src/web/pages/commits.ts": 1,
4337 "src/web/pages/contribute.ts": 1,
4438 "src/web/pages/display.ts": 1,
45 "src/web/pages/economics.ts": 1,
4639 "src/web/pages/family.ts": 1,
4740 "src/web/pages/features.ts": 1,
48 "src/web/pages/flags.ts": 1,
49 "src/web/pages/flow-panel.ts": 1,
50 "src/web/pages/flows-all.ts": 1,
51 "src/web/pages/grants.ts": 1,
5241 "src/web/pages/inventory.ts": 1,
5342 "src/web/pages/issues.ts": 1,
5443 "src/web/pages/looks.ts": 1,
@@ -61,16 +50,14 @@ const OWN_WORDS: Readonly<Record<string, number>> = {
6150 "src/web/pages/runners.ts": 1,
6251 "src/web/pages/settings.ts": 1,
6352 "src/web/pages/sources.ts": 1,
64 "src/web/pages/system.ts": 6,
53 "src/web/pages/system.ts": 1,
6554 "src/web/pages/teams.ts": 1,
6655 "src/web/pages/trusted.ts": 1,
6756 "src/web/pages/visitors.ts": 1,
6857 "src/web/pages/waves.ts": 1,
69 "src/web/render/deps-manifest.ts": 1,
7058 "src/web/render/ora.ts": 1,
7159 "src/web/render/sarif.ts": 1,
7260 "src/web/render/sbom.ts": 1,
73 "src/web/settings/devices.ts": 1,
7461 "src/web/studio/cut_over.ts": 1,
7562 "src/web/studio/data_move.ts": 1,
7663 "src/web/studio/explore.ts": 1,

↑↓ navigate ↵ open ⌘↵ its app esc close

Keyboard shortcuts

Docs