Skip to content

Use display name in directory browser breadcrumbs#25924

Merged
MarkEWaite merged 4 commits intojenkinsci:masterfrom
LakshyaBagani:navigate-back-to-build-artifact
Jan 19, 2026
Merged

Use display name in directory browser breadcrumbs#25924
MarkEWaite merged 4 commits intojenkinsci:masterfrom
LakshyaBagani:navigate-back-to-build-artifact

Conversation

@LakshyaBagani
Copy link
Contributor

@LakshyaBagani LakshyaBagani commented Dec 11, 2025

Fixes #16765

Testing done

Verified locally. The breadcrumb now correctly shows the display name instead of the internal name, which looks much better for jobs with custom display names.

UI Screenshots

After the change

Screenshot from 2025-12-12 04-13-50

Before the change

image

Proposed changelog entries

  • Use display name in directory browser breadcrumb.

Proposed changelog category

  • Improvement

Proposed upgrade guidelines

N/A

Submitter checklist

  • The issue, if it exists, is well-described.
  • The changelog entries and upgrade guidelines are appropriate for the audience affected by the change (users or developers, depending on the change) and are in the imperative mood (see examples). Fill in the Proposed upgrade guidelines section only if there are breaking changes or changes that may require extra steps from users during upgrade.
  • There is automated testing or an explanation as to why this change has no tests.
  • New public classes, fields, and methods are annotated with @restricted or have @SInCE TODO Javadocs, as appropriate.
  • New deprecations are annotated with @deprecated(since = "TODO") or @deprecated(forRemoval = true, since = "TODO"), if applicable.
  • UI changes do not introduce regressions when enforcing the current default rules of Content Security Policy Plugin. In particular, new or substantially changed JavaScript is not defined inline and does not call eval to ease future introduction of Content Security Policy (CSP) directives (see documentation).
  • For dependency updates, there are links to external changelogs and, if possible, full differentials.
  • For new APIs and extension points, there is a link to at least one consumer.

Desired reviewers
@timja @mawinter69 @daniel-beck @MarkEWaite

@comment-ops-bot comment-ops-bot bot added rfe For changelog: Minor enhancement. use `major-rfe` for changes to be highlighted web-ui The PR includes WebUI changes which may need special expertise labels Dec 11, 2025
@timja
Copy link
Member

timja commented Dec 11, 2025

Please include before and after screenshots for any ui change

Copy link
Member

@daniel-beck daniel-beck left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Please remove unrelated changes from this PR.

@LakshyaBagani LakshyaBagani force-pushed the navigate-back-to-build-artifact branch from 696a163 to c31574e Compare December 11, 2025 22:43
@LakshyaBagani
Copy link
Contributor Author

Thanks for pointing it out! I’ve added the UI screenshots and will include before/after images in future PRs.

@timja
Copy link
Member

timja commented Dec 12, 2025

you've only added after and the text before

@LakshyaBagani
Copy link
Contributor Author

I’ve added the before screenshot as well.

<form>
<a href="${topPath}">${it.owner.name}</a> /
<j:choose>
<j:when test="${request2.originalRequestURI.contains('/artifact/')}">
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This makes absolutely no sense.

If a job is called artifact, so the URL is /job/artifact/whatever, we go into this branch?

Also, why would we not do this for workspaces?

<a href="${rootURL}/${it.owner.url}artifact/">${%Root}</a> /
</j:when>
<j:otherwise>
<a href="${topPath}">${it.owner.name}</a> /
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Actually a link is already added. It's just that it.owner.name return nothing or is null, hence the link is not usable. So all that needs to be done is checking if it.owner.name is null or empty and then insert ${%Root} instead.

<a href="${rootURL}/${it.owner.url}artifact/">${%Root}</a> /
</j:when>
<j:otherwise>
<a href="${topPath}">${it.owner.name}</a> /
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Or as the owner is a ModelObject use it.owner.displayName as that is the only method that a ModelObject has.
Things you should check:

  • visit the workspace of a FreestyleProject
  • visit the artifacts attached from the job directly (uses lastSuccessfulBuild)
  • visit the artifacts attached from the run itself
  • visit the workspace(s) of a pipeline run

@LakshyaBagani
Copy link
Contributor Author

Thanks @daniel-beck and @mawinter69 for the feedback.

I see the issue with checking request2.originalRequestURI — it would indeed break if a job was named "artifact".

Based on @mawinter69's suggestion, I'll update the approach to avoid the URL check entirely. Instead, I will check if it.owner.name is null or empty.
1 :- If it is empty, I'll default to ${%Root}.
2 :- Otherwise, I'll use it.owner.name (or it.owner.displayName).

I will also verify this behavior across:
1 :- Freestyle project workspaces
2 :- Job artifacts
3 :- Run artifacts
4 :- Pipeline run workspaces

I'll push the changes shortly.

@LakshyaBagani
Copy link
Contributor Author

We removed the URL check entirely. Instead, we updated the logic in dir.jelly to:

1 :- Check if it.owner.name is empty.
2 :- If empty: Display "Root" (this fixes the Artifacts view).
3 :- If not empty: Display it.owner.displayName (this keeps Workspaces working correctly).

Is Further Work Required?
@daniel-beck @mawinter69

Copy link
Contributor

@mawinter69 mawinter69 left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Please also update screenshots

<form>
<a href="${topPath}">${it.owner.name}</a> /
<a href="${topPath}">
<j:choose>
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Just always use it.owner.displayname without a choose. No need to check for name alone, when you don't use it anyway.

