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

Design: the boards' quick filters use the design system, and qf leaves §5d #3902

Parked opened this
Closed without merging

scout/forge:scout/3849-design-the-boards-quick-filters-use-the → main 1 commit fork

  • Closed without merging. Nothing was applied to main.

Review

Sign in to review this change.
6 files changed +61 −53
docs/DESIGN.md +1 −1
@@ -385,7 +385,7 @@ gone, so this list only shrinks.
385385 - **`style/base.ts`** — the page shell (topbar, main, footer) and the layout and text utilities every page leans on: `.bar` `.bare` `.foot` `.grow` `.hide-lg` `.hide-sm` `.js-only` `.live-pill` `.mark` `.mb` `.mt` `.muted` `.narrow` `.narrow-wide` `.num` `.reduced` `.shell` `.shell-wide` `.skip` `.small` `.spacer` `.sr-only` `.stack` `.stack-tight` `.topbar` `.topbar-tools` `.truncate` `.wordmark`
386386 - **`style/components.ts`** — parts of the §5 components that the table does not spell out — the palette's list, the menu's items, a dialog's head and foot, comments, the theme picker — and a few small helpers beside them: `.cat` `.clone` `.clone-text` `.comment` `.comment-body` `.comment-form` `.dash` `.dialog-body` `.dialog-foot` `.dialog-head` `.empty-title` `.error-note` `.field-row` `.form-actions` `.hex` `.ico` `.ico-loader` `.list` `.live-status` `.menu-item` `.menu-panel` `.menu-sep` `.menu-title` `.palette-empty` `.palette-foot` `.palette-group` `.palette-heading` `.palette-input` `.palette-item` `.palette-list` `.passkey` `.passkey-lead` `.passkey-note` `.passkey-off` `.passkey-on` `.preview` `.sep` `.split` `.sprite` `.swatch` `.table-scroll` `.tell-here` `.theme-apply` `.theme-option` `.tick` `.timeline` `.tl-dot` `.toast-body` `.topbar-search`
387387 - **`style/components.ts`, settings rows** — a list whose rows are settings (limits, capacity): the `<ul class="list setting-list">` lets title and meta wrap instead of ellipsizing, and a row's controls take their own line under 640px. `.row-fields` is the form in that row's trail (input, Save, Default): always visible, never hover-gated, wrapping under the text before it would clip. Use both for any page whose rows show a name, a current value, and a control to change it; use `.row-actions` only for secondary actions (delete, wake, pin, revoke). Flags, telemetry, cloud, people, crew roles and subscription headroom/budget use `.row-fields`. Classes: `.row-fields` `.setting-list`
388 - **`style/content.ts`, page furniture** — what frames a page's content: page and repo heads, the merge box, the front page and its tiles, explore, backups, boards, the fleet chart's series colours, following, lineage: `.about` `.act` `.app-shelf` `.app-tile` `.app-tile-body` `.app-tile-desc` `.app-tile-look` `.app-tile-name` `.backups-drill` `.backups-error` `.backups-now` `.backups-restore` `.bform` `.bgrid` `.big` `.bmanage` `.boards-result` `.bp-h2` `.bp-h3` `.bp-w2` `.bp-w3` `.break` `.bt-bar` `.bt-grid` `.bt-group` `.bt-hist` `.bt-name` `.bt-procs` `.bt-row` `.bt-val` `.chart` `.chart-box` `.close-into` `.close-reason` `.commit-body` `.commit-head` `.connect-more` `.connect-path` `.domain-records` `.everyday-ask` `.explore-filters` `.explore-line` `.explore-main` `.explore-name` `.explore-row` `.fg-s0` `.fg-s1` `.fg-s2` `.fg-s3` `.fg-s4` `.fg-s5` `.fg-s6` `.fg-s7` `.filters` `.flag-form` `.following` `.following-actions` `.following-eyebrow` `.following-foot` `.following-head` `.following-sentence` `.fork-bar` `.front-admin` `.front-controls` `.front-crew` `.front-featured` `.front-featured-body` `.front-featured-look` `.front-issues` `.front-live` `.front-more` `.front-pick` `.front-pin-any` `.front-weights` `.frozen` `.frozen-form` `.frozen-sentence` `.grants` `.grants-foot` `.handoff` `.handoff-links` `.headroom` `.hero` `.hero-terminal` `.issue-head` `.issue-meta` `.kv` `.lineage` `.lineage-children` `.lineage-here` `.merge-box` `.merge-form` `.merge-headline` `.merge-sub` `.mirror-form` `.number` `.origin-link` `.origin-mark` `.origin-name` `.origin-row` `.owner` `.page-head` `.path-head` `.policy-line` `.qf` `.quiet-details` `.repo-actions` `.repo-audience` `.repo-desc` `.repo-layout` `.repo-lineage` `.repo-title` `.search` `.slash` `.stage-detail` `.stage-dot` `.steps` `.sub` `.sys-pair` `.table-wrap` `.terminal-line` `.tok` `.tree-row` `.tree-total` `.wall-cells` `.where-dot` `.where-note` `.where-sep`
388 - **`style/content.ts`, page furniture** — what frames a page's content: page and repo heads, the merge box, the front page and its tiles, explore, backups, boards, the fleet chart's series colours, following, lineage: `.about` `.act` `.app-shelf` `.app-tile` `.app-tile-body` `.app-tile-desc` `.app-tile-look` `.app-tile-name` `.backups-drill` `.backups-error` `.backups-now` `.backups-restore` `.bform` `.bgrid` `.big` `.bmanage` `.boards-result` `.bp-h2` `.bp-h3` `.bp-w2` `.bp-w3` `.break` `.bt-bar` `.bt-grid` `.bt-group` `.bt-hist` `.bt-name` `.bt-procs` `.bt-row` `.bt-val` `.chart` `.chart-box` `.close-into` `.close-reason` `.commit-body` `.commit-head` `.connect-more` `.connect-path` `.domain-records` `.everyday-ask` `.explore-filters` `.explore-line` `.explore-main` `.explore-name` `.explore-row` `.fg-s0` `.fg-s1` `.fg-s2` `.fg-s3` `.fg-s4` `.fg-s5` `.fg-s6` `.fg-s7` `.filters` `.flag-form` `.following` `.following-actions` `.following-eyebrow` `.following-foot` `.following-head` `.following-sentence` `.fork-bar` `.front-admin` `.front-controls` `.front-crew` `.front-featured` `.front-featured-body` `.front-featured-look` `.front-issues` `.front-live` `.front-more` `.front-pick` `.front-pin-any` `.front-weights` `.frozen` `.frozen-form` `.frozen-sentence` `.grants` `.grants-foot` `.handoff` `.handoff-links` `.headroom` `.hero` `.hero-terminal` `.issue-head` `.issue-meta` `.kv` `.lineage` `.lineage-children` `.lineage-here` `.merge-box` `.merge-form` `.merge-headline` `.merge-sub` `.mirror-form` `.number` `.origin-link` `.origin-mark` `.origin-name` `.origin-row` `.owner` `.page-head` `.path-head` `.policy-line` `.quiet-details` `.repo-actions` `.repo-audience` `.repo-desc` `.repo-layout` `.repo-lineage` `.repo-title` `.search` `.slash` `.stage-detail` `.stage-dot` `.steps` `.sub` `.sys-pair` `.table-wrap` `.terminal-line` `.tok` `.tree-row` `.tree-total` `.wall-cells` `.where-dot` `.where-note` `.where-sep`
389389 - **`style/content.ts`, code view** — the source view and the syntax-highlight token classes `highlight-html.ts` builds as `tok-${kind}`: `.blob-view` `.ln` `.tok-attribute` `.tok-comment` `.tok-constant` `.tok-decorator` `.tok-deleted` `.tok-emphasis` `.tok-function` `.tok-heading` `.tok-inserted` `.tok-keyword` `.tok-link` `.tok-meta` `.tok-number` `.tok-operator` `.tok-plain` `.tok-property` `.tok-punctuation` `.tok-regex` `.tok-string` `.tok-tag` `.tok-type` `.tok-variable`
390390 - **`style/content.ts`, prose (markdown)** — table cell alignment, built by `markdown.ts` as `ta-${align}`: `.ta-c` `.ta-r`
391391 - **`style/content.ts`, diff viewer** — the diff table: its gutters, line kinds, file head and inline review comments: `.add` `.del` `.dh` `.diff` `.diff-body` `.diff-head` `.diff-note` `.diff-path` `.diff-stat` `.diff-stub` `.diff-summary` `.diff-table` `.dl` `.dl-review` `.dn` `.dn-comment` `.nonl` `.rc-hidden` `.rc-resolve` `.rc-resolved` `.wd`
docs/design/baseline.json +1 −1
@@ -2,7 +2,7 @@
22 "files": {
33 "src/web/style/components.ts": {
44 "colour": 3,
5 "size": 2,
5 "size": 0,
66 "motion": 0,
77 "forced": 1,
88 "focus": 2,
src/web/pages/boards-view.ts +10 −10
@@ -22,7 +22,7 @@ import { btn, card, empty } from "../ui.ts";
2222 import { flowPanel } from "./flow-panel.ts";
2323 import { isPinned, listPins } from "../../boards/pins.ts";
2424 import { panelData, runFor } from "../../boards/panel_data.ts";
25 import { cellsOf, chartBox, paramsOf, queryFields, readParams } from "./boards.ts";
25 import { cellsOf, chartBox, paramsOf, qf, queryFields, readParams } from "./boards.ts";
2626
2727 /** The events the panels' queries read (runs, pulls, checks, issues, usage): any of them may change a chart. */
2828 const READS = "run.queued,run.started,run.finished,pull.*,check.*,issue.*,usage.*";
@@ -83,7 +83,7 @@ export async function boardsList(ctx: Ctx): Promise<Response> {
8383 const listed = await listAllBoards(ctx.app, ctx.auth.user);
8484 if (!listed.ok) return notFoundPage(ctx);
8585 const make = html`<form method="post" action="/boards/new" class="bform">
86 <label class="qf"><span>New board</span><input class="input" name="title" required maxlength="${String(MAX_TITLE)}" placeholder="Title" /></label>
86 ${qf("New board", (id) => html`<input class="input" name="title" id="${id}" required maxlength="${String(MAX_TITLE)}" placeholder="Title" />`)}
8787 ${btn("Make board", { variant: "primary" })}
8888 </form>`;
8989 const body =
@@ -112,13 +112,13 @@ export async function boardsList(ctx: Ctx): Promise<Response> {
112112 function panelForm(slug: string, op: string, p: Panel | undefined, index: number, fields: Html): Html {
113113 return html`<form method="post" action="/boards/${slug}/${op}" class="bform">
114114 ${op === "edit" ? html`<input type="hidden" name="index" value="${String(index)}" />` : null}
115 <label class="qf"><span>Panel title</span><input class="input" name="title" required maxlength="${String(MAX_TITLE)}" value="${p?.title ?? ""}" placeholder="Panel title" /></label>
116 <label class="qf"><span>Width</span><select class="input" name="w">
115 ${qf("Panel title", (id) => html`<input class="input" name="title" id="${id}" required maxlength="${String(MAX_TITLE)}" value="${p?.title ?? ""}" placeholder="Panel title" />`)}
116 ${qf("Width", (id) => html`<select class="input" name="w" id="${id}">
117117 ${[1, 2, 3].slice(0, MAX_W).map((n) => html`<option value="${String(n)}" ${n === (p?.w ?? 1) ? raw("selected") : null}>${String(n)} wide</option>`)}
118 </select></label>
119 <label class="qf"><span>Height</span><select class="input" name="h">
118 </select>`)}
119 ${qf("Height", (id) => html`<select class="input" name="h" id="${id}">
120120 ${[1, 2, 3].slice(0, MAX_H).map((n) => html`<option value="${String(n)}" ${n === (p?.h ?? 1) ? raw("selected") : null}>${String(n)} high</option>`)}
121 </select></label>
121 </select>`)}
122122 ${fields}
123123 ${btn(op === "edit" ? "Save panel" : "Add panel", { variant: "primary" })}
124124 </form>`;
@@ -161,12 +161,12 @@ function manage(slug: string, board: Board, adding: Html, pins: ReturnType<typeo
161161 )}
162162 ${card(
163163 html`<form method="post" action="/boards/${slug}/rename" class="bform">
164 <label class="qf"><span>Board title</span><input class="input" name="title" required maxlength="${String(MAX_TITLE)}" value="${board.title}" /></label>
164 ${qf("Board title", (id) => html`<input class="input" name="title" id="${id}" required maxlength="${String(MAX_TITLE)}" value="${board.title}" />`)}
165165 ${btn("Rename")}
166166 </form>
167167 <form method="post" action="/boards/${slug}/settings" class="bform">
168 <label class="qf"><span>Range</span><select class="input" name="range">${RANGES.map((r) => option(r, r === board.range))}</select></label>
169 <label class="qf"><span>Live</span><select class="input" name="refresh"><option value="off" ${board.refresh === "off" ? raw("selected") : null}>off</option><option value="10s" ${board.refresh === "off" ? null : raw("selected")}>on: redraw when events arrive</option></select></label>
168 ${qf("Range", (id) => html`<select class="input" name="range" id="${id}">${RANGES.map((r) => option(r, r === board.range))}</select>`)}
169 ${qf("Live", (id) => html`<select class="input" name="refresh" id="${id}"><option value="off" ${board.refresh === "off" ? raw("selected") : null}>off</option><option value="10s" ${board.refresh === "off" ? null : raw("selected")}>on: redraw when events arrive</option></select>`)}
170170 ${btn("Save settings")}
171171 </form>
172172 <form method="post" action="/boards/${slug}/duplicate" class="bform">${btn("Duplicate")}</form>
src/web/pages/boards.ts +44 −36
@@ -140,64 +140,72 @@ export function machineLinks(now: number): { label: string; href: string }[] {
140140 const option = (value: string, label: string, selected: boolean) =>
141141 html`<option value="${value}" ${selected ? raw("selected") : null}>${label}</option>`;
142142
143 let fieldSeq = 0;
144
145 /** A labelled control in §5's `.field`; `control` gets the id its label points at. */
146 export function qf(label: string, control: (id: string) => Html, title?: string): Html {
147 const id = `bq-${String(++fieldSeq)}`;
148 return html`<div class="field" ${title ? html`title="${title}"` : null}><label for="${id}">${label}</label>${control(id)}</div>`;
149 }
150
143151 /** The inputs that say a query, filled from `p`; the page's form and a panel's share them. */
144152 export function queryFields(p: Params) {
145153 const src = Object.hasOwn(SOURCES, p.source) ? SOURCES[p.source]! : undefined;
146154 const cols = src ? Object.keys(src.columns) : [];
147155 return html`
148 <label class="qf"><span>Chart</span>
149 <select class="input" name="chart">
156 ${qf("Chart", (id) => html`
157 <select class="input" name="chart" id="${id}">
150158 ${CHARTS.map((c) => option(c, CHART_NAMES[c], c === p.chart))}
151159 </select>
152 </label>
153 <label class="qf"><span>Source</span>
154 <select class="input" name="source">
160 `)}
161 ${qf("Source", (id) => html`
162 <select class="input" name="source" id="${id}">
155163 ${Object.keys(SOURCES).map((n) => option(n, n, n === p.source))}
156164 </select>
157 </label>
158 <label class="qf"><span>Aggregate</span>
159 <select class="input" name="aggregate">
165 `)}
166 ${qf("Aggregate", (id) => html`
167 <select class="input" name="aggregate" id="${id}">
160168 ${AGGREGATES.map((a) => option(a, a, a === p.aggregate))}
161169 </select>
162 </label>
163 <label class="qf" title="Column to aggregate"><span>Column</span>
164 <select class="input" name="column">
170 `)}
171 ${qf("Column", (id) => html`
172 <select class="input" name="column" id="${id}">
165173 ${option("", "(rows)", p.column === "")}
166174 ${cols.filter((c) => src!.columns[c] === "number").map((c) => option(c, c, c === p.column))}
167175 </select>
168 </label>
169 <label class="qf" title="Group by"><span>Group by</span>
170 <select class="input" name="by">
176 `, "Column to aggregate")}
177 ${qf("Group by", (id) => html`
178 <select class="input" name="by" id="${id}">
171179 ${(Object.keys(BUCKET_MS) as Bucket[]).map((b) => option(b, `per ${b}`, b === p.by))}
172180 ${cols.map((c) => option(c, `by ${c}`, c === p.by))}
173181 </select>
174 </label>
175 <label class="qf" title="Series (stacked area, heat strip, table)"><span>Series</span>
176 <select class="input" name="series">
182 `, "Group by")}
183 ${qf("Series", (id) => html`
184 <select class="input" name="series" id="${id}">
177185 ${option("", "(one series)", p.series === "")}
178186 ${cols.map((c) => option(c, `split by ${c}`, c === p.series))}
179187 </select>
180 </label>
181 <label class="qf"><span>From</span>
182 <input class="input mono" name="from" value="${p.from}" placeholder="from 2026-10-01" maxlength="${MAX_PARAM}" />
183 </label>
184 <label class="qf"><span>To</span>
185 <input class="input mono" name="to" value="${p.to}" placeholder="to 2026-10-08" maxlength="${MAX_PARAM}" />
186 </label>
187 <label class="qf"><span>Filter column</span>
188 <select class="input" name="fcolumn">
188 `, "Series (stacked area, heat strip, table)")}
189 ${qf("From", (id) => html`
190 <input class="input mono" name="from" id="${id}" value="${p.from}" placeholder="from 2026-10-01" maxlength="${MAX_PARAM}" />
191 `)}
192 ${qf("To", (id) => html`
193 <input class="input mono" name="to" id="${id}" value="${p.to}" placeholder="to 2026-10-08" maxlength="${MAX_PARAM}" />
194 `)}
195 ${qf("Filter column", (id) => html`
196 <select class="input" name="fcolumn" id="${id}">
189197 ${option("", "(no filter)", p.fcolumn === "")}
190198 ${cols.map((c) => option(c, c, c === p.fcolumn))}
191199 </select>
192 </label>
193 <label class="qf"><span>Filter operator</span>
194 <select class="input" name="fop">
200 `)}
201 ${qf("Filter operator", (id) => html`
202 <select class="input" name="fop" id="${id}">
195203 ${OPS.map((o) => option(o, o, o === p.fop))}
196204 </select>
197 </label>
198 <label class="qf"><span>Filter value</span>
199 <input class="input mono" name="fvalue" value="${p.fvalue}" placeholder="value" maxlength="${MAX_PARAM}" />
200 </label>
205 `)}
206 ${qf("Filter value", (id) => html`
207 <input class="input mono" name="fvalue" id="${id}" value="${p.fvalue}" placeholder="value" maxlength="${MAX_PARAM}" />
208 `)}
201209 `;
202210 }
203211
@@ -299,10 +307,10 @@ export async function boardsPage(ctx: Ctx): Promise<Response> {
299307 (k) => html`<input type="hidden" name="${k}" value="${p[k as keyof Params]}" />`,
300308 )}
301309 <input type="hidden" name="w" value="1" /><input type="hidden" name="h" value="1" />
302 <label class="qf"><span>Board</span><select class="input" name="slug">
310 ${qf("Board", (id) => html`<select class="input" name="slug" id="${id}">
303311 ${boards.map((b) => html`<option value="${b.slug}">${b.board.title}</option>`)}
304 </select></label>
305 <label class="qf"><span>Panel title</span><input class="input" name="title" required maxlength="80" value="${`${p.aggregate} of ${p.source}`}" /></label>
312 </select>`)}
313 ${qf("Panel title", (id) => html`<input class="input" name="title" id="${id}" required maxlength="80" value="${`${p.aggregate} of ${p.source}`}" />`)}
306314 ${btn("Pin to board")}
307315 </form>`,
308316 { head: html`<h2>Pin this query</h2>` },
src/web/style/content.ts +1 −2
@@ -362,8 +362,7 @@ a.origin-chip:hover { border-color: var(--border-strong); color: var(--fg); }
362362 .bp-h2 .chart-box.is-table { height: 400px; }
363363 .bp-h3 .chart-box.is-table { height: 540px; }
364364 .bform { display: flex; flex-wrap: wrap; align-items: flex-end; gap: 10px 12px; margin-bottom: 8px; }
365 .bform .qf { display: flex; flex-direction: column; gap: 4px; flex: 1 1 140px; min-width: 0; }
366 .bform .qf > span { font-size: 12.5px; font-weight: 600; color: var(--fg); }
365 .bform .field { flex: 1 1 140px; min-width: 0; margin: 0; }
367366 .bform .btn { flex: none; }
368367 .boards-result .table { margin-top: 12px; }
369368 .bt-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(min(100%, 300px), 1fr)); gap: 2px 16px; font-family: var(--mono); font-size: 12.5px; margin-top: 8px; }
test/boards-selectors.test.ts +4 −3
@@ -57,16 +57,17 @@ test("every query selector has a visible label and sits outside .row-actions", a
5757 expect(form).not.toBeNull();
5858 expect(form![0]).not.toContain("row-actions");
5959 expect(form![0]).toContain('class="bform"');
60 expect(html).not.toContain("qf");
6061 for (const name of ["chart", "source", "aggregate", "column", "by", "series", "from", "to", "fcolumn", "fop", "fvalue"]) {
61 const m = form![1]!.match(new RegExp(`<label class="qf"[^>]*><span>([^<]+)</span>\\s*<(?:select|input)[^>]* name="${name}"`));
62 const m = form![1]!.match(new RegExp(`<div class="field"[^>]*><label for="([^"]+)">([^<]+)</label>\\s*<(?:select|input)[^>]* name="${name}" id="\\1"`));
6263 expect(m, name).not.toBeNull();
63 expect(m![1]!.trim().length, name).toBeGreaterThan(0);
64 expect(m![2]!.trim().length, name).toBeGreaterThan(0);
6465 }
6566 });
6667
6768 test("the selector styles never hide or collapse a control", () => {
6869 const css = components + content;
69 const rules = [...css.matchAll(/(^|\})\s*([^{}]*\.(?:bform|qf)[^{}]*)\{([^}]*)\}/g)].map((m) => m[3]!);
70 const rules = [...css.matchAll(/(^|\})\s*([^{}]*\.(?:bform)[^{}]*)\{([^}]*)\}/g)].map((m) => m[3]!);
7071 expect(rules.length).toBeGreaterThan(0);
7172 for (const body of rules) {
7273 expect(body).not.toMatch(/opacity:\s*0\b|display:\s*none|visibility:\s*hidden|height:\s*0\b/);

↑↓ navigate ↵ open ⌘↵ its app esc close

Keyboard shortcuts

Docs