Fixes #13446: Don't disable bulk edit/delete buttons after deselecting "select all" checkbox

This commit is contained in:
Jeremy Stretch 2023-08-11 08:56:58 -04:00
parent 72e1e8fab1
commit dc7411e4c5
4 changed files with 2 additions and 29 deletions

View File

@ -18,6 +18,7 @@
* [#13343](https://github.com/netbox-community/netbox/issues/13343) - Fix filtering of circuits under provider network view * [#13343](https://github.com/netbox-community/netbox/issues/13343) - Fix filtering of circuits under provider network view
* [#13369](https://github.com/netbox-community/netbox/issues/13369) - Fix job termination status for failed reports * [#13369](https://github.com/netbox-community/netbox/issues/13369) - Fix job termination status for failed reports
* [#13414](https://github.com/netbox-community/netbox/issues/13414) - Fix support for "hide-if-unset" custom fields on bulk import forms * [#13414](https://github.com/netbox-community/netbox/issues/13414) - Fix support for "hide-if-unset" custom fields on bulk import forms
* [#13446](https://github.com/netbox-community/netbox/issues/13446) - Don't disable bulk edit/delete buttons after deselecting "select all" checkbox
--- ---

Binary file not shown.

Binary file not shown.

View File

@ -1,4 +1,4 @@
import { getElement, getElements, findFirstAdjacent } from '../util'; import { getElements, findFirstAdjacent } from '../util';
/** /**
* If any PK checkbox is checked, uncheck the select all table checkbox and the select all * If any PK checkbox is checked, uncheck the select all table checkbox and the select all
@ -63,29 +63,6 @@ function handleSelectAllToggle(event: Event): void {
} }
} }
/**
* Synchronize the select all confirmation checkbox state with the select all confirmation button
* disabled state. If the select all confirmation checkbox is checked, the buttons should be
* enabled. If not, the buttons should be disabled.
*
* @param event Change Event
*/
function handleSelectAll(event: Event): void {
const target = event.currentTarget as HTMLInputElement;
const selectAllBox = getElement<HTMLDivElement>('select-all-box');
if (selectAllBox !== null) {
for (const button of selectAllBox.querySelectorAll<HTMLButtonElement>(
'button[type="submit"]',
)) {
if (target.checked) {
button.disabled = false;
} else {
button.disabled = true;
}
}
}
}
/** /**
* Initialize table select all elements. * Initialize table select all elements.
*/ */
@ -98,9 +75,4 @@ export function initSelectAll(): void {
for (const element of getElements<HTMLInputElement>('input[type="checkbox"][name="pk"]')) { for (const element of getElements<HTMLInputElement>('input[type="checkbox"][name="pk"]')) {
element.addEventListener('change', handlePkCheck); element.addEventListener('change', handlePkCheck);
} }
const selectAll = getElement<HTMLInputElement>('select-all');
if (selectAll !== null) {
selectAll.addEventListener('change', handleSelectAll);
}
} }