Skip to content

Commit

Permalink
[JENKINS-73669] don't change unrelated checkboxes in rowSelectionCont…
Browse files Browse the repository at this point in the history
…roller

when a row in table contains more than 1 checkbox the
rowSelectionController shouldn't change all checkboxes but only the one
in the same column
  • Loading branch information
mawinter69 committed Aug 21, 2024
1 parent 94aadfc commit 375c7c7
Show file tree
Hide file tree
Showing 3 changed files with 11 additions and 4 deletions.
4 changes: 2 additions & 2 deletions core/src/main/resources/hudson/PluginManager/updates.jelly
Original file line number Diff line number Diff line change
Expand Up @@ -69,7 +69,7 @@ THE SOFTWARE.
<tr>
<l:isAdmin>
<th data-sort-disable="true">
<l:rowSelectionController>
<l:rowSelectionController class="checkbox-install-plugin">
<j:if test="${app.updateCenter.hasIncompatibleUpdates(cache)}">
<button tooltip="${%CompatibleTooltip}" type="button" data-select="compatible" class="jenkins-button jenkins-button--tertiary">
<div class="jenkins-table__checkbox-dropdown__icon">
Expand Down Expand Up @@ -101,7 +101,7 @@ THE SOFTWARE.
id="plugin.${p.name}.${p.sourceId}"
checked="${installedOk ? 'checked' : null}"
disabled="${installedOk ? 'disabled' : null}"
data-compat-warning="${!p.isCompatible(cache)}"/>
data-compat-warning="${!p.isCompatible(cache)}" class="checkbox-install-plugin"/>
<label for="plugin.${p.name}.${p.sourceId}" />
</span>
</td>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -26,10 +26,14 @@ THE SOFTWARE.
<j:jelly xmlns:j="jelly:core" xmlns:st="jelly:stapler" xmlns:d="jelly:define" xmlns:l="/lib/layout">
<st:documentation>
Controls checkbox selections in tables
<st:attribute name="class" use="required">
Used for the queryselector to find the checkboxes that should change state when clicking
one of the available buttons.
</st:attribute>
</st:documentation>

<div class="jenkins-table__checkbox-container">
<button type="button" class="jenkins-table__checkbox">
<button type="button" class="jenkins-table__checkbox" data-checkbox-class="${attrs.class}">
<l:icon src="symbol-check" class="jenkins-table__checkbox__all-symbol" />
<l:icon src="symbol-indeterminate" class="jenkins-table__checkbox__indeterminate-symbol" />
</button>
Expand Down
5 changes: 4 additions & 1 deletion war/src/main/js/components/row-selection-controller/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,10 @@ const rowSelectionControllers = document.querySelectorAll(

rowSelectionControllers.forEach((headerCheckbox) => {
const table = headerCheckbox.closest(".jenkins-table");
const tableCheckboxes = table.querySelectorAll("input[type='checkbox']");
const checkboxClass = headerCheckbox.dataset.checkboxClass;
const tableCheckboxes = table.querySelectorAll(
`input[type='checkbox'].${checkboxClass}`,
);
const moreOptionsButton = table.querySelector(
".jenkins-table__checkbox-options",
);
Expand Down

0 comments on commit 375c7c7

Please sign in to comment.