Skip to content

Commit

Permalink
Link package in relese sync results
Browse files Browse the repository at this point in the history
Partially fixes #358 (for failed syncs, the info is still
missing).
  • Loading branch information
lbarcziova committed Mar 5, 2024
1 parent 32cfbe9 commit 6fbef60
Showing 1 changed file with 22 additions and 0 deletions.
22 changes: 22 additions & 0 deletions frontend/src/app/Results/ResultsPageSyncReleaseRuns.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -53,6 +53,7 @@ interface SyncReleaseRun {
issue_id: number | null;
branch_name: string | null;
release: string | null;
downstream_pr_project: string | null;
}

const fetchSyncRelease = (url: string) =>
Expand Down Expand Up @@ -116,6 +117,23 @@ const ResultsPageSyncReleaseRuns: React.FC<ResultsPageSyncReleaseRunsProps> = ({
<>Link will be available after successful downstream PR submission.</>
);

const getLinkToPackage = () => {
if (!data.downstream_pr_project) return <>Link not available.</>;

const lastSlashIndex = data.downstream_pr_project.lastIndexOf("/");
const packageName =
lastSlashIndex !== -1
? data.downstream_pr_project.substring(lastSlashIndex + 1)
: "";
return packageName ? (
<a href={data.downstream_pr_project} rel="noreferrer" target="_blank">
{packageName}
</a>
) : (
<>Link not available.</>
);
};

const FooterButton = () => {
const handleClick = () => {
if (logViewerRef.current) logViewerRef.current.scrollToBottom();
Expand Down Expand Up @@ -256,6 +274,10 @@ const ResultsPageSyncReleaseRuns: React.FC<ResultsPageSyncReleaseRunsProps> = ({
link={data.downstream_pr_url}
/>
</DescriptionListDescription>
<DescriptionListTerm>Package</DescriptionListTerm>
<DescriptionListDescription>
{getLinkToPackage()}
</DescriptionListDescription>
</DescriptionListGroup>
<DescriptionListGroup>
<DescriptionListTerm>Submitted Time</DescriptionListTerm>
Expand Down

0 comments on commit 6fbef60

Please sign in to comment.