Skip to content

Adapt Script Console for experimental Manage Jenkins UI#11333

Merged
timja merged 17 commits intojenkinsci:masterfrom
janfaracik:refine-script-console
Mar 6, 2026
Merged

Adapt Script Console for experimental Manage Jenkins UI#11333
timja merged 17 commits intojenkinsci:masterfrom
janfaracik:refine-script-console

Conversation

@janfaracik
Copy link
Member

@janfaracik janfaracik commented Nov 23, 2025

This PR adapts Script Console for experimental Manage Jenkins UI. It also refines the UI, bringing it closer to Jenkins CLI, as well as allows for the example scripts to be executed with a button click.

Screenshot 2025-11-23 at 11 00 21 Screenshot 2025-11-23 at 11 01 09 Screenshot 2025-11-23 at 11 00 36

Testing done

  • Script console works as before
  • Example scripts are executable
  • UI works with flag enabled/disabled

Proposed changelog entries

  • Adapt Script Console for experimental Manage Jenkins UI

Proposed changelog category

/label web-ui,rfe

Proposed upgrade guidelines

N/A

Submitter checklist

  • The Jira 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

@jenkinsci/sig-ux

Before the changes are marked as ready-for-merge:

Maintainer checklist

  • There are at least two (2) approvals for the pull request and no outstanding requests for change.
  • Conversations in the pull request are over, or it is explicit that a reviewer is not blocking the change.
  • Changelog entries in the pull request title and/or Proposed changelog entries are accurate, human-readable, and in the imperative mood.
  • Proper changelog labels are set so that the changelog can be generated automatically.
  • If the change needs additional upgrade steps from users, the upgrade-guide-needed label is set and there is a Proposed upgrade guidelines section in the pull request title (see example).
  • If it would make sense to backport the change to LTS, a Jira issue must exist, be a Bug or Improvement, and be labeled as lts-candidate to be considered (see query).

@comment-ops-bot comment-ops-bot bot added web-ui The PR includes WebUI changes which may need special expertise rfe For changelog: Minor enhancement. use `major-rfe` for changes to be highlighted labels Nov 23, 2025
@janfaracik janfaracik marked this pull request as ready for review November 23, 2025 11:03
@janfaracik janfaracik added the squash-merge-me Unclean or useless commit history, should be merged only with squash-merge label Nov 23, 2025
gap: 1.5rem;

