Skip to content

Fix Plugin Manager 'Enabled' column sorting#26349

Open
himanshu748 wants to merge 3 commits intojenkinsci:masterfrom
himanshu748:fix/JENKINS-60117-plugin-sorting
Open

Fix Plugin Manager 'Enabled' column sorting#26349
himanshu748 wants to merge 3 commits intojenkinsci:masterfrom
himanshu748:fix/JENKINS-60117-plugin-sorting

Conversation

@himanshu748
Copy link

@himanshu748 himanshu748 commented Feb 22, 2026

Fixes https://github.com/jenkinsci/jenkins/issues/60117

Testing done

Verified that the 'Enabled' column in the Plugin Manager sorts properly by changing the sorting value from string "true"/"false" to numeric "1"/"0".
Tested locally.

Screenshots (UI changes only)

Before

(Sorting did not work correctly)

After

(Sorting works properly)

Proposed changelog entries

  • Fix Plugin Manager 'Enabled' column sorting to work properly.

Proposed changelog category

/label bug, web-ui

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.
  • 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.
  • 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

@mention

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.
  • If it would make sense to backport the change to LTS, be a Bug or Improvement, and either the issue or pull request must be labeled as lts-candidate to be considered.

The "Enabled" column in the Installed Plugins table uses `data="${state}"` where state is `true` or `null`.
Since the sortable.js sorts by the `data` attribute alphabetically, plugins with `false` or `null` were not
sorting effectively relative to `true`. This commit changes the `data` attribute for sorting
to `1` (true/active) and `0` (false/inactive) for deterministic boolean sorting.
Copilot AI review requested due to automatic review settings February 22, 2026 09:42
Copy link
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

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

Pull request overview

This PR fixes JENKINS-60117 by improving the boolean sorting mechanism for the Plugin Manager's 'Enabled' column. The change replaces the previous sorting approach that used 'true' vs null values with a more deterministic '1' vs '0' numeric approach. However, the change also switches from using p.enabled to p.active for determining the sort value, which may introduce a semantic behavioral change.

Changes:

  • Changed the data attribute for sorting from using p.enabled with 'true'/null values to using p.active with '1'/'0' values
  • This makes boolean sorting more deterministic by ensuring both states have explicit non-null string values

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

</j:if>
<j:set var="state" value="${p.enabled?'true':null}"/>
<td class="jenkins-table__cell--tight enable" data="${state}">
<td class="jenkins-table__cell--tight enable" data="${p.active?'1':'0'}">
Copy link

Copilot AI Feb 22, 2026

Choose a reason for hiding this comment

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

This change modifies both the format (from 'true'/null to '1'/'0') and the semantic meaning (from p.enabled to p.active) of the sorting data. While the format change improves determinism, the semantic change may cause unexpected behavior.

The distinction between p.enabled and p.active:

  • p.enabled: Whether the plugin will be enabled after restart (based on configuration files)
  • p.active: Whether the plugin is currently active in this session (runtime state)

The checkbox's checked attribute (line 192) uses p.enabled, which means it shows whether the plugin will be enabled after restart. However, the sorting now uses p.active, which reflects the current runtime state.

Scenario where this matters:

  1. User enables a disabled plugin → checkbox becomes checked, but sorting keeps it with disabled plugins until restart
  2. User disables an enabled plugin → checkbox becomes unchecked, but sorting keeps it with enabled plugins until restart

This creates a visual inconsistency where the sort order doesn't match the checkbox states. Consider whether the sorting should use p.enabled to match the checkbox, or if this behavioral change is intentional and should be documented.

Suggested change
<td class="jenkins-table__cell--tight enable" data="${p.active?'1':'0'}">
<td class="jenkins-table__cell--tight enable" data="${p.enabled?'1':'0'}">

Copilot uses AI. Check for mistakes.
@janfaracik
Copy link
Member

Could you restore the PR template, thanks

@comment-ops-bot comment-ops-bot bot added the bug For changelog: Minor bug. Will be listed after features label Feb 22, 2026
The sorting data attribute should use p.enabled to match the checkbox's
checked attribute, ensuring sort order reflects the configured state
rather than the runtime state.
Copy link
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

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

Pull request overview

Copilot reviewed 1 out of 1 changed files in this pull request and generated no new comments.


💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

@himanshu748 himanshu748 force-pushed the fix/JENKINS-60117-plugin-sorting branch from 0c4755a to 8a9e67a Compare February 22, 2026 10:43
@MarkEWaite MarkEWaite changed the title [JENKINS-60117] Fix Plugin Manager 'Enabled' column sorting Fix Plugin Manager 'Enabled' column sorting Feb 22, 2026
@himanshu748
Copy link
Author

Fixed the 'Enabled' column sorting logic in the Plugin Manager (installed.jelly) to use '1' and '0' for numerical sorting consistency, as suggested.

@comment-ops-bot comment-ops-bot bot added the web-ui The PR includes WebUI changes which may need special expertise label Feb 24, 2026
Copy link
Author

@himanshu748 himanshu748 left a comment

Choose a reason for hiding this comment

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

I have restored the PR template as requested.

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

Labels

bug For changelog: Minor bug. Will be listed after features 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.

3 participants