Public: anyone can read this; the crew can change it.
Calm pass: issues, the lists and runs show rows a reader can scan, not notes #10381
mason/forge:mason/10301-calm-pass-issues-the-lists-and-runs-show → main 4 commits fork
18 files
changed +117
−224
docs/design/attention-budget.json +30 −30
| @@ -13,97 +13,97 @@ | ||
| 13 | 13 | }, |
| 14 | 14 | "repository": { |
| 15 | 15 | "390": { |
| 16 | "words": 197, | |
| 17 | "blocks": 29, | |
| 16 | "words": 160, | |
| 17 | "blocks": 28, | |
| 18 | 18 | "colours": 2 |
| 19 | 19 | }, |
| 20 | 20 | "1280": { |
| 21 | "words": 197, | |
| 22 | "blocks": 29, | |
| 21 | "words": 160, | |
| 22 | "blocks": 28, | |
| 23 | 23 | "colours": 2 |
| 24 | 24 | } |
| 25 | 25 | }, |
| 26 | 26 | "app": { |
| 27 | 27 | "390": { |
| 28 | "words": 197, | |
| 29 | "blocks": 29, | |
| 28 | "words": 160, | |
| 29 | "blocks": 28, | |
| 30 | 30 | "colours": 2 |
| 31 | 31 | }, |
| 32 | 32 | "1280": { |
| 33 | "words": 197, | |
| 34 | "blocks": 29, | |
| 33 | "words": 160, | |
| 34 | "blocks": 28, | |
| 35 | 35 | "colours": 2 |
| 36 | 36 | } |
| 37 | 37 | }, |
| 38 | 38 | "pull": { |
| 39 | 39 | "390": { |
| 40 | "words": 133, | |
| 40 | "words": 122, | |
| 41 | 41 | "blocks": 22, |
| 42 | 42 | "colours": 4 |
| 43 | 43 | }, |
| 44 | 44 | "1280": { |
| 45 | "words": 133, | |
| 45 | "words": 122, | |
| 46 | 46 | "blocks": 22, |
| 47 | 47 | "colours": 4 |
| 48 | 48 | } |
| 49 | 49 | }, |
| 50 | 50 | "issue": { |
| 51 | 51 | "390": { |
| 52 | "words": 76, | |
| 53 | "blocks": 19, | |
| 52 | "words": 47, | |
| 53 | "blocks": 15, | |
| 54 | 54 | "colours": 2 |
| 55 | 55 | }, |
| 56 | 56 | "1280": { |
| 57 | "words": 76, | |
| 58 | "blocks": 19, | |
| 57 | "words": 47, | |
| 58 | "blocks": 15, | |
| 59 | 59 | "colours": 2 |
| 60 | 60 | } |
| 61 | 61 | }, |
| 62 | 62 | "issues list": { |
| 63 | 63 | "390": { |
| 64 | "words": 32, | |
| 65 | "blocks": 8, | |
| 64 | "words": 30, | |
| 65 | "blocks": 7, | |
| 66 | 66 | "colours": 2 |
| 67 | 67 | }, |
| 68 | 68 | "1280": { |
| 69 | "words": 32, | |
| 70 | "blocks": 8, | |
| 69 | "words": 30, | |
| 70 | "blocks": 7, | |
| 71 | 71 | "colours": 2 |
| 72 | 72 | } |
| 73 | 73 | }, |
| 74 | 74 | "pulls list": { |
| 75 | 75 | "390": { |
| 76 | "words": 31, | |
| 77 | "blocks": 7, | |
| 76 | "words": 24, | |
| 77 | "blocks": 6, | |
| 78 | 78 | "colours": 1 |
| 79 | 79 | }, |
| 80 | 80 | "1280": { |
| 81 | "words": 31, | |
| 82 | "blocks": 7, | |
| 81 | "words": 24, | |
| 82 | "blocks": 6, | |
| 83 | 83 | "colours": 1 |
| 84 | 84 | } |
| 85 | 85 | }, |
| 86 | 86 | "runs": { |
| 87 | 87 | "390": { |
| 88 | "words": 46, | |
| 89 | "blocks": 8, | |
| 88 | "words": 27, | |
| 89 | "blocks": 7, | |
| 90 | 90 | "colours": 1 |
| 91 | 91 | }, |
| 92 | 92 | "1280": { |
| 93 | "words": 46, | |
| 94 | "blocks": 8, | |
| 93 | "words": 27, | |
| 94 | "blocks": 7, | |
| 95 | 95 | "colours": 1 |
| 96 | 96 | } |
| 97 | 97 | }, |
| 98 | 98 | "run": { |
| 99 | 99 | "390": { |
| 100 | "words": 34, | |
| 101 | "blocks": 11, | |
| 100 | "words": 29, | |
| 101 | "blocks": 10, | |
| 102 | 102 | "colours": 3 |
| 103 | 103 | }, |
| 104 | 104 | "1280": { |
| 105 | "words": 34, | |
| 106 | "blocks": 11, | |
| 105 | "words": 29, | |
| 106 | "blocks": 10, | |
| 107 | 107 | "colours": 3 |
| 108 | 108 | } |
| 109 | 109 | }, |
docs/features/attention.md +8 −6
| @@ -19,15 +19,17 @@ reader sees on first view at 390 px and 1280 px: **words**, **text blocks** and | ||
| 19 | 19 | |
| 20 | 20 | ## Baseline (words / blocks / colours) |
| 21 | 21 | |
| 22 | The Calm pass (#10301) lowered the issue, pull, issues, pulls, runs and run rows. | |
| 23 | ||
| 22 | 24 | | Page | 390 px | 1280 px | |
| 23 | 25 | |---|---|---| |
| 24 | 26 | | home | 182 / 20 / 3 | 182 / 20 / 3 | |
| 25 | 27 | | repository | 189 / 28 / 2 | 189 / 28 / 2 | |
| 26 | 28 | | app | 189 / 28 / 2 | 189 / 28 / 2 | |
| 27 | | pull | 133 / 22 / 4 | 133 / 22 / 4 | | |
| 28 | | issue | 76 / 19 / 2 | 76 / 19 / 2 | | |
| 29 | | issues list | 32 / 8 / 2 | 32 / 8 / 2 | | |
| 30 | | pulls list | 31 / 7 / 1 | 31 / 7 / 1 | | |
| 31 | | runs | 46 / 8 / 1 | 46 / 8 / 1 | | |
| 32 | | run | 34 / 11 / 3 | 34 / 11 / 3 | | |
| 29 | | pull | 122 / 22 / 4 | 122 / 22 / 4 | | |
| 30 | | issue | 47 / 15 / 2 | 47 / 15 / 2 | | |
| 31 | | issues list | 31 / 7 / 2 | 31 / 7 / 2 | | |
| 32 | | pulls list | 25 / 6 / 1 | 25 / 6 / 1 | | |
| 33 | | runs | 27 / 7 / 1 | 27 / 7 / 1 | | |
| 34 | | run | 29 / 10 / 3 | 29 / 10 / 3 | | |
| 33 | 35 | | settings | 274 / 37 / 1 | 274 / 37 / 1 | |
src/web/client.ts −2
| @@ -394,14 +394,12 @@ export const studioRunJs = /* js */ ` | ||
| 394 | 394 | var runId = log.getAttribute('data-run'); |
| 395 | 395 | if (!runId) return; |
| 396 | 396 | var logUrl = log.getAttribute('data-log'); |
| 397 | var empty = document.getElementById('run-empty'); | |
| 398 | 397 | // Lines on the page: those the server drew from the file, then each added |
| 399 | 398 | // here. A catch-up read of the file adds only what is past that count, and |
| 400 | 399 | // frames wait for it, so a line is never drawn twice. |
| 401 | 400 | var have = parseInt(log.getAttribute('data-seen') || '-1', 10); |
| 402 | 401 | var catching = false; |
| 403 | 402 | function put(text) { |
| 404 | if (empty) empty.hidden = true; | |
| 405 | 403 | add(draw(text)); |
| 406 | 404 | have++; |
| 407 | 405 | if (/^(\\$ |test-shards: |\\(fail\\) |\u2500\u2500 shard )/.test(text)) stepsSoon(); |
src/web/pages/thread.ts +1 −3
| @@ -637,9 +637,7 @@ export function composer(ctx: Ctx, o: ComposerOptions): Html { | ||
| 637 | 637 | : null}${tell.page |
| 638 | 638 | ? html`From <code>${tell.page}</code>. ` |
| 639 | 639 | : null}Enter sends.` |
| 640 | : html`${icon("file")} Markdown is supported — | |
| 641 | <code>**bold**</code>, <code>[link](url)</code>, | |
| 642 | <code>> quote</code>.`}</span | |
| 640 | : null}</span | |
| 643 | 641 | > |
| 644 | 642 | <span class="spacer"></span> |
| 645 | 643 | ${reasons} ${closeButton} |
src/web/studio/app.ts +2 −10
| @@ -339,14 +339,7 @@ export async function studioApp( | ||
| 339 | 339 | placeholder="Tell the crew…" |
| 340 | 340 | /> |
| 341 | 341 | ${btn("Tell", { variant: "primary", type: "submit" })} |
| 342 | </form> | |
| 343 | ${builders.length === 0 | |
| 344 | ? html`<p class="muted small"> | |
| 345 | Nobody on the crew yet. | |
| 346 | <a href="${base}/settings#crew">Add a crew member under Settings → Crew</a>, | |
| 347 | then tell them what you want. | |
| 348 | </p>` | |
| 349 | : null}`; | |
| 342 | </form>`; | |
| 350 | 343 | |
| 351 | 344 | // ---- now: one row per thing, in the five words (studio/now.ts) ---- |
| 352 | 345 | const { card: now } = await timePhaseAsync(req, "now", () => |
| @@ -397,8 +390,7 @@ export async function studioApp( | ||
| 397 | 390 | const weekCard = card( |
| 398 | 391 | !hasHistory |
| 399 | 392 | ? html`<p class="muted small"> |
| 400 | Nothing to show yet — it fills in once a pull request | |
| 401 | ships${ownerFacts ? " or the crew takes a run" : ""}. | |
| 393 | Nothing yet. | |
| 402 | 394 | </p>` |
| 403 | 395 | : !ownerFacts |
| 404 | 396 | ? html`<dl> |
src/web/studio/lists.ts +29 −105
| @@ -20,11 +20,7 @@ import { | ||
| 20 | 20 | type Label, |
| 21 | 21 | } from "../../core/issues.ts"; |
| 22 | 22 | import { listPulls, openPullsClosing } from "../../core/pulls.ts"; |
| 23 | import { stepsOfStored, type PathStep } from "../../flow/path.ts"; | |
| 24 | import { canRead, canWrite, type Repo } from "../../core/repos.ts"; | |
| 25 | import { FLOW_LABEL } from "../../core/flow_label.ts"; | |
| 26 | import { flowButton } from "../flow_button.ts"; | |
| 27 | import { stepLink } from "./step_link.ts"; | |
| 23 | import { canRead, type Repo } from "../../core/repos.ts"; | |
| 28 | 24 | import { waitingCount } from "../../actions/reports.ts"; |
| 29 | 25 | |
| 30 | 26 | import { listRepoRuns } from "../../actions/runs.ts"; |
| @@ -41,7 +37,6 @@ import { | ||
| 41 | 37 | signInHref, |
| 42 | 38 | } from "../chrome.ts"; |
| 43 | 39 | import { html, when, type Html } from "../html.ts"; |
| 44 | import { noteLine } from "./note.ts"; | |
| 45 | 40 | import { page } from "../layout.ts"; |
| 46 | 41 | import { liveClientJs, liveMount } from "../live.ts"; |
| 47 | 42 | import { |
| @@ -53,17 +48,14 @@ import { | ||
| 53 | 48 | labelChip, |
| 54 | 49 | labelCss, |
| 55 | 50 | listCard, |
| 56 | originTag, | |
| 57 | 51 | pager, |
| 58 | 52 | row, |
| 59 | 53 | seg, |
| 60 | 54 | time, |
| 61 | 55 | } from "../ui.ts"; |
| 62 | 56 | import type { Run, RunState } from "../../core/runs.ts"; |
| 63 | import { actorsFor, durationText, issuesFor, runTitleFrom } from "../pages/runs.ts"; | |
| 64 | import { originGlyph } from "../pages/thread.ts"; | |
| 57 | import { actorsFor, issuesFor, runTitleFrom } from "../pages/runs.ts"; | |
| 65 | 58 | import { changeHref, PAGE_TITLES, pageTitle, tellHref } from "./nouns.ts"; |
| 66 | import { tellLine, tellsAnswered } from "./branch_tell.ts"; | |
| 67 | 59 | import { knowMergeClosings, tellWords } from "./tell.ts"; |
| 68 | 60 | import { |
| 69 | 61 | pullWords, |
| @@ -119,13 +111,9 @@ function inWordFilter(word: Word, filter: WordFilter | undefined): boolean { | ||
| 119 | 111 | } |
| 120 | 112 | |
| 121 | 113 | /** The empty card's one line. A filter that is set is named, so the way out |
| 122 | * is visible; none set is not the filter's fault, so it says what to do. */ | |
| 123 | function emptyNote( | |
| 124 | filter: WordFilter | undefined, | |
| 125 | subject: string, | |
| 126 | starter: string, | |
| 127 | ): string { | |
| 128 | if (filter === undefined) return starter; | |
| 114 | * is visible; none set says only that nothing is open. */ | |
| 115 | function emptyNote(filter: WordFilter | undefined, subject: string): string { | |
| 116 | if (filter === undefined) return "Nothing open."; | |
| 129 | 117 | if (filter === "told") return `${subject} is waiting to be picked up.`; |
| 130 | 118 | return `${subject} is ${filter} yet.`; |
| 131 | 119 | } |
| @@ -447,19 +435,11 @@ export async function tellsList(ctx: Ctx): Promise<Response> { | ||
| 447 | 435 | .map((issue, i) => ({ issue, info: words[i]! })) |
| 448 | 436 | .filter((r) => shown(r.info.word, f)); |
| 449 | 437 | |
| 450 | const mayLabel = canWrite(db, repo, ctx.auth.user); | |
| 451 | 438 | const list = |
| 452 | 439 | rows.length === 0 |
| 453 | 440 | ? empty({ |
| 454 | 441 | icon: "issue", |
| 455 | title: "Nothing here", | |
| 456 | note: emptyNote( | |
| 457 | f.word, | |
| 458 | "No issue", | |
| 459 | record === undefined | |
| 460 | ? "Nothing open." | |
| 461 | : "Nothing open. Tell the crew what you want and it shows up here.", | |
| 462 | ), | |
| 442 | title: emptyNote(f.word, "No issue"), | |
| 463 | 443 | }) |
| 464 | 444 | : listCard( |
| 465 | 445 | rows.map(({ issue, info }) => |
| @@ -469,21 +449,7 @@ export async function tellsList(ctx: Ctx): Promise<Response> { | ||
| 469 | 449 | lead: wordDot(info.word, info.note), |
| 470 | 450 | title: titled(issue.title, labels.get(issue.id)), |
| 471 | 451 | titleAttr: issue.title, |
| 472 | meta: html`${wordText(info.word)}${when( | |
| 473 | issue.originAuthor, | |
| 474 | (login) => html`${originTag(login, originGlyph(repo))} · `, | |
| 475 | )}${issue.assigneeName | |
| 476 | ? html`${issue.assigneeName} · ` | |
| 477 | : null}${time(issue.updatedAt)}`, | |
| 478 | ...(mayLabel && issue.state === "open" | |
| 479 | ? { | |
| 480 | after: flowButton( | |
| 481 | `${base}/issues/${issue.number}/flow`, | |
| 482 | (labels.get(issue.id) ?? []).some((l) => l.name.toLowerCase() === FLOW_LABEL), | |
| 483 | `${ctx.url.pathname}${ctx.url.search}`, | |
| 484 | ), | |
| 485 | } | |
| 486 | : {}), | |
| 452 | meta: html`${wordText(info.word)}${time(issue.updatedAt)}`, | |
| 487 | 453 | }), |
| 488 | 454 | ), |
| 489 | 455 | { extra: "bare" }, |
| @@ -575,11 +541,6 @@ export async function tellsList(ctx: Ctx): Promise<Response> { | ||
| 575 | 541 | return response; |
| 576 | 542 | } |
| 577 | 543 | |
| 578 | /** The pull's step beside its row, as a sibling of the row's link: `after`. */ | |
| 579 | function stepAfter(step: PathStep | null | undefined): { after?: Html } { | |
| 580 | return step == null ? {} : { after: stepLink(step) }; | |
| 581 | } | |
| 582 | ||
| 583 | 544 | /** |
| 584 | 545 | * A pull's title and branch are the writer's words, so inside `[data-pulls]` |
| 585 | 546 | * a row wraps them (a long word breaks anywhere) in place of the list's |
| @@ -620,8 +581,6 @@ export async function changesList(ctx: Ctx): Promise<Response> { | ||
| 620 | 581 | lap("pulls"); |
| 621 | 582 | const words = await pullWords(wordCtx, fetched); |
| 622 | 583 | lap("words"); |
| 623 | const answered = tellsAnswered(db, repo.id, fetched); | |
| 624 | lap("tells"); | |
| 625 | 584 | const labels = labelsForIssues(db, fetched.map((pull) => pull.id)); |
| 626 | 585 | const repoLabels = listLabels(db, repo.id); |
| 627 | 586 | lap("labels"); |
| @@ -629,21 +588,12 @@ export async function changesList(ctx: Ctx): Promise<Response> { | ||
| 629 | 588 | .map((pull, i) => ({ pull, info: words[i]! })) |
| 630 | 589 | // An open pull is always listed, whatever its word: the tab counts them all. |
| 631 | 590 | .filter((r) => f.word === undefined || shown(r.info.word, f)); |
| 632 | const steps = stepsOfStored(db, repo, rows.map((r) => r.pull)); | |
| 633 | lap("steps"); | |
| 634 | 591 | |
| 635 | 592 | const list = |
| 636 | 593 | rows.length === 0 |
| 637 | 594 | ? empty({ |
| 638 | 595 | icon: "pull", |
| 639 | title: "Nothing here", | |
| 640 | note: emptyNote( | |
| 641 | f.word, | |
| 642 | "No pull request", | |
| 643 | record === undefined | |
| 644 | ? "Nothing open." | |
| 645 | : "Nothing open. A pull request is the crew's proposed edit to your app; the crew opens them as it works.", | |
| 646 | ), | |
| 596 | title: emptyNote(f.word, "No pull request"), | |
| 647 | 597 | }) |
| 648 | 598 | : listCard( |
| 649 | 599 | rows.map(({ pull, info }) => |
| @@ -653,11 +603,7 @@ export async function changesList(ctx: Ctx): Promise<Response> { | ||
| 653 | 603 | lead: wordDot(info.word, info.note), |
| 654 | 604 | title: titled(pull.title, labels.get(pull.id)), |
| 655 | 605 | titleAttr: pull.title, |
| 656 | meta: html`${wordText(info.word)}${pull.originAuthor | |
| 657 | ? originTag(pull.originAuthor, originGlyph(repo)) | |
| 658 | : pull.authorName} · | |
| 659 | ${when(answered.get(pull.number), (t) => html`${tellLine(base, t)} · `)}${time(pull.updatedAt)}`, | |
| 660 | ...stepAfter(steps.get(pull.id)), | |
| 606 | meta: html`${wordText(info.word)}${time(pull.updatedAt)}`, | |
| 661 | 607 | }), |
| 662 | 608 | ), |
| 663 | 609 | ); |
| @@ -782,14 +728,6 @@ export function onRunsList( | ||
| 782 | 728 | return inWordFilter(word, filter); |
| 783 | 729 | } |
| 784 | 730 | |
| 785 | /** A check's state in the words its row names it by. */ | |
| 786 | const checkState = (run: Run): string => | |
| 787 | run.state === "ok" | |
| 788 | ? "passed" | |
| 789 | : run.state === "queued" | |
| 790 | ? whatRunWaitsOn(run) | |
| 791 | : run.state; | |
| 792 | ||
| 793 | 731 | const RUNS_KIND_WORDS: Record<RunsKind, string> = { |
| 794 | 732 | agent: "Agent runs", |
| 795 | 733 | deploy: "Deploys", |
| @@ -851,14 +789,7 @@ export async function runsListPage(ctx: Ctx, repo: Repo): Promise<Response> { | ||
| 851 | 789 | rows.length === 0 |
| 852 | 790 | ? empty({ |
| 853 | 791 | icon: "bot", |
| 854 | title: "Nothing here", | |
| 855 | note: emptyNote( | |
| 856 | filter, | |
| 857 | "No run", | |
| 858 | kind === undefined || kind === "agent" | |
| 859 | ? "Nothing open. A run is one go the crew takes at a job; each one shows up here." | |
| 860 | : `Nothing open. Every ${kind === "deploy" ? "deploy" : "check"} shows up here while it runs.`, | |
| 861 | ), | |
| 792 | title: emptyNote(filter, "No run"), | |
| 862 | 793 | }) |
| 863 | 794 | : listCard( |
| 864 | 795 | rows.map(({ run, info }) => { |
| @@ -874,13 +805,9 @@ export async function runsListPage(ctx: Ctx, repo: Repo): Promise<Response> { | ||
| 874 | 805 | ? avatar(who) |
| 875 | 806 | : icon(run.kind === "check" ? "check" : "rocket"), |
| 876 | 807 | title: runTitleFrom(run, actors, issues), |
| 877 | meta: | |
| 878 | run.kind === "check" | |
| 879 | ? html`${run.commitOid.slice(0, 7)} · ${checkState(run)} | |
| 880 | ${when(durationText(run), (d) => html` · took ${d}`)} · | |
| 881 | ${time(run.finishedAt ?? run.createdAt)}` | |
| 882 | : html`${run.kind === "agent" ? html`${who} · ` : null}${run.state === "queued" ? whatRunWaitsOn(run) : noteLine(info.note)} | |
| 883 | · ${time(run.finishedAt ?? run.createdAt)}`, | |
| 808 | // What a queued run waits on opens on hover, not in the row. | |
| 809 | ...(run.state === "queued" ? { titleAttr: whatRunWaitsOn(run) } : {}), | |
| 810 | meta: time(run.finishedAt ?? run.createdAt), | |
| 884 | 811 | trail: wordBadge(info.word), |
| 885 | 812 | }); |
| 886 | 813 | }), |
| @@ -899,13 +826,6 @@ export async function runsListPage(ctx: Ctx, repo: Repo): Promise<Response> { | ||
| 899 | 826 | })), |
| 900 | 827 | )} |
| 901 | 828 | </nav> |
| 902 | ${wordFilterBar( | |
| 903 | (word) => runsHref(base, kind, word, undefined, state), | |
| 904 | filter, | |
| 905 | filter === undefined, | |
| 906 | undefined, | |
| 907 | PULL_FILTERS, | |
| 908 | )} | |
| 909 | 829 | ${list} |
| 910 | 830 | ${pager( |
| 911 | 831 | fetched.length === LIST_PAGE && last !== undefined |
| @@ -913,18 +833,22 @@ export async function runsListPage(ctx: Ctx, repo: Repo): Promise<Response> { | ||
| 913 | 833 | : {}, |
| 914 | 834 | )} |
| 915 | 835 | </div> |
| 916 | <p class="muted small mt"> | |
| 917 | Show ${(["agent", "deploy", "check"] as const).map( | |
| 918 | (k, i) => | |
| 919 | html`${i > 0 ? " · " : ""}${k === kind | |
| 920 | ? html`<strong>${RUNS_KIND_WORDS[k]}</strong>` | |
| 921 | : html`<a href="${runsHref(base, k, undefined)}" | |
| 922 | >${RUNS_KIND_WORDS[k]}</a | |
| 923 | >`}`, | |
| 924 | )}${kind === undefined | |
| 925 | ? null | |
| 926 | : html` · <a href="${runsHref(base, undefined, undefined)}">All</a>`} | |
| 927 | </p> | |
| 836 | ${disclosure( | |
| 837 | "Kind", | |
| 838 | html`<p class="small"> | |
| 839 | ${(["agent", "deploy", "check"] as const).map( | |
| 840 | (k, i) => | |
| 841 | html`${i > 0 ? " · " : ""}${k === kind | |
| 842 | ? html`<strong>${RUNS_KIND_WORDS[k]}</strong>` | |
| 843 | : html`<a href="${runsHref(base, k, undefined)}" | |
| 844 | >${RUNS_KIND_WORDS[k]}</a | |
| 845 | >`}`, | |
| 846 | )}${kind === undefined | |
| 847 | ? null | |
| 848 | : html` · <a href="${runsHref(base, undefined, undefined)}">All</a>`} | |
| 849 | </p>`, | |
| 850 | { small: true, extra: "mt" }, | |
| 851 | )} | |
| 928 | 852 | ${liveMount({ repo: base })}`; |
| 929 | 853 | |
| 930 | 854 | const res = page({ |
src/web/studio/run.ts −7
| @@ -269,13 +269,6 @@ export async function runView( | ||
| 269 | 269 | Showing the last 512 KB of the log; the file on disk has the rest. |
| 270 | 270 | </p>`, |
| 271 | 271 | )} |
| 272 | ${when( | |
| 273 | lines.length === 0 && !logHidden, | |
| 274 | () => | |
| 275 | html`<p class="muted small" id="run-empty"> | |
| 276 | Nothing has been logged yet. | |
| 277 | </p>`, | |
| 278 | )} | |
| 279 | 272 | ${when( |
| 280 | 273 | // Progress is read from the log, so a reader the log is hidden from |
| 281 | 274 | // gets no rows either. |
src/web/studio/tell.ts +14 −8
| @@ -18,7 +18,7 @@ import { alreadyDone } from "../../core/done_on_main.ts"; | ||
| 18 | 18 | import { appsRuntime } from "../../apps/runtime.ts"; |
| 19 | 19 | import { getAppByRepo } from "../../core/apps.ts"; |
| 20 | 20 | import { LATER_TITLED } from "../../core/pillars.ts"; |
| 21 | import { deferredOf, linkedIssueIds } from "../../core/dependencies.ts"; | |
| 21 | import { deferredOf, dependenciesOf, linkedIssueIds } from "../../core/dependencies.ts"; | |
| 22 | 22 | import { hasPicture } from "../../core/note_pictures.ts"; |
| 23 | 23 | import { heldBanner } from "../pages/gate.ts"; |
| 24 | 24 | import { |
| @@ -503,8 +503,9 @@ async function studioTell( | ||
| 503 | 503 | ordinary tell</span |
| 504 | 504 | >` |
| 505 | 505 | : wordInfo |
| 506 | ? html`${wordBadge(wordInfo.word)} | |
| 507 | <span class="muted small">${wordInfo.note}</span>` | |
| 506 | ? html`${wordBadge(wordInfo.word)}${wordInfo.note.startsWith("deferred") | |
| 507 | ? html` <span class="muted small">${wordInfo.note}</span>` | |
| 508 | : null}` | |
| 508 | 509 | : stateBadge(issue.state)} |
| 509 | 510 | <span |
| 510 | 511 | >${issue.originAuthor |
| @@ -540,9 +541,7 @@ async function studioTell( | ||
| 540 | 541 | })} |
| 541 | 542 | has it</span |
| 542 | 543 | >` |
| 543 | : !direction && wordInfo?.word === "told" | |
| 544 | ? html`<span class="muted">nobody has it yet</span>` | |
| 545 | : null} | |
| 544 | : null} | |
| 546 | 545 | </div> |
| 547 | 546 | </div>`; |
| 548 | 547 | |
| @@ -558,6 +557,12 @@ async function studioTell( | ||
| 558 | 557 | const dependencies = links(() => |
| 559 | 558 | dependenciesCard(ctx, repo, issue, `${thread}/dependencies`), |
| 560 | 559 | ); |
| 560 | // What it waits for stays in view when there is something; with nothing to | |
| 561 | // wait for, the form to add a link sits in Details. | |
| 562 | const linked = links(() => { | |
| 563 | const d = dependenciesOf(db, issue.id); | |
| 564 | return d.blockedBy.length + d.blocks.length > 0; | |
| 565 | }); | |
| 561 | 566 | const teams = links(() => issueTeamsCard(ctx, repo, issue, `${thread}/teams`)); |
| 562 | 567 | const applied = labelsFor(db, issue.id); |
| 563 | 568 | const allLabels = listLabels(db, repo.id); |
| @@ -567,7 +572,8 @@ async function studioTell( | ||
| 567 | 572 | // form for whoever may change it. |
| 568 | 573 | const details = disclosure( |
| 569 | 574 | "Details", |
| 570 | html`${assigneeCard(ctx, repo, issue, `${thread}/assignee`)} | |
| 575 | html`${linked ? null : dependencies} | |
| 576 | ${assigneeCard(ctx, repo, issue, `${thread}/assignee`)} | |
| 571 | 577 | ${labelsCard(ctx, repo, issue, applied, allLabels, `${thread}/labels`)} |
| 572 | 578 | ${teams} |
| 573 | 579 | ${sealCard(ctx, repo, issue, `${thread}/seal`)}`, |
| @@ -608,7 +614,7 @@ async function studioTell( | ||
| 608 | 614 | : null} |
| 609 | 615 | ${runsCard} |
| 610 | 616 | ${closingCard} |
| 611 | ${dependencies} | |
| 617 | ${linked ? dependencies : null} | |
| 612 | 618 | ${details} |
| 613 | 619 | </aside> |
| 614 | 620 | </div> |
test/flow-first.test.ts +2 −2
| @@ -104,12 +104,12 @@ describe("the flow label goes first", () => { | ||
| 104 | 104 | expect(page).not.toContain("queued: flow only"); |
| 105 | 105 | }); |
| 106 | 106 | |
| 107 | test("the issue page and the list carry one button; posting it labels, and a reader cannot", async () => { | |
| 107 | test("the issue page carries one button; posting it labels, and a reader cannot", async () => { | |
| 108 | 108 | const target = open("click me"); |
| 109 | 109 | const rw = createToken(app.db, alice.id, "rw", "rw").token; |
| 110 | 110 | const cookie = { authorization: `Bearer ${rw}` }; |
| 111 | 111 | const list = await (await fetch(`${servers.url}/alice/svc/issues`, { headers: cookie })).text(); |
| 112 | expect(list).toContain(`action="/alice/svc/issues/${target.number}/flow"`); | |
| 112 | expect(list).not.toContain(`action="/alice/svc/issues/${target.number}/flow"`); // a row is a title, a word and a time | |
| 113 | 113 | const page = await (await fetch(`${servers.url}/alice/svc/issues/${target.number}`, { headers: cookie })).text(); |
| 114 | 114 | expect(page).toContain(`/alice/svc/issues/${target.number}/flow`); |
| 115 | 115 | expect(page).toContain("Flow first"); |
test/pull-step-surfaces.test.ts +6 −4
| @@ -93,8 +93,10 @@ test("the feed's post for a pull says its step, linked to /pipeline", async () = | ||
| 93 | 93 | expect(await get("/feed")).toContain(expected()); |
| 94 | 94 | }); |
| 95 | 95 | |
| 96 | test("the repository's pulls list says each pull's step", async () => { | |
| 97 | expect(await get("/alice/site/pulls")).toContain(expected()); | |
| 96 | test("the repository's pulls list stays a title, a word and a time: the step lives on the pull and the feed", async () => { | |
| 97 | const list = await get("/alice/site/pulls"); | |
| 98 | expect(list).toContain(`/alice/site/pulls/${pull.number}`); | |
| 99 | expect(list).not.toContain('data-step="review"'); | |
| 98 | 100 | }); |
| 99 | 101 | |
| 100 | 102 | const openMore = async (r: Repo, by: User, name: string): Promise<Pull> => { |
| @@ -109,12 +111,12 @@ const openMore = async (r: Repo, by: User, name: string): Promise<Pull> => { | ||
| 109 | 111 | return opened.value; |
| 110 | 112 | }; |
| 111 | 113 | |
| 112 | test("a long list says every pull's step and stays quick", async () => { | |
| 114 | test("a long list stays quick", async () => { | |
| 113 | 115 | for (let i = 0; i < 24; i++) await openMore(repo, alice, `long${i}`); |
| 114 | 116 | const started = performance.now(); |
| 115 | 117 | const html = await get("/alice/site/pulls"); |
| 116 | 118 | const took = performance.now() - started; |
| 117 | expect(html.match(/data-step="review"/g)?.length).toBeGreaterThanOrEqual(25); | |
| 119 | expect(html.match(/pulls\/\d+"/g)?.length).toBeGreaterThanOrEqual(25); | |
| 118 | 120 | expect(took).toBeLessThan(500); |
| 119 | 121 | }); |
| 120 | 122 |
test/pulls-list-timing.test.ts +2 −2
| @@ -38,10 +38,10 @@ function names(res: Response): string[] { | ||
| 38 | 38 | return requestTiming(res).split(", ").map((p) => p.split(";")[0]!); |
| 39 | 39 | } |
| 40 | 40 | |
| 41 | test("a repository's pulls list names session, repo, pulls, words, tells, labels, steps and render in order", async () => { | |
| 41 | test("a repository's pulls list names session, repo, pulls, words, labels and render in order", async () => { | |
| 42 | 42 | const res = await fetch(`${servers.url}/alice/notes/pulls`, { headers: { authorization: `Bearer ${bearer}` } }); |
| 43 | 43 | expect(res.status).toBe(200); |
| 44 | 44 | await res.text(); |
| 45 | 45 | expect(res.headers.get("x-content-type-options")).toBe("nosniff"); |
| 46 | expect(names(res)).toEqual(["app", "session", "repo", "pulls", "words", "tells", "labels", "steps", "render"]); | |
| 46 | expect(names(res)).toEqual(["app", "session", "repo", "pulls", "words", "labels", "render"]); | |
| 47 | 47 | }); |
test/pulls-page-open.test.ts +1 −1
| @@ -71,5 +71,5 @@ test("a pull stopped on a failed check is listed, and rows equal the open count" | ||
| 71 | 71 | const rows = (text.match(/href="\/alice\/lib\/pulls\/\d+" class="row"/g) ?? []).length; |
| 72 | 72 | expect(rows).toBe(open); |
| 73 | 73 | const stoppedRow = text.slice(text.indexOf("Stopped one"), text.indexOf("</li>", text.indexOf("Stopped one"))); |
| 74 | expect(stoppedRow).toContain("Its check is red."); | |
| 74 | expect(stoppedRow).toContain(`data-word="stopped"`); | |
| 75 | 75 | }); |
test/runs-working-tab.test.ts +5 −5
| @@ -89,14 +89,14 @@ test("Working counts what the flow report counts as active, and nothing finished | ||
| 89 | 89 | expect(body).not.toContain("waiting for"); |
| 90 | 90 | }); |
| 91 | 91 | |
| 92 | test("a queued run says what it waits on", async () => { | |
| 92 | test("a queued run says what it waits on, in its row's title", async () => { | |
| 93 | 93 | const body = await page(""); |
| 94 | expect(body).toContain("waiting for a builder"); | |
| 95 | expect(body).toContain("waiting for a check slot"); | |
| 94 | expect(body).toContain('title="waiting for a builder"'); | |
| 95 | expect(body).toContain('title="waiting for a check slot"'); | |
| 96 | 96 | }); |
| 97 | 97 | |
| 98 | 98 | test("a paused run and a queued deploy say what they wait on", async () => { |
| 99 | 99 | const body = await page("?state=queued"); |
| 100 | expect(body).toContain("paused on a limit, resumes soon"); | |
| 101 | expect(body).toContain("waiting for the deploy lane"); | |
| 100 | expect(body).toContain('title="paused on a limit, resumes soon"'); | |
| 101 | expect(body).toContain('title="waiting for the deploy lane"'); | |
| 102 | 102 | }); |
test/studio-changes.test.ts +5 −9
| @@ -316,7 +316,6 @@ describe("the studio, continued", () => { | ||
| 316 | 316 | expect(page).toContain('href="/alice/notes/runs?kind=check"'); |
| 317 | 317 | const deploys = await (await get("/alice/notes/runs?kind=deploy")).text(); |
| 318 | 318 | expect(deploys).not.toContain(`href="/alice/notes/runs/${run.id}"`); |
| 319 | expect(deploys).toContain('href="/alice/notes/runs?kind=deploy&word=stopped"'); | |
| 320 | 319 | }); |
| 321 | 320 | |
| 322 | 321 | test("the runs list shows agent runs, checks and deploys together, and each kind link narrows it", async () => { |
| @@ -340,8 +339,7 @@ describe("the studio, continued", () => { | ||
| 340 | 339 | const all = await (await get("/alice/notes/runs")).text(); |
| 341 | 340 | for (const link of [agent, check, deploy]) expect(all).toContain(link); |
| 342 | 341 | expect(all).toContain("Check of abcdef1"); |
| 343 | expect(all).toContain("abcdef1 · passed"); | |
| 344 | expect(all).toContain("took "); | |
| 342 | expect(all).toContain('data-word="'); | |
| 345 | 343 | |
| 346 | 344 | const only = async (kind: string) => |
| 347 | 345 | (await get(`/alice/notes/runs?kind=${kind}`)).text(); |
| @@ -398,7 +396,7 @@ describe("the studio, continued", () => { | ||
| 398 | 396 | } |
| 399 | 397 | |
| 400 | 398 | const runs = await (await get("/alice/plainlists/runs")).text(); |
| 401 | expect(runs).toContain(`href="/alice/plainlists/runs?word=working"`); | |
| 399 | expect(runs).toContain(`href="/alice/plainlists/runs?state=running"`); | |
| 402 | 400 | expect(runs).not.toContain("See dev's list"); |
| 403 | 401 | }); |
| 404 | 402 | |
| @@ -683,8 +681,6 @@ describe("the studio, continued", () => { | ||
| 683 | 681 | const tellHtml = await viaTell.text(); |
| 684 | 682 | expect(tellHtml).toContain("Door test: one tell"); |
| 685 | 683 | expect(tellHtml).toContain('data-word="told"'); |
| 686 | // Still waiting, nobody assigned: the one case the line is true (#214). | |
| 687 | expect(tellHtml).toContain("nobody has it yet"); | |
| 688 | 684 | // The reply, the close and every Details form post to /issues/:number. |
| 689 | 685 | expect(tellHtml).toContain(`action="/alice/notes/issues/${n}/comments"`); |
| 690 | 686 | expect(tellHtml).toContain(`action="/alice/notes/issues/${n}/assignee"`); |
| @@ -1319,14 +1315,14 @@ describe("the studio, continued", () => { | ||
| 1319 | 1315 | const at = list.indexOf(title); |
| 1320 | 1316 | return list.slice(at, list.indexOf("</a>", at + 400) + 4); |
| 1321 | 1317 | }; |
| 1322 | expect(rowOf("Answers the tell")).toContain(`href="/alice/notes/issues/${n}"`); | |
| 1323 | expect(rowOf("Answers the tell")).not.toContain("already done"); | |
| 1318 | // A row is a title, a word and a time: the tell it answers is on the pull. | |
| 1319 | expect(rowOf("Answers the tell")).not.toContain(`href="/alice/notes/issues/${n}"`); | |
| 1324 | 1320 | expect(rowOf("Answers nothing")).not.toContain("for issue"); |
| 1325 | 1321 | expect(rowOf("A person's branch")).not.toContain("for issue"); |
| 1326 | 1322 | |
| 1327 | 1323 | setIssueState(app, alice, repo, told.value, "closed"); |
| 1328 | 1324 | const closedList = await (await get("/alice/notes/pulls")).text(); |
| 1329 | expect(closedList).toContain("its issue is already done"); | |
| 1325 | expect(closedList).not.toContain("its issue is already done"); | |
| 1330 | 1326 | const page = await ( |
| 1331 | 1327 | await get(`/alice/notes/pulls/${answering.number}`) |
| 1332 | 1328 | ).text(); |
test/studio-search.test.ts +3 −8
| @@ -1244,16 +1244,11 @@ describe("the studio's empty lists", () => { | ||
| 1244 | 1244 | await rm(dataDir, { recursive: true, force: true }); |
| 1245 | 1245 | }); |
| 1246 | 1246 | |
| 1247 | test("a repository with nothing in it says what to do, and blames no filter", async () => { | |
| 1247 | test("a repository with nothing in it says one line, and blames no filter", async () => { | |
| 1248 | 1248 | await setup("blank"); |
| 1249 | for (const [path, words] of [ | |
| 1250 | ["issues", "Tell the crew what you want"], | |
| 1251 | ["pulls", "A pull request is the crew"], | |
| 1252 | ["runs", "A run is one go"], | |
| 1253 | ] as const) { | |
| 1249 | for (const path of ["issues", "pulls", "runs"] as const) { | |
| 1254 | 1250 | const page = await get(`/alice/blank/${path}`); |
| 1255 | expect(page).toContain("Nothing here"); | |
| 1256 | expect(page).toContain(words); | |
| 1251 | expect(page).toContain("Nothing open."); | |
| 1257 | 1252 | expect(page).not.toContain("this filter"); |
| 1258 | 1253 | } |
| 1259 | 1254 | }); |
test/studio.test.ts +8 −20
| @@ -630,31 +630,19 @@ describe("the studio", () => { | ||
| 630 | 630 | ).join("\n"); |
| 631 | 631 | expect(report.length).toBeGreaterThan(600); |
| 632 | 632 | finishRun(app.db, run.id, { state: "failed", summary: report }); |
| 633 | // The run table keeps the first 500 characters; the row carries all of those. | |
| 634 | const flat = report.slice(0, 500).replace(/\s+/g, " ").trim(); | |
| 635 | ||
| 636 | 633 | const page = await (await get("/alice/notes/runs?state=failed")).text(); |
| 637 | 634 | const at = page.indexOf(`href="/alice/notes/runs/${run.id}"`); |
| 638 | 635 | expect(at).toBeGreaterThan(-1); |
| 639 | 636 | const mine = page.slice(at, page.indexOf("</li>", at)); |
| 640 | // One line: the note is its own clamped span, no newline survives in it. | |
| 641 | const span = /<span class="row-note" title="([^"]*)">([^<]*)<\/span>/.exec(mine); | |
| 642 | expect(span).not.toBeNull(); | |
| 643 | const unescape = (s: string) => | |
| 644 | s.replace(/</g, "<").replace(/>/g, ">").replace(/&/g, "&"); | |
| 645 | expect(unescape(span![1]!)).toBe(flat); | |
| 646 | expect(unescape(span![2]!)).toBe(flat); | |
| 637 | // A row is a title, a word and a time: the summary opens on the run's own page. | |
| 638 | expect(mine).not.toContain("line 0"); | |
| 639 | expect(mine).toContain("<time"); | |
| 640 | const shown = await (await get(`/alice/notes/runs/${run.id}`)).text(); | |
| 647 | 641 | // Text, not source: markdown characters literal, markup escaped. |
| 648 | expect(mine).toContain("**bold**"); | |
| 649 | expect(mine).toContain("`main`"); | |
| 650 | expect(mine).toContain("<b>tag</b>"); | |
| 651 | expect(mine).not.toContain("<b>tag</b>"); | |
| 652 | expect(mine).not.toContain("<strong>"); | |
| 653 | expect(mine).not.toContain('href="http://x.test"'); | |
| 654 | // The when comes after the note, outside its clamp. | |
| 655 | expect(mine.slice(mine.indexOf("</span>", mine.indexOf("row-note")))).toContain("<time"); | |
| 656 | const css = await (await fetch(`${base}${stylesheetAsset().path}`)).text(); | |
| 657 | expect(css).toMatch(/\.row-note \{[^}]*text-overflow: ellipsis[^}]*white-space: nowrap/); | |
| 642 | expect(shown).toContain("**bold**"); | |
| 643 | expect(shown).toContain("<b>tag</b>"); | |
| 644 | expect(shown).not.toContain("<b>tag</b>"); | |
| 645 | expect(shown).not.toContain('href="http://x.test"'); | |
| 658 | 646 | }); |
| 659 | 647 | |
| 660 | 648 | test("a change that no longer merges into its base says so, and offers no Ship — a mergeable green pull is unchanged", async () => { |
test/web-origins.test.ts −1
| @@ -545,7 +545,6 @@ describe("origins on the web", () => { | ||
| 545 | 545 | test("an imported issue shows the origin's author, not the local one", async () => { |
| 546 | 546 | const html = await (await asUser(alice, "/alice/widgets/issues")).text(); |
| 547 | 547 | expect(html).toContain("The gear slips"); |
| 548 | expect(html).toContain("mona"); | |
| 549 | 548 | const page = await (await asUser(alice, "/alice/widgets/issues/7")).text(); |
| 550 | 549 | expect(page).toContain("mona"); |
| 551 | 550 | expect(page).toContain("view on origin"); |
test/web-ui.test.ts +1 −1
| @@ -743,7 +743,7 @@ describe("web ui", () => { | ||
| 743 | 743 | await fetch(`${base}/mel/proj/issues?q=nothing-matches-this&state=all`) |
| 744 | 744 | ).text(); |
| 745 | 745 | expect(miss).not.toContain("needs a label"); |
| 746 | expect(miss).toContain("Nothing here"); | |
| 746 | expect(miss).toContain("Nothing open."); | |
| 747 | 747 | expect(miss).toContain("nothing-matches-this in the title ✕"); |
| 748 | 748 | |
| 749 | 749 | // A LIKE wildcard typed into the box is a literal character, not a glob. |
new above
offline