.jenkins-copy-button {
.jenkins-button {
Copy link
Member Author

Choose a reason for hiding this comment

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

The 'Run example' button isn't a jenkins-copy-button, so this SCSS needed to be updated.

<d:taglib uri="local">
<d:tag name="contents">
<l:app-bar title="${%scriptConsole}">
<t:help href="https://www.jenkins.io/doc/book/managing/script-console/" />
Copy link
Member

Choose a reason for hiding this comment

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

Do not link to docs directly, prefer redirect URLs.

Copy link
Member Author

Choose a reason for hiding this comment

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

Done

</p>
<f:section title="${%Getting started}">
<p class="jenkins-section__description">
Use the ‘println’ command to see the output (if you use System.out, it will go to the server’s stdout, which is harder to see). ${%description2}
Copy link
Member

Choose a reason for hiding this comment

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

Missing i18n

Copy link
Member Author

Choose a reason for hiding this comment

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

Done

</j:forEach>

<!-- this is where the example goes -->
<d:invokeBody />
Copy link
Member

Choose a reason for hiding this comment

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

Is this still supported? What happens in maven-plugin with this PR?

Copy link
Member Author

Choose a reason for hiding this comment

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

It is - can't figure out how to access probe for Maven jobs, but script console for nodes also includes child content:

Screenshot 2025-11-28 at 09 55 18

Comment on lines +31 to +34
<j:new var="it" className="jenkins.management.ConsoleLink" />

<l:settings-subpage includeBreadcrumb="true" permission="${app.ADMINISTER}" header="${null}" noDefer="true">
<j:set var="it" value="${previousIt}" />
Copy link
Member

Choose a reason for hiding this comment

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

Why this hack? Wouldn't it be cleaner to use a different variable in that tag?

Copy link
Member Author

Choose a reason for hiding this comment

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

Wanted <l:settings-subpage to not need to be passed it to work, the thinking being any page using settings-subpage would be of type ManagementLink.

This isn't the case for a lot of pages in core unfortunately so you get this rather unfortunate workaround.

Discussed with Tim about this, and I think we'll be adding an optional it param to all of the subpages.

Copy link
Member

Choose a reason for hiding this comment

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

want to give a refactor a go before we make this worse?

Copy link
Member Author

@janfaracik janfaracik Dec 6, 2025

Choose a reason for hiding this comment

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

Opened #23902 - if you're both happy with the approach I'll open PRs for jobs and builds

@timja timja requested a review from a team December 13, 2025 22:04
@daniel-beck daniel-beck self-requested a review December 14, 2025 14:25
@timja
Copy link
Member

timja commented Dec 16, 2025

cc @jenkinsci/sig-ux appreciate a review

@timja timja mentioned this pull request Dec 19, 2025
14 tasks
@timja timja added the ath-fail The acceptance-test-harness suite needs a forward-compatible change label Dec 21, 2025
@timja
Copy link
Member

timja commented Dec 21, 2025

FYI breaks ATH tests that use jenkins.runScript(script) e.g. CredentialsTest#createSshKeys

The clickButton('Run') call now find the example button too as it does a contains on the button name and the example value is Run example

@janfaracik janfaracik added pct-successful This PR has successfully passed the full plugin-compatibility-test suite ath-successful This PR has successfully passed the full acceptance-test-harness suite and removed ath-fail The acceptance-test-harness suite needs a forward-compatible change pct-successful This PR has successfully passed the full plugin-compatibility-test suite labels Jan 23, 2026
@janfaracik janfaracik requested a review from NotMyFault January 25, 2026 20:02
@janfaracik
Copy link
Member Author

Hey @mawinter69, any thoughts on this?

@mawinter69
Copy link
Contributor

The width of the textarea is somehow wrong on the script console of agents starting from a window width of 1120px . The small symbol to resize the textarea is then outside. That is independent of new Manage Jenkins UI being enabled. With new UI off, the textarea is correct on the global script page. With new UI on, the small symbol in lower right seems to be a bit too far to the left for me (chrome and firefox)

Agent page:
image

global script console new UI enabled:
image

Another general thing on all new Manage UI pages is that the min-height of the <div class="app-settings-container" is too big. That is missing the height of the footer I think so the the page scrolls even when everything would fit on the page.

Also generally I consider the width of the actual content as too small especially on bigger screens.
The limited width is also a problem as can be seen from #26171

@janfaracik
Copy link
Member Author

The width of the textarea is somehow wrong on the script console of agents starting from a window width of 1120px . The small symbol to resize the textarea is then outside. That is independent of new Manage Jenkins UI being enabled. With new UI off, the textarea is correct on the global script page. With new UI on, the small symbol in lower right seems to be a bit too far to the left for me (chrome and firefox)

The console resizer being not positioned correctly is pre-existing - annoying one though.

image

Another general thing on all new Manage UI pages is that the min-height of the <div class="app-settings-container" is too big. That is missing the height of the footer I think so the the page scrolls even when everything would fit on the page.

What resolution is this at? It does have a min-height but I'd have assumed the sidebar height would be taller than that anyway.

Also generally I consider the width of the actual content as too small especially on bigger screens. The limited width is also a problem as can be seen from #26171

Definitely something to look into - experienced this with the Plugins page PR too.

@mawinter69
Copy link
Contributor

Another general thing on all new Manage UI pages is that the min-height of the <div class="app-settings-container" is too big. That is missing the height of the footer I think so the the page scrolls even when everything would fit on the page.

What resolution is this at? It does have a min-height but I'd have assumed the sidebar height would be taller than that anyway.

The sidebar is smaller for me. I have a usable height of 1560px. Just zoom your browser to 75% and you will see the problem probably.

The min-height is calc(100vh - var(--header-height) - var(--section-padding)); so no matter what the footer is always outside.

Copy link
Contributor

@lewisbirks lewisbirks left a comment

Choose a reason for hiding this comment

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

Apart from the known pre-existing issue of the text area expander icon alignment this seems to be working fine for me from local testing. That alignment issue can be fixed in a follow up.

@timja
Copy link
Member

timja commented Mar 5, 2026

Thanks for the feedback Markus, we'll look to solve that generically if we can separately.


/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 Mar 5, 2026
@timja timja merged commit 3355fc8 into jenkinsci:master Mar 6, 2026
22 checks passed
@janfaracik janfaracik deleted the refine-script-console branch March 6, 2026 13:56
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 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.

5 participants