Public: anyone can read this; the crew can change it.
The /boards data and pin forms use §5's .field, and no .qf remains in src/web/pages/boards.ts #4634
scout/forge:scout/4590-the-boards-data-and-pin-forms-use-5-s-fi → main 2 commits fork
8 files
changed +66
−72
docs/DESIGN.md +1 −1
| @@ -395,7 +395,7 @@ gone, so this list only shrinks. | ||
| 395 | 395 | A `.field` directly inside a `.bar` drops its bottom margin and the bar aligns to the end, so a labelled input and its button share a baseline |
| 396 | 396 | - **`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` `.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` |
| 397 | 397 | - **`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` |
| 398 | - **`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, lineage: `.app-shelf` `.backups-drill` `.backups-error` `.backups-now` `.backups-restore` `.bform` `.bgrid` `.bmanage` `.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` `.commit-body` `.commit-head` `.domain-records` `.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` `.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` `.headroom` `.issue-head` `.issue-meta` `.merge-box` `.merge-form` `.merge-headline` `.merge-sub` `.mirror-form` `.number` `.origin-mark` `.origin-name` `.origin-row` `.owner` `.page-head` `.path-head` `.policy-line` `.qf` `.repo-actions` `.repo-audience` `.repo-desc` `.repo-layout` `.repo-lineage` `.repo-title` `.search` `.slash` `.stage-detail` `.stage-dot` `.steps` `.sub` `.sys-pair` `.table-wrap` `.tok` `.tree-row` `.tree-total` `.wall-cells` `.where-sep` | |
| 398 | - **`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, lineage: `.app-shelf` `.backups-drill` `.backups-error` `.backups-now` `.backups-restore` `.bform` `.bgrid` `.bmanage` `.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` `.commit-body` `.commit-head` `.domain-records` `.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` `.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` `.headroom` `.issue-head` `.issue-meta` `.merge-box` `.merge-form` `.merge-headline` `.merge-sub` `.mirror-form` `.number` `.origin-mark` `.origin-name` `.origin-row` `.owner` `.page-head` `.path-head` `.policy-line` `.repo-actions` `.repo-audience` `.repo-desc` `.repo-layout` `.repo-lineage` `.repo-title` `.search` `.slash` `.stage-detail` `.stage-dot` `.steps` `.sub` `.sys-pair` `.table-wrap` `.tok` `.tree-row` `.tree-total` `.wall-cells` `.where-sep` | |
| 399 | 399 | - **`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` |
| 400 | 400 | - **`style/content.ts`, prose (markdown)** — table cell alignment, built by `markdown.ts` as `ta-${align}`: `.ta-c` `.ta-r` |
| 401 | 401 | - **`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` |
src/web/pages/boards-view.ts +1 −1
| @@ -140,7 +140,7 @@ function manage(slug: string, board: Board, adding: Html, pins: ReturnType<typeo | ||
| 140 | 140 | const one = (p: Panel, i: number) => html`<li class="row"> |
| 141 | 141 | <details class="row-main"> |
| 142 | 142 | <summary><strong class="break">${p.title}</strong> <span class="muted small">${CHART_NAMES[p.chart]} · ${String(p.w)}×${String(p.h)}</span></summary> |
| 143 | ${panelForm(slug, "edit", p, i, queryFields(paramsOf(p.query, p.chart)))} | |
| 143 | ${panelForm(slug, "edit", p, i, queryFields(paramsOf(p.query, p.chart), `q-p${i}`))} | |
| 144 | 144 | </details> |
| 145 | 145 | <div class="row-trail bar"> |
| 146 | 146 | ${pinForm(slug, p.title, isPinned(pins, slug, p.title))} |
src/web/pages/boards.ts +52 −59
| @@ -18,7 +18,7 @@ import { notePhase, takeSessionTime, timePhase, timePhaseAsync } from "../../cor | ||
| 18 | 18 | import { notFoundPage } from "../chrome.ts"; |
| 19 | 19 | import { html, raw, when } from "../html.ts"; |
| 20 | 20 | import { page } from "../layout.ts"; |
| 21 | import { btn, card, chartBox, empty } from "../ui.ts"; | |
| 21 | import { btn, card, chartBox, empty, field, selectField } from "../ui.ts"; | |
| 22 | 22 | |
| 23 | 23 | const BUCKET_MS = { minute: 60_000, hour: 3_600_000, day: 86_400_000 } as const; |
| 24 | 24 | const AGGREGATES = ["count", "sum", "avg", "max"] as const; |
| @@ -137,63 +137,53 @@ const option = (value: string, label: string, selected: boolean) => | ||
| 137 | 137 | html`<option value="${value}" ${selected ? raw("selected") : null}>${label}</option>`; |
| 138 | 138 | |
| 139 | 139 | /** The inputs that say a query, filled from `p`; the page's form and a panel's share them. */ |
| 140 | export function queryFields(p: Params) { | |
| 140 | export function queryFields(p: Params, idp = "q") { | |
| 141 | 141 | const src = Object.hasOwn(SOURCES, p.source) ? SOURCES[p.source]! : undefined; |
| 142 | 142 | const cols = src ? Object.keys(src.columns) : []; |
| 143 | const pick = (name: string, label: string, options: { value: string; label: string }[], current: string, hint?: string) => | |
| 144 | selectField({ | |
| 145 | label, | |
| 146 | name, | |
| 147 | id: `${idp}-${name}`, | |
| 148 | ...(hint ? { hint } : {}), | |
| 149 | options: options.map((o) => ({ ...o, selected: o.value === current })), | |
| 150 | }); | |
| 151 | const same = (v: string) => ({ value: v, label: v }); | |
| 152 | const text = (name: string, label: string, value: string, placeholder: string) => | |
| 153 | field({ label, name, id: `${idp}-${name}`, value, placeholder, mono: true, maxlength: MAX_PARAM }); | |
| 143 | 154 | return html` |
| 144 | <label class="qf"><span>Chart</span> | |
| 145 | <select class="input" name="chart"> | |
| 146 | ${CHARTS.map((c) => option(c, CHART_NAMES[c], c === p.chart))} | |
| 147 | </select> | |
| 148 | </label> | |
| 149 | <label class="qf"><span>Source</span> | |
| 150 | <select class="input" name="source"> | |
| 151 | ${Object.keys(SOURCES).map((n) => option(n, n, n === p.source))} | |
| 152 | </select> | |
| 153 | </label> | |
| 154 | <label class="qf"><span>Aggregate</span> | |
| 155 | <select class="input" name="aggregate"> | |
| 156 | ${AGGREGATES.map((a) => option(a, a, a === p.aggregate))} | |
| 157 | </select> | |
| 158 | </label> | |
| 159 | <label class="qf" title="Column to aggregate"><span>Column</span> | |
| 160 | <select class="input" name="column"> | |
| 161 | ${option("", "(rows)", p.column === "")} | |
| 162 | ${cols.filter((c) => src!.columns[c] === "number").map((c) => option(c, c, c === p.column))} | |
| 163 | </select> | |
| 164 | </label> | |
| 165 | <label class="qf" title="Group by"><span>Group by</span> | |
| 166 | <select class="input" name="by"> | |
| 167 | ${(Object.keys(BUCKET_MS) as Bucket[]).map((b) => option(b, `per ${b}`, b === p.by))} | |
| 168 | ${cols.map((c) => option(c, `by ${c}`, c === p.by))} | |
| 169 | </select> | |
| 170 | </label> | |
| 171 | <label class="qf" title="Series (stacked area, heat strip, table)"><span>Series</span> | |
| 172 | <select class="input" name="series"> | |
| 173 | ${option("", "(one series)", p.series === "")} | |
| 174 | ${cols.map((c) => option(c, `split by ${c}`, c === p.series))} | |
| 175 | </select> | |
| 176 | </label> | |
| 177 | <label class="qf"><span>From</span> | |
| 178 | <input class="input mono" name="from" value="${p.from}" placeholder="from 2026-10-01" maxlength="${MAX_PARAM}" /> | |
| 179 | </label> | |
| 180 | <label class="qf"><span>To</span> | |
| 181 | <input class="input mono" name="to" value="${p.to}" placeholder="to 2026-10-08" maxlength="${MAX_PARAM}" /> | |
| 182 | </label> | |
| 183 | <label class="qf"><span>Filter column</span> | |
| 184 | <select class="input" name="fcolumn"> | |
| 185 | ${option("", "(no filter)", p.fcolumn === "")} | |
| 186 | ${cols.map((c) => option(c, c, c === p.fcolumn))} | |
| 187 | </select> | |
| 188 | </label> | |
| 189 | <label class="qf"><span>Filter operator</span> | |
| 190 | <select class="input" name="fop"> | |
| 191 | ${OPS.map((o) => option(o, o, o === p.fop))} | |
| 192 | </select> | |
| 193 | </label> | |
| 194 | <label class="qf"><span>Filter value</span> | |
| 195 | <input class="input mono" name="fvalue" value="${p.fvalue}" placeholder="value" maxlength="${MAX_PARAM}" /> | |
| 196 | </label> | |
| 155 | ${pick("chart", "Chart", CHARTS.map((c) => ({ value: c, label: CHART_NAMES[c] })), p.chart)} | |
| 156 | ${pick("source", "Source", Object.keys(SOURCES).map(same), p.source)} | |
| 157 | ${pick("aggregate", "Aggregate", AGGREGATES.map(same), p.aggregate)} | |
| 158 | ${pick( | |
| 159 | "column", | |
| 160 | "Column", | |
| 161 | [{ value: "", label: "(rows)" }, ...cols.filter((c) => src!.columns[c] === "number").map(same)], | |
| 162 | p.column, | |
| 163 | "Column to aggregate", | |
| 164 | )} | |
| 165 | ${pick( | |
| 166 | "by", | |
| 167 | "Group by", | |
| 168 | [ | |
| 169 | ...(Object.keys(BUCKET_MS) as Bucket[]).map((b) => ({ value: b, label: `per ${b}` })), | |
| 170 | ...cols.map((c) => ({ value: c, label: `by ${c}` })), | |
| 171 | ], | |
| 172 | p.by, | |
| 173 | "Group by", | |
| 174 | )} | |
| 175 | ${pick( | |
| 176 | "series", | |
| 177 | "Series", | |
| 178 | [{ value: "", label: "(one series)" }, ...cols.map((c) => ({ value: c, label: `split by ${c}` }))], | |
| 179 | p.series, | |
| 180 | "Series (stacked area, heat strip, table)", | |
| 181 | )} | |
| 182 | ${text("from", "From", p.from, "from 2026-10-01")} | |
| 183 | ${text("to", "To", p.to, "to 2026-10-08")} | |
| 184 | ${pick("fcolumn", "Filter column", [{ value: "", label: "(no filter)" }, ...cols.map(same)], p.fcolumn)} | |
| 185 | ${pick("fop", "Filter operator", OPS.map(same), p.fop)} | |
| 186 | ${text("fvalue", "Filter value", p.fvalue, "value")} | |
| 197 | 187 | `; |
| 198 | 188 | } |
| 199 | 189 | |
| @@ -295,10 +285,13 @@ export async function boardsPage(ctx: Ctx): Promise<Response> { | ||
| 295 | 285 | (k) => html`<input type="hidden" name="${k}" value="${p[k as keyof Params]}" />`, |
| 296 | 286 | )} |
| 297 | 287 | <input type="hidden" name="w" value="1" /><input type="hidden" name="h" value="1" /> |
| 298 | <label class="qf"><span>Board</span><select class="input" name="slug"> | |
| 299 | ${boards.map((b) => html`<option value="${b.slug}">${b.board.title}</option>`)} | |
| 300 | </select></label> | |
| 301 | <label class="qf"><span>Panel title</span><input class="input" name="title" required maxlength="80" value="${`${p.aggregate} of ${p.source}`}" /></label> | |
| 288 | ${selectField({ | |
| 289 | label: "Board", | |
| 290 | name: "slug", | |
| 291 | id: "pin-slug", | |
| 292 | options: boards.map((b) => ({ value: b.slug, label: b.board.title })), | |
| 293 | })} | |
| 294 | ${field({ label: "Panel title", name: "title", id: "pin-title", required: true, maxlength: 80, value: `${p.aggregate} of ${p.source}` })} | |
| 302 | 295 | ${btn("Pin to board")} |
| 303 | 296 | </form>`, |
| 304 | 297 | { head: html`<h2>Pin this query</h2>` }, |
src/web/style/content.ts −2
| @@ -290,8 +290,6 @@ a.origin-chip:hover { border-color: var(--border-strong); color: var(--fg); } | ||
| 290 | 290 | .bp-h2 .chart-box.is-table { height: 400px; } |
| 291 | 291 | .bp-h3 .chart-box.is-table { height: 540px; } |
| 292 | 292 | .bform { display: flex; flex-wrap: wrap; align-items: flex-end; gap: 10px 12px; margin-bottom: 8px; } |
| 293 | .bform .qf { display: flex; flex-direction: column; gap: 4px; flex: 1 1 140px; min-width: 0; } | |
| 294 | .bform .qf > span { font-size: 12.5px; font-weight: 600; color: var(--fg); } | |
| 295 | 293 | .bform .field { margin: 0; flex: 1 1 140px; min-width: 0; } |
| 296 | 294 | .bform .btn { flex: none; } |
| 297 | 295 | .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; } |
src/web/ui.ts +2 −2
| @@ -1173,7 +1173,7 @@ export function selectField( | ||
| 1173 | 1173 | const id = o.id ?? `f-${o.name}`; |
| 1174 | 1174 | return html`<div class="field"> |
| 1175 | 1175 | <label for="${id}">${o.label}</label> |
| 1176 | <select class="input" id="${id}" name="${o.name}"> | |
| 1176 | <select class="input" id="${id}" name="${o.name}" ${o.hint ? html`aria-describedby="${id}-hint"` : null}> | |
| 1177 | 1177 | ${o.options.map( |
| 1178 | 1178 | (opt) => |
| 1179 | 1179 | html`<option |
| @@ -1184,7 +1184,7 @@ export function selectField( | ||
| 1184 | 1184 | </option>`, |
| 1185 | 1185 | )} |
| 1186 | 1186 | </select> |
| 1187 | ${o.hint ? html`<span class="hint">${o.hint}</span>` : null} | |
| 1187 | ${o.hint ? html`<span class="hint" id="${id}-hint">${o.hint}</span>` : null} | |
| 1188 | 1188 | </div>`; |
| 1189 | 1189 | } |
| 1190 | 1190 |
test/boards-page.test.ts +3 −3
| @@ -224,9 +224,9 @@ describe("every chart type from one seeded query", () => { | ||
| 224 | 224 | }); |
| 225 | 225 | test("the chart is chosen beside the query", async () => { |
| 226 | 226 | const body = await drawn("heat"); |
| 227 | expect(body).toMatch(/<select class="input" name="chart"[^>]*>/); | |
| 228 | expect(body).toContain('<option value="heat" selected>heat strip</option>'); | |
| 229 | expect(body).toContain('<option value="kind" selected>split by kind</option>'); | |
| 227 | expect(body).toMatch(/<select class="input" id="q-chart"\s+name="chart"[^>]*>/); | |
| 228 | expect(body).toMatch(/<option\s+value="heat"\s+selected\s*>\s*heat strip\s*<\/option>/); | |
| 229 | expect(body).toMatch(/<option\s+value="kind"\s+selected\s*>\s*split by kind\s*<\/option>/); | |
| 230 | 230 | }); |
| 231 | 231 | }); |
| 232 | 232 |
test/boards-selectors.test.ts +6 −3
| @@ -57,16 +57,19 @@ test("every query selector has a visible label and sits outside .row-actions", a | ||
| 57 | 57 | expect(form).not.toBeNull(); |
| 58 | 58 | expect(form![0]).not.toContain("row-actions"); |
| 59 | 59 | expect(form![0]).toContain('class="bform"'); |
| 60 | expect(html).not.toContain('class="qf'); | |
| 61 | expect(html).not.toMatch(/<label>\s*<span>/); | |
| 62 | expect(form![0]).toContain('aria-describedby="q-column-hint"'); | |
| 63 | expect(form![0]).not.toContain("title="); | |
| 60 | 64 | 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 | expect(m, name).not.toBeNull(); | |
| 65 | const m = form![1]!.match(new RegExp(`<label for="q-${name}">([^<]+)</label>\\s*<(?:select|input)[^>]* id="q-${name}"\\s+name="${name}"`)); | |
| 63 | 66 | expect(m![1]!.trim().length, name).toBeGreaterThan(0); |
| 64 | 67 | } |
| 65 | 68 | }); |
| 66 | 69 | |
| 67 | 70 | test("the selector styles never hide or collapse a control", () => { |
| 68 | 71 | const css = components + content; |
| 69 | const rules = [...css.matchAll(/(^|\})\s*([^{}]*\.(?:bform|qf)[^{}]*)\{([^}]*)\}/g)].map((m) => m[3]!); | |
| 72 | const rules = [...css.matchAll(/(^|\})\s*([^{}]*\.(?:bform|field)[^{}]*)\{([^}]*)\}/g)].map((m) => m[3]!); | |
| 70 | 73 | expect(rules.length).toBeGreaterThan(0); |
| 71 | 74 | for (const body of rules) { |
| 72 | 75 | expect(body).not.toMatch(/opacity:\s*0\b|display:\s*none|visibility:\s*hidden|height:\s*0\b/); |
test/boards-store.test.ts +1 −1
| @@ -250,7 +250,7 @@ describe("/boards", () => { | ||
| 250 | 250 | // runs in range: three days × three kinds for the heat strip; three days of bars, the series set aside |
| 251 | 251 | expect(page.match(/<rect class="cell"/g)?.length).toBe(9); |
| 252 | 252 | expect(page.match(/<rect class="bar"/g)?.length).toBe(3); |
| 253 | expect(page).toContain('<option value="heat" selected>heat strip</option>'); | |
| 253 | expect(page).toMatch(/<option\s+value="heat"\s+selected\s*>\s*heat strip\s*<\/option>/); | |
| 254 | 254 | expect(parseBoard({ ...board, panels: [{ ...board.panels[0], chart: "pie" }] }).ok).toBe(false); |
| 255 | 255 | await deleteBoard(app, alice, "charts"); |
| 256 | 256 | }); |
new above
offline