@LakshyaBagani
Copy link
Contributor Author

I had changed the code as per the requirement and also added the latest screenshot @daniel-beck @mawinter69

image image

@LakshyaBagani
Copy link
Contributor Author

@daniel-beck @mawinter69 any update in the PR . Do this required any further change or not ?

@LakshyaBagani
Copy link
Contributor Author

Hi @daniel-beck , @timja and @mawinter69,
Thanks again for all the detailed feedback earlier — it really helped improve this change.

I’ve now:

  • Simplified the breadcrumb logic to always use it.owner.displayName

  • Removed the URL-based condition

  • Verified behavior across:

    • Freestyle workspaces
    • Job artifacts
    • Run artifacts
    • Pipeline run workspaces
  • Updated the before/after UI screenshots as requested

All checks are passing, and the branch is ready to merge once approved.

Could you please let me know if any further changes are needed, or if this is ready for final review?
Thanks for your time and guidance!

@mawinter69
Copy link
Contributor

Can you update the screenshots and the original PR description at the top to reflect the current state. It doesn't fit anymore to what was changed and what was tested

Copy link
Contributor

@mawinter69 mawinter69 left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Otherwise it looks good I think

@LakshyaBagani
Copy link
Contributor Author

Thanks for the suggestion!
I have updated the PR description and screenshots to reflect the current implementation and testing.

Copy link
Member

@timja timja left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

/label ready-for-merge


This PR is now ready for merge, after ~24 hours, we will merge it if there's no negative feedback.

Thanks!

@comment-ops-bot comment-ops-bot bot added the ready-for-merge The PR is ready to go, and it will be merged soon if there is no negative feedback label Jan 15, 2026
@timja timja removed the ready-for-merge The PR is ready to go, and it will be merged soon if there is no negative feedback label Jan 15, 2026
@timja
Copy link
Member

timja commented Jan 15, 2026

Please restore the PR template making sure a changelog entry is included:
https://github.com/jenkinsci/jenkins/blob/master/.github/PULL_REQUEST_TEMPLATE.md

@LakshyaBagani
Copy link
Contributor Author

@timja just following up on this PR since it is already approved. Let me know if anything else is needed from my side before merging.

@timja
Copy link
Member

timja commented Jan 17, 2026

Please restore the PR template making sure a changelog entry is included: master/.github/PULL_REQUEST_TEMPLATE.md

@LakshyaBagani
Copy link
Contributor Author

Please restore the PR template making sure a changelog entry is included: master/.github/PULL_REQUEST_TEMPLATE.md

I had changed the PR description .

@timja
Copy link
Member

timja commented Jan 17, 2026

Please restore the PR template making sure a changelog entry is included: master/.github/PULL_REQUEST_TEMPLATE.md

I had changed the PR description .

Not until 15 minutes ago. I hope you've just mistaken had and have.

@timja
Copy link
Member

timja commented Jan 17, 2026

/label ready-for-merge


This PR is now ready for merge, after ~24 hours, we will merge it if there's no negative feedback.

Thanks!

@comment-ops-bot comment-ops-bot bot added the ready-for-merge The PR is ready to go, and it will be merged soon if there is no negative feedback label Jan 17, 2026
@LakshyaBagani
Copy link
Contributor Author

Please restore the PR template making sure a changelog entry is included: master/.github/PULL_REQUEST_TEMPLATE.md

I had changed the PR description .

Not until 15 minutes ago. I hope you've just mistaken had and have.

Sorry for the grammatical mistake. I updated the PR description a few minutes ago .

@MarkEWaite MarkEWaite added ath-successful This PR has successfully passed the full acceptance-test-harness suite pct-successful This PR has successfully passed the full plugin-compatibility-test suite squash-merge-me Unclean or useless commit history, should be merged only with squash-merge labels Jan 19, 2026
@MarkEWaite MarkEWaite changed the title Navigate back to build artifact Show display name of job in the breadcrumbs Jan 19, 2026
@MarkEWaite MarkEWaite changed the title Show display name of job in the breadcrumbs Show display name in the breadcrumbs Jan 19, 2026
@MarkEWaite MarkEWaite changed the title Show display name in the breadcrumbs Show display name in directory browser breadcrumbs Jan 19, 2026
@MarkEWaite MarkEWaite changed the title Show display name in directory browser breadcrumbs Use display name in directory browser breadcrumbs Jan 19, 2026
Copy link
Contributor

@MarkEWaite MarkEWaite left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I tested interactively and found no issues. Thanks!

@MarkEWaite MarkEWaite merged commit 99c2f4d into jenkinsci:master Jan 19, 2026
23 checks passed
meetgoti07 pushed a commit to meetgoti07/jenkins that referenced this pull request Jan 29, 2026
* Update dir.jelly logic for navigation

* Fix the navigation

* Change as per requirement

* Change jelly
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

ath-successful This PR has successfully passed the full acceptance-test-harness suite pct-successful This PR has successfully passed the full plugin-compatibility-test suite ready-for-merge The PR is ready to go, and it will be merged soon if there is no negative feedback rfe For changelog: Minor enhancement. use `major-rfe` for changes to be highlighted squash-merge-me Unclean or useless commit history, should be merged only with squash-merge web-ui The PR includes WebUI changes which may need special expertise

Projects

None yet

Development

Successfully merging this pull request may close these issues.

[JENKINS-75810] Cannot navigate back to "Build Artifacts" root via breadcrumb once inside a folder

5 participants