Public: anyone can read this; the crew can change it.
Design: a migration's progress stages use §5's row and badge, and stage-dot/stage-detail leave §5d #4040
scout/forge:scout/3872-design-a-migration-s-progress-stages-use → main 3 commits fork
8 files
changed +72
−37
docs/DESIGN.md +4
| @@ -392,7 +392,11 @@ gone, so this list only shrinks. | ||
| 392 | 392 | - **`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` |
| 393 | 393 | - **`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` |
| 394 | 394 | - **`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` |
| 395 | <<<<<<< HEAD | |
| 396 | - **`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` `.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` `.steps` `.sub` `.sys-pair` `.table-wrap` `.terminal-line` `.tok` `.tree-row` `.tree-total` `.wall-cells` `.where-dot` `.where-note` `.where-sep` | |
| 397 | ======= | |
| 395 | 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, 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` `.commit-body` `.commit-head` `.connect-more` `.connect-path` `.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` `.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` |
| 399 | >>>>>>> origin/main | |
| 396 | 400 | - **`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` |
| 397 | 401 | - **`style/content.ts`, prose (markdown)** — table cell alignment, built by `markdown.ts` as `ta-${align}`: `.ta-c` `.ta-r` |
| 398 | 402 | - **`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/client.ts +11 −4
| @@ -103,8 +103,10 @@ export const mirrorJs = /* js */ ` | ||
| 103 | 103 | var url = list.getAttribute('data-stream'); |
| 104 | 104 | if (!url) return; |
| 105 | 105 | |
| 106 | var rows = Array.prototype.slice.call(list.querySelectorAll('li[data-stage-name]')); | |
| 106 | var rows = Array.prototype.slice.call(list.querySelectorAll('[data-stage-name]')); | |
| 107 | 107 | var order = rows.map(function (li) { return li.getAttribute('data-stage-name'); }); |
| 108 | var words = { done: 'Done', now: 'Working', todo: 'Waiting' }; | |
| 109 | var tones = { done: 'success', now: 'attn', todo: 'secondary' }; | |
| 108 | 110 | var glyph = { done: '\\u25CF', now: '\\u25D0', failed: '\\u2715', todo: '\\u25CB' }; |
| 109 | 111 | |
| 110 | 112 | function paint(stage, detail) { |
| @@ -116,10 +118,15 @@ export const mirrorJs = /* js */ ` | ||
| 116 | 118 | : i === there ? (stage === 'done' ? 'done' : 'now') |
| 117 | 119 | : 'todo'; |
| 118 | 120 | li.setAttribute('data-state', state); |
| 119 | var dot = li.querySelector('.stage-dot'); | |
| 121 | var dot = li.querySelector('[data-stage-mark]'); | |
| 120 | 122 | if (dot) dot.textContent = glyph[state]; |
| 121 | var note = li.querySelector('.stage-detail'); | |
| 122 | if (note) note.textContent = state === 'now' ? (detail || '') : ''; | |
| 123 | var note = li.querySelector('[data-stage-note]'); | |
| 124 | if (note) note.textContent = state === 'now' ? (detail || '\\u00a0') : '\\u00a0'; | |
| 125 | var badge = li.querySelector('.badge'); | |
| 126 | if (badge) { | |
| 127 | badge.textContent = words[state]; | |
| 128 | badge.setAttribute('data-variant', tones[state]); | |
| 129 | } | |
| 123 | 130 | }); |
| 124 | 131 | } |
| 125 | 132 |
src/web/pages/browse.ts +8 −8
| @@ -72,6 +72,7 @@ import { | ||
| 72 | 72 | tlComment, |
| 73 | 73 | userTag, |
| 74 | 74 | type IconName, |
| 75 | stageRow, | |
| 75 | 76 | } from "../ui.ts"; |
| 76 | 77 | import { browseCommit, browseCommits } from "./commits.ts"; |
| 77 | 78 | import { blankDraft, editorPage, runContribute } from "./edit.ts"; |
| @@ -1023,12 +1024,10 @@ function stageState( | ||
| 1023 | 1024 | return "todo"; |
| 1024 | 1025 | } |
| 1025 | 1026 | |
| 1026 | const GLYPH = { done: "●", now: "◐", todo: "○" } as const; | |
| 1027 | ||
| 1028 | 1027 | /** The checklist. Its shape is what `mirrorJs` updates in place. */ |
| 1029 | 1028 | export function stageList(job: MirrorJob, streamUrl: string): Html { |
| 1030 | 1029 | return html`<ol |
| 1031 | class="stages" | |
| 1030 | class="list" | |
| 1032 | 1031 | id="stages" |
| 1033 | 1032 | data-stream="${streamUrl}" |
| 1034 | 1033 | data-stage="${job.stage}" |
| @@ -1038,11 +1037,12 @@ export function stageList(job: MirrorJob, streamUrl: string): Html { | ||
| 1038 | 1037 | > |
| 1039 | 1038 | ${STAGES.map((stage) => { |
| 1040 | 1039 | const state = stageState(stage.name, job.stage); |
| 1041 | return html`<li data-stage-name="${stage.name}" data-state="${state}"> | |
| 1042 | <span class="stage-dot" aria-hidden="true">${GLYPH[state]}</span> | |
| 1043 | <span class="stage-label">${stage.label}</span> | |
| 1044 | <span class="stage-detail">${state === "now" ? job.detail : ""}</span> | |
| 1045 | </li>`; | |
| 1040 | return stageRow({ | |
| 1041 | name: stage.name, | |
| 1042 | label: stage.label, | |
| 1043 | state, | |
| 1044 | detail: state === "now" ? job.detail : "", | |
| 1045 | }); | |
| 1046 | 1046 | })} |
| 1047 | 1047 | </ol>`; |
| 1048 | 1048 | } |
src/web/pages/migrate.ts +13 −9
| @@ -56,6 +56,7 @@ import { | ||
| 56 | 56 | row, |
| 57 | 57 | selectField, |
| 58 | 58 | field as formField, |
| 59 | stageRow, | |
| 59 | 60 | } from "../ui.ts"; |
| 60 | 61 | import { prefill, originHost } from "./migrate-prefill.ts"; |
| 61 | 62 | import { githubConnectable, hostLabel } from "./origins.ts"; |
| @@ -708,7 +709,7 @@ const stagesFor = (job: MirrorJob): typeof STAGES => | ||
| 708 | 709 | function stageRows(job: MirrorJob): Html { |
| 709 | 710 | const stages = stagesFor(job); |
| 710 | 711 | const at = stages.findIndex((s) => s.name === job.stage); |
| 711 | return html`<ol class="stages"> | |
| 712 | return html`<ol class="list"> | |
| 712 | 713 | ${stages.map((stage, i) => { |
| 713 | 714 | const state = |
| 714 | 715 | job.stage === "failed" |
| @@ -718,12 +719,12 @@ function stageRows(job: MirrorJob): Html { | ||
| 718 | 719 | : i === at |
| 719 | 720 | ? "now" |
| 720 | 721 | : "todo"; |
| 721 | const glyph = state === "done" ? "●" : state === "now" ? "◐" : "○"; | |
| 722 | return html`<li data-stage-name="${stage.name}" data-state="${state}"> | |
| 723 | <span class="stage-dot" aria-hidden="true">${glyph}</span> | |
| 724 | <span class="stage-label">${stage.label}</span> | |
| 725 | <span class="stage-detail">${state === "now" ? job.detail : ""}</span> | |
| 726 | </li>`; | |
| 722 | return stageRow({ | |
| 723 | name: stage.name, | |
| 724 | label: stage.label, | |
| 725 | state, | |
| 726 | detail: state === "now" ? job.detail : "", | |
| 727 | }); | |
| 727 | 728 | })} |
| 728 | 729 | </ol>`; |
| 729 | 730 | } |
| @@ -753,8 +754,11 @@ const migrateJobJs = /* js */ ` | ||
| 753 | 754 | var state = data.stage === 'failed' ? 'todo' |
| 754 | 755 | : data.stage === 'done' || idx < at ? 'done' : idx === at ? 'now' : 'todo'; |
| 755 | 756 | row.setAttribute('data-state', state); |
| 756 | row.querySelector('.stage-dot').textContent = state === 'done' ? '\\u25cf' : state === 'now' ? '\\u25d0' : '\\u25cb'; | |
| 757 | row.querySelector('.stage-detail').textContent = state === 'now' && data.detail ? data.detail : ''; | |
| 757 | row.querySelector('[data-stage-mark]').textContent = state === 'done' ? '\\u25cf' : state === 'now' ? '\\u25d0' : '\\u25cb'; | |
| 758 | row.querySelector('[data-stage-note]').textContent = state === 'now' && data.detail ? data.detail : '\\u00a0'; | |
| 759 | var badge = row.querySelector('.badge'); | |
| 760 | badge.textContent = state === 'done' ? 'Done' : state === 'now' ? 'Working' : 'Waiting'; | |
| 761 | badge.setAttribute('data-variant', state === 'done' ? 'success' : state === 'now' ? 'attn' : 'secondary'); | |
| 758 | 762 | } |
| 759 | 763 | if (data.stage === 'done' || data.stage === 'failed') { source.close(); location.reload(); } |
| 760 | 764 | } |
src/web/style/content.ts −16
| @@ -111,22 +111,6 @@ a.where-place:hover, button.where-place:hover { | ||
| 111 | 111 | .live-note p { text-wrap: pretty; } |
| 112 | 112 | .live-note strong { color: var(--fg); } |
| 113 | 113 | |
| 114 | /* A mirror in flight. One row per stage, in the order they happen; the row | |
| 115 | says which of the three states it is in and nothing else moves. */ | |
| 116 | .stages { list-style: none; margin: 0; padding: 0; } | |
| 117 | .stages li { | |
| 118 | display: flex; align-items: center; gap: 10px; | |
| 119 | padding: 8px 0; font-size: 13px; color: var(--faint); | |
| 120 | } | |
| 121 | .stages li + li { border-top: 1px solid var(--border); } | |
| 122 | .stages li[data-state="done"] { color: var(--muted-fg); } | |
| 123 | .stages li[data-state="done"] .stage-dot { color: var(--success); } | |
| 124 | .stages li[data-state="now"] { color: var(--fg); font-weight: 560; } | |
| 125 | .stages li[data-state="now"] .stage-dot { color: var(--accent); } | |
| 126 | .stages li[data-state="failed"] { color: var(--danger); } | |
| 127 | .stages li[data-state="failed"] .stage-dot { color: var(--danger); } | |
| 128 | .stage-dot { flex: none; width: 16px; text-align: center; } | |
| 129 | .stage-detail { margin-left: auto; color: var(--faint); font-size: 12.5px; font-weight: 400; } | |
| 130 | 114 | .origin-chip { |
| 131 | 115 | display: inline-flex; align-items: center; gap: 6px; |
| 132 | 116 | max-width: 100%; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; |
src/web/ui.ts +27
| @@ -897,6 +897,33 @@ export function row(o: RowOptions): Html { | ||
| 897 | 897 | </li>`; |
| 898 | 898 | } |
| 899 | 899 | |
| 900 | /** The words and badge tones of a progress stage's three states. */ | |
| 901 | export const STAGE_WORD = { done: "Done", now: "Working", todo: "Waiting" } as const; | |
| 902 | const STAGE_BADGE = { | |
| 903 | done: { tone: "success" }, | |
| 904 | now: { tone: "attn" }, | |
| 905 | todo: { variant: "secondary" }, | |
| 906 | } as const; | |
| 907 | const STAGE_GLYPH = { done: "●", now: "◐", todo: "○" } as const; | |
| 908 | ||
| 909 | /** One progress stage as a row: glyph, label, the live detail, and a badge | |
| 910 | * saying the state in a word. `client.ts` and the migrate page repaint it | |
| 911 | * through the `data-stage-*` hooks. */ | |
| 912 | export function stageRow(o: { | |
| 913 | name: string; | |
| 914 | label: string; | |
| 915 | state: keyof typeof STAGE_WORD; | |
| 916 | detail: string; | |
| 917 | }): Html { | |
| 918 | return row({ | |
| 919 | title: o.label, | |
| 920 | lead: html`<span data-stage-mark aria-hidden="true">${STAGE_GLYPH[o.state]}</span>`, | |
| 921 | meta: html`<span data-stage-note>${o.detail === "" ? "\u00a0" : o.detail}</span>`, | |
| 922 | trail: badge(STAGE_WORD[o.state], STAGE_BADGE[o.state]), | |
| 923 | data: { "stage-name": o.name, state: o.state }, | |
| 924 | }); | |
| 925 | } | |
| 926 | ||
| 900 | 927 | // ---- navigation ---- |
| 901 | 928 | |
| 902 | 929 | export interface TabItem { |
test/migrate.test.ts +6
| @@ -1083,6 +1083,12 @@ describe("migrate", () => { | ||
| 1083 | 1083 | expect(page).toContain(`data-job="${job.id}"`); |
| 1084 | 1084 | expect(page).toContain("<noscript>"); |
| 1085 | 1085 | expect(page).toContain("Reload"); |
| 1086 | // Stages are §5 rows with a state badge; the old classes are gone. | |
| 1087 | expect(page).not.toContain("stage-dot"); | |
| 1088 | expect(page).not.toContain("stage-detail"); | |
| 1089 | expect(page).toContain("data-stage-mark"); | |
| 1090 | expect(page).toContain('data-variant="secondary"'); | |
| 1091 | expect(page).toContain("Waiting"); | |
| 1086 | 1092 | const streamPath = `/api/v1/migrate/${job.id}/stream`; |
| 1087 | 1093 | // Another person's stream is not found, as their page is. |
| 1088 | 1094 | expect((await browser(bobCookie, streamPath)).status).toBe(404); |
test/web-origins.test.ts +3
| @@ -308,6 +308,9 @@ describe("origins on the web", () => { | ||
| 308 | 308 | expect(running).toContain("Creating the repository"); |
| 309 | 309 | expect(running).toContain("Importing issues"); |
| 310 | 310 | expect(running).toContain('id="stages"'); |
| 311 | expect(running).not.toContain("stage-dot"); | |
| 312 | expect(running).not.toContain("stage-detail"); | |
| 313 | expect(running).toContain("data-stage-note"); | |
| 311 | 314 | |
| 312 | 315 | const jobId = jobPath.split("/").pop()!; |
| 313 | 316 | const done = await settled(jobId); |
new above
offline