Skip to content

Commit

Permalink
[HUD] Add scroll to for commit link in job links, add highlight, fix …
Browse files Browse the repository at this point in the history
…commit link for non pytorch repos (#6304)

Not sure if this is a good idea but

Adds anchor to the link so that it will scroll to the job when the
commit link is clicked and the job will get highlighted

For reference, the commit link looks like
<img width="516" alt="image"
src="https://github.com/user-attachments/assets/fe739233-02a5-4402-aaae-e08e144e6a62"
/>
in the job tooltip on HUD. It is also present in a few other places,
like the failures page

Clicking on the commit link will now go to the commit page, scroll to
the job, and highlight the job

Highlight example:
<img width="371" alt="image"
src="https://github.com/user-attachments/assets/8d810c29-2cd4-4616-9bd7-003125e5feb4"
/>

This will also highlight jobs when clicking on links from Dr. CI:
<img width="764" alt="image"
src="https://github.com/user-attachments/assets/5b900b8a-4e28-4a8a-a006-d9fe95490a9a"
/>


---

Also fix link for non pytorch repos
  • Loading branch information
clee2000 authored Feb 20, 2025
1 parent 6540efe commit 37f8b16
Show file tree
Hide file tree
Showing 2 changed files with 2 additions and 1 deletion.
2 changes: 1 addition & 1 deletion torchci/components/JobLinks.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@ export default function JobLinks({
<a
target="_blank"
rel="noreferrer"
href={`/pytorch/pytorch/commit/${job.sha}`}
href={`/${job.repo}/commit/${job.sha}#${job.id}-box`}
>
Commit
</a>
Expand Down
1 change: 1 addition & 0 deletions torchci/lib/useScrollTo.ts
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,7 @@ export default function useScrollTo() {
if (id != null) {
const job = document.getElementById(id);
window.scrollTo({ top: job?.offsetTop, behavior: "smooth" });
job?.style.setProperty("background-color", "LightYellow");
}
}, [router.asPath]);
}

0 comments on commit 37f8b16

Please sign in to comment.