Skip to content

Commit

Permalink
Link package in relese sync results
Browse files Browse the repository at this point in the history
Partially fixes packit#358 (for failed syncs, the info is still
missing).
  • Loading branch information
lbarcziova committed Feb 26, 2024
1 parent 448ad8c commit d9a9640
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 @@ -50,6 +50,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 @@ -113,6 +114,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 @@ -253,6 +271,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 d9a9640

Please sign in to comment.