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 #4038

Parked opened this
Closed without merging

scout/forge:scout/3872-design-a-migration-s-progress-stages-use → main 1 commit fork

  • Closed without merging. Nothing was applied to main.

Review

Sign in to review this change.
8 files changed +65 −38
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` `.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` `.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`
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`
src/web/client.ts +11 −4
@@ -103,8 +103,10 @@ export const mirrorJs = /* js */ `
103103 var url = list.getAttribute('data-stream');
104104 if (!url) return;
105105
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]'));
107107 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' };
108110 var glyph = { done: '\\u25CF', now: '\\u25D0', failed: '\\u2715', todo: '\\u25CB' };
109111
110112 function paint(stage, detail) {
@@ -116,10 +118,15 @@ export const mirrorJs = /* js */ `
116118 : i === there ? (stage === 'done' ? 'done' : 'now')
117119 : 'todo';
118120 li.setAttribute('data-state', state);
119 var dot = li.querySelector('.stage-dot');
121 var dot = li.querySelector('[data-stage-mark]');
120122 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 }
123130 });
124131 }
125132
src/web/pages/browse.ts +8 −8
@@ -72,6 +72,7 @@ import {
7272 tlComment,
7373 userTag,
7474 type IconName,
75 stageRow,
7576 } from "../ui.ts";
7677 import { browseCommit, browseCommits } from "./commits.ts";
7778 import { blankDraft, editorPage, runContribute } from "./edit.ts";
@@ -1023,12 +1024,10 @@ function stageState(
10231024 return "todo";
10241025 }
10251026
1026 const GLYPH = { done: "●", now: "◐", todo: "○" } as const;
1027
10281027 /** The checklist. Its shape is what `mirrorJs` updates in place. */
10291028 export function stageList(job: MirrorJob, streamUrl: string): Html {
10301029 return html`<ol
1031 class="stages"
1030 class="list"
10321031 id="stages"
10331032 data-stream="${streamUrl}"
10341033 data-stage="${job.stage}"
@@ -1038,11 +1037,12 @@ export function stageList(job: MirrorJob, streamUrl: string): Html {
10381037 >
10391038 ${STAGES.map((stage) => {
10401039 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 });
10461046 })}
10471047 </ol>`;
10481048 }
src/web/pages/migrate.ts +13 −9
@@ -56,6 +56,7 @@ import {
5656 row,
5757 selectField,
5858 field as formField,
59 stageRow,
5960 } from "../ui.ts";
6061 import { prefill, originHost } from "./migrate-prefill.ts";
6162 import { githubConnectable, hostLabel } from "./origins.ts";
@@ -708,7 +709,7 @@ const stagesFor = (job: MirrorJob): typeof STAGES =>
708709 function stageRows(job: MirrorJob): Html {
709710 const stages = stagesFor(job);
710711 const at = stages.findIndex((s) => s.name === job.stage);
711 return html`<ol class="stages">
712 return html`<ol class="list">
712713 ${stages.map((stage, i) => {
713714 const state =
714715 job.stage === "failed"
@@ -718,12 +719,12 @@ function stageRows(job: MirrorJob): Html {
718719 : i === at
719720 ? "now"
720721 : "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 });
727728 })}
728729 </ol>`;
729730 }
@@ -753,8 +754,11 @@ const migrateJobJs = /* js */ `
753754 var state = data.stage === 'failed' ? 'todo'
754755 : data.stage === 'done' || idx < at ? 'done' : idx === at ? 'now' : 'todo';
755756 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');
758762 }
759763 if (data.stage === 'done' || data.stage === 'failed') { source.close(); location.reload(); }
760764 }
src/web/style/content.ts −16
@@ -111,22 +111,6 @@ a.where-place:hover, button.where-place:hover {
111111 .live-note p { text-wrap: pretty; }
112112 .live-note strong { color: var(--fg); }
113113
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; }
130114 .origin-chip {
131115 display: inline-flex; align-items: center; gap: 6px;
132116 max-width: 100%; overflow: hidden; text-overflow: ellipsis; white-space: nowrap;
src/web/ui.ts +23
@@ -875,6 +875,29 @@ export function row(o: RowOptions): Html {
875875 </li>`;
876876 }
877877
878 /** The words and badge tones of a progress stage's three states. */
879 export const STAGE_WORD = { done: "Done", now: "Working", todo: "Waiting" } as const;
880 const STAGE_TONE = { done: "success", now: "attn", todo: "secondary" } as const;
881 const STAGE_GLYPH = { done: "●", now: "◐", todo: "○" } as const;
882
883 /** One progress stage as a row: glyph, label, the live detail, and a badge
884 * saying the state in a word. `client.ts` and the migrate page repaint it
885 * through the `data-stage-*` hooks. */
886 export function stageRow(o: {
887 name: string;
888 label: string;
889 state: keyof typeof STAGE_WORD;
890 detail: string;
891 }): Html {
892 return row({
893 title: o.label,
894 lead: html`<span data-stage-mark aria-hidden="true">${STAGE_GLYPH[o.state]}</span>`,
895 meta: html`<span data-stage-note>${o.detail === "" ? "\u00a0" : o.detail}</span>`,
896 trail: badge(STAGE_WORD[o.state], { tone: STAGE_TONE[o.state] }),
897 data: { "stage-name": o.name, state: o.state },
898 });
899 }
900
878901 // ---- navigation ----
879902
880903 export interface TabItem {
test/migrate.test.ts +6
@@ -1079,6 +1079,12 @@ describe("migrate", () => {
10791079 expect(page).toContain(`data-job="${job.id}"`);
10801080 expect(page).toContain("<noscript>");
10811081 expect(page).toContain("Reload");
1082 // Stages are §5 rows with a state badge; the old classes are gone.
1083 expect(page).not.toContain("stage-dot");
1084 expect(page).not.toContain("stage-detail");
1085 expect(page).toContain("data-stage-mark");
1086 expect(page).toContain('data-variant="secondary"');
1087 expect(page).toContain("Waiting");
10821088 const streamPath = `/api/v1/migrate/${job.id}/stream`;
10831089 // Another person's stream is not found, as their page is.
10841090 expect((await browser(bobCookie, streamPath)).status).toBe(404);
test/web-origins.test.ts +3
@@ -308,6 +308,9 @@ describe("origins on the web", () => {
308308 expect(running).toContain("Creating the repository");
309309 expect(running).toContain("Importing issues");
310310 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");
311314
312315 const jobId = jobPath.split("/").pop()!;
313316 const done = await settled(jobId);

↑↓ navigate ↵ open ⌘↵ its app esc close

Keyboard shortcuts

Docs