GeezerVison is showing github.com — fix(web): workflow skipped count follows the picked workflow (#43708) · Ryoku-dev/hyakki@61a31f6
File treeExpand file treeCollapse file tree Open diff view settings apps/web/src/components/workflows
Expand file treeCollapse file tree Open diff view settings Collapse file Copy file name to clipboardExpand all lines: apps/web/src/components/workflows/WorkflowRunsView.browser.test.tsx +37Lines changed: 37 additions & 0 deletions | Original file line number | Diff line number | Diff line change |
|---|
@@ -701,6 +701,43 @@ describe("WorkflowRunsView", () => { | 701 | 701 | await expect.element(runs).toMatchTextContent("Has not run yet."); | 702 | 702 | }); | 703 | 703 |
| | 704 | + it("counts the skipped runs of the workflow picked, not of every workflow", async () => { | | 705 | + setup({ | | 706 | + workflows: [ | | 707 | + { name: "release", version: 1, triggers: [] }, | | 708 | + { name: "report", version: 1, triggers: ["webhook pings"] }, | | 709 | + ], | | 710 | + runs: [ | | 711 | + run({ runId: "rel", title: "Release 1.3", status: "completed", endedAt: at(3) }), | | 712 | + run({ | | 713 | + runId: "s1", | | 714 | + workflow: "report", | | 715 | + title: "Ping 1", | | 716 | + status: "skipped", | | 717 | + endedAt: at(1), | | 718 | + }), | | 719 | + run({ | | 720 | + runId: "s2", | | 721 | + workflow: "report", | | 722 | + title: "Ping 2", | | 723 | + status: "skipped", | | 724 | + endedAt: at(2), | | 725 | + }), | | 726 | + ], | | 727 | + questions: [], | | 728 | + }); | | 729 | + await using _desktop = await desktop(); | | 730 | + await using screen = await render(page()); | | 731 | + | | 732 | + await screen.getByRole("button", { name: "All", exact: true }).click(); | | 733 | + await expect.element(screen.getByRole("button", { name: "Show 2 skipped" })).toBeVisible(); | | 734 | + await screen.getByRole("combobox", { name: "Workflow" }).click(); | | 735 | + await screen.getByRole("option", { name: "release" }).click(); | | 736 | + await expect | | 737 | + .element(screen.getByRole("navigation", { name: "Workflow runs" })) | | 738 | + .not.toMatchTextContent(/skipped/); | | 739 | + }); | | 740 | + | 704 | 741 | const KIND_KEY = "t3code:workflows:question-kind"; | 705 | 742 | const asked = (runId: string, kind?: string): WorkflowQuestion => ({ | 706 | 743 | ...question, | |
Collapse file Copy file name to clipboardExpand all lines: apps/web/src/components/workflows/WorkflowRunsView.tsx +7-2Lines changed: 7 additions & 2 deletions | Original file line number | Diff line number | Diff line change |
|---|
@@ -209,6 +209,11 @@ export function WorkflowRunsView({ | 209 | 209 | const lists = workflowRunLists(groups); | 210 | 210 | const all = allWorkflowRunNodes(groups); | 211 | 211 | const section = groups.workflows.find((candidate) => candidate.name === workflow) ?? null; | | 212 | + // With a workflow picked, the list holds only its runs, so count only its skipped ones. | | 213 | + const skipped = listedWorkflowRuns( | | 214 | + section === null ? snapshot.runs : snapshot.runs.filter((run) => run.workflow === section.name), | | 215 | + false, | | 216 | + ).skipped; | 212 | 217 | // A run that another invoked is not in the list itself; the one it is part of stands for it. | 213 | 218 | const listedFor = (node: WorkflowRunNode | null): string | null => { | 214 | 219 | if (node === null) return null; | @@ -407,12 +412,12 @@ export function WorkflowRunsView({ | 407 | 412 | ))} | 408 | 413 | </ul> | 409 | 414 | )} | 410 | | - {tab === "all" && visible.skipped > 0 && !openedSkipped ? ( | | 415 | + {tab === "all" && skipped > 0 && !openedSkipped ? ( | 411 | 416 | <div className="flex justify-center pt-2"> | 412 | 417 | <Button size="xs" variant="ghost" onClick={() => setShowSkipped(!showSkipped)}> | 413 | 418 | {showSkipped | 414 | 419 | ? gt("Hide skipped") | 415 | | - : gt("Show {count} skipped", { count: visible.skipped })} | | 420 | + : gt("Show {count} skipped", { count: skipped })} | 416 | 421 | </Button> | 417 | 422 | </div> | 418 | 423 | ) : null} | |
|