Skip to content

Commit

Permalink
feat: moved hash to results link
Browse files Browse the repository at this point in the history
  • Loading branch information
Venefilyn committed Oct 7, 2023
1 parent 0d6482a commit 58647a3
Showing 1 changed file with 28 additions and 22 deletions.
50 changes: 28 additions & 22 deletions frontend/src/app/Results/ResultsPageTestingFarm.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -97,7 +97,6 @@ function useCoprBuilds(copr_build_ids: number[]): React.JSX.Element[] {
const coprDetails = results.map((result) => {
if (!result.data || typeof result.data !== "object")
return <>Loading</>;
console.log(result.data);
if ("error" in result.data) {
return <>Error {result.data["error"]}</>;
} else if ("build_id" in result.data) {
Expand Down Expand Up @@ -195,6 +194,12 @@ const ResultsPageTestingFarm = () => {
<>{data?.status}</>
);

const onCopyHash = () => {
if (data) {
navigator.clipboard.writeText(data.commit_sha.substring(0, 7));
}
};

return (
<>
<PageSection variant={PageSectionVariants.light}>
Expand All @@ -203,7 +208,28 @@ const ResultsPageTestingFarm = () => {

<Text component="p">
<strong>
{data ? <TriggerLink builds={data} /> : <></>}
{data ? (
<>
<TriggerLink builds={data} />
<ClipboardCopy
variant="inline-compact"
onCopy={onCopyHash}
>
<a
href={getCommitLink(
data.git_repo,
data.commit_sha,
)}
rel="noreferrer"
target="_blank"
>
{data.commit_sha.substring(0, 7)}
</a>
</ClipboardCopy>
</>
) : (
<></>
)}
</strong>
<br />
</Text>
Expand Down Expand Up @@ -260,26 +286,6 @@ const ResultsPageTestingFarm = () => {
</ClipboardCopy>
</DescriptionListDescription>
</DescriptionListGroup>
<DescriptionListGroup>
<DescriptionListTerm>
Commit SHA
</DescriptionListTerm>
<DescriptionListDescription>
<a
href={getCommitLink(
data.git_repo,
data.commit_sha,
)}
rel="noreferrer"
target="_blank"
>
{data.commit_sha.substring(
0,
7,
)}
</a>
</DescriptionListDescription>
</DescriptionListGroup>
</DescriptionList>
</CardBody>
<CardBody>
Expand Down

0 comments on commit 58647a3

Please sign in to comment.