From 64f91fa41d3af6c4ce57ee0391c437547140c801 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?R=C5=ABdolfs=20O=C5=A1i=C5=86=C5=A1?= Date: Fri, 17 Apr 2026 08:38:30 +0200 Subject: [PATCH] Show job cobs on repo source and patches --- http-client/index.ts | 2 + http-client/lib/repo.ts | 38 +++++ src/components/HoverPopover.svelte | 9 +- src/components/JobCob.svelte | 143 ++++++++++++++++++ src/views/repos/Cob/CobCommitTeaser.svelte | 17 ++- src/views/repos/Cob/Revision.svelte | 16 +- src/views/repos/Commit.svelte | 8 + .../repos/Commit/CommitAuthorship.svelte | 2 + src/views/repos/Source/Header.svelte | 51 +++++-- 9 files changed, 265 insertions(+), 21 deletions(-) create mode 100644 src/components/JobCob.svelte diff --git a/http-client/index.ts b/http-client/index.ts index bf7802b07..272fb752a 100644 --- a/http-client/index.ts +++ b/http-client/index.ts @@ -2,6 +2,7 @@ import type { BaseUrl } from "./lib/fetcher.js"; import type { Blob, DiffResponse, + Job, Remote, Repo, RepoListQuery, @@ -71,6 +72,7 @@ export type { HunkLine, Issue, IssueState, + Job, LifecycleState, Merge, Patch, diff --git a/http-client/lib/repo.ts b/http-client/lib/repo.ts index c5a31219c..ffe989f6e 100644 --- a/http-client/lib/repo.ts +++ b/http-client/lib/repo.ts @@ -125,6 +125,29 @@ const diffResponseSchema = object({ files: record(string(), diffBlobSchema), }); +const statusSchema = union([ + literal("started"), + literal("failed"), + literal("succeeded"), +]); + +const runSchema = object({ + runId: string(), + node: authorSchema, + status: statusSchema, + log: string(), +}); + +const jobSchema = object({ + jobId: string(), + commit: string(), + runs: array(runSchema), +}); + +export type Job = z.infer; + +const jobsSchema = array(jobSchema) satisfies ZodSchema; + export type RepoListQuery = { page?: number; perPage?: number; @@ -340,6 +363,21 @@ export class Client { ); } + public async getJobsByCommit( + rid: string, + commit: string, + options?: RequestOptions, + ): Promise { + return this.#fetcher.fetchOk( + { + method: "GET", + path: `repos/${rid}/xyz.radworks.job/${commit}`, + options, + }, + jobsSchema, + ); + } + public async getIssueById( rid: string, issueId: string, diff --git a/src/components/HoverPopover.svelte b/src/components/HoverPopover.svelte index 28097ed59..69f1680ee 100644 --- a/src/components/HoverPopover.svelte +++ b/src/components/HoverPopover.svelte @@ -3,6 +3,8 @@ export let stylePopoverPositionBottom: string | undefined = undefined; export let stylePopoverPositionLeft: string | undefined = undefined; + export let stylePopoverPositionTop: string | undefined = undefined; + export let canMouseOver: boolean = false; let visible: boolean = false; @@ -37,10 +39,15 @@ {#if visible}
+
+ canMouseOver ? setVisible(true) : setVisible(false)} + on:mouseleave={() => (canMouseOver ? setVisible(false) : undefined)} style:left={stylePopoverPositionLeft} - style:bottom={stylePopoverPositionBottom}> + style:bottom={stylePopoverPositionBottom} + style:top={stylePopoverPositionTop}>
diff --git a/src/components/JobCob.svelte b/src/components/JobCob.svelte new file mode 100644 index 000000000..5aa060f8c --- /dev/null +++ b/src/components/JobCob.svelte @@ -0,0 +1,143 @@ + + + + + + +{#await jobsPromise} +
+ +
+{:then jobs} + {@const jobStatus = computeStatus(jobs)} + {#if jobStatus} + +
+ {#if jobStatus === "succeeded"} + + All passed + + {:else if jobStatus === "failed"} + + All failed + + {:else} + + Mixed + + {/if} +
+ +
+ {#each jobs as job (job.jobId)} + {#each job.runs as run (run.runId)} + {#if run.status === "started"} + + Started + + {:else if run.status === "failed"} + + Failed + + {:else if run.status === "succeeded"} + + Passed + + {/if} + + logs + {/each} + {/each} +
+
+ {/if} +{:catch} + +{/await} diff --git a/src/views/repos/Cob/CobCommitTeaser.svelte b/src/views/repos/Cob/CobCommitTeaser.svelte index 55086ecc2..e366721c3 100644 --- a/src/views/repos/Cob/CobCommitTeaser.svelte +++ b/src/views/repos/Cob/CobCommitTeaser.svelte @@ -1,5 +1,6 @@ @@ -44,6 +46,11 @@ margin-left: auto; height: 21px; } + .authorship { + display: flex; + align-items: center; + gap: 0.5rem; + } .summary:hover { text-decoration: underline; } @@ -86,15 +93,21 @@
{commit.description.trim()}
{/if} -
+
+ {#if children} + {@render children()} + {/if}
-
+
+ {#if children} + {@render children()} + {/if} diff --git a/src/views/repos/Cob/Revision.svelte b/src/views/repos/Cob/Revision.svelte index 37d1bb9d6..fa1436aee 100644 --- a/src/views/repos/Cob/Revision.svelte +++ b/src/views/repos/Cob/Revision.svelte @@ -24,6 +24,7 @@ import ExpandButton from "@app/components/ExpandButton.svelte"; import IconButton from "@app/components/IconButton.svelte"; import Icon from "@app/components/Icon.svelte"; + import JobCob from "@app/components/JobCob.svelte"; import Link from "@app/components/Link.svelte"; import Loading from "@app/components/Loading.svelte"; import Markdown from "@app/components/Markdown.svelte"; @@ -436,10 +437,21 @@ {/if} {#if response?.commits}
- {#each response.commits.toReversed() as commit} + {#each response.commits.toReversed() as commit, index}
- + + {#if response.commits.length - 1 === index} +
+ +
+ {/if} +
{/each}
diff --git a/src/views/repos/Commit.svelte b/src/views/repos/Commit.svelte index 6a404f089..762b7a7ce 100644 --- a/src/views/repos/Commit.svelte +++ b/src/views/repos/Commit.svelte @@ -11,6 +11,7 @@ import Icon from "@app/components/Icon.svelte"; import Id from "@app/components/Id.svelte"; import InlineTitle from "@app/views/repos/components/InlineTitle.svelte"; + import JobCob from "@app/components/JobCob.svelte"; import Layout from "./Layout.svelte"; import Link from "@app/components/Link.svelte"; import Separator from "./Separator.svelte"; @@ -119,6 +120,13 @@ + {header.parents.length === 1 ? "Parent" : "Parents"}: diff --git a/src/views/repos/Commit/CommitAuthorship.svelte b/src/views/repos/Commit/CommitAuthorship.svelte index 42d05ea61..e5426bccc 100644 --- a/src/views/repos/Commit/CommitAuthorship.svelte +++ b/src/views/repos/Commit/CommitAuthorship.svelte @@ -45,6 +45,7 @@ {formatTimestamp(header.committer.time)} + {:else}
avatar @@ -63,5 +64,6 @@ {formatTimestamp(header.committer.time)} + {/if} diff --git a/src/views/repos/Source/Header.svelte b/src/views/repos/Source/Header.svelte index e35cc1398..7cc54c4eb 100644 --- a/src/views/repos/Source/Header.svelte +++ b/src/views/repos/Source/Header.svelte @@ -13,6 +13,7 @@ import Button from "@app/components/Button.svelte"; import CommitButton from "../components/CommitButton.svelte"; import Icon from "@app/components/Icon.svelte"; + import JobCob from "@app/components/JobCob.svelte"; import Link from "@app/components/Link.svelte"; import PeerBranchSelector from "./PeerBranchSelector.svelte"; @@ -128,22 +129,32 @@ {repo} {selectedBranch} /> {/if} - - {#if !onCanonical} - - - - {/if} +
+ + {#if !onCanonical} + + + + {/if} +
+ +
+
@@ -209,5 +220,13 @@ {/if} +
+ +