Let mass edit set the rest of a host's General tab - #1758
Merged
Merged
Conversation
Mass edit carried only what the group page used to push, so description, architecture, desired agent version and the Secure Boot enrollment record could be set on one host but not on a selection. Add them. Each saves through the helper the host form now uses too, so a value the host form refuses is refused here before any host is written. The hostname stays out: it is unique, so no single value fits two hosts. Two defects on the same path: - SET on the image picker's blank option wrote '' into hostImage, which its foreign key refuses, so the edit failed with no clue why. It now writes NULL, as CLEAR does. - The host form showed Secure Boot Enrolled in the storage zone and read it back in the viewer's zone, so every Update moved the date for a viewer with a zone preference. It is now shown in the viewer's zone. Co-Authored-By: Claude Opus 5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01YaTKQnwMd6Y1QMGNKiorNW
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Problem
Mass edit on the host list covered only the fields the group page used to push. Six settings on a single host's General tab had no bulk path:
Change
massEditCoreFields()carries the six fields, on the General tab, where the host page draws them. The hostname stays out: it is unique, so no single value fits two hosts.normalize.MassEdit::columnUpdates()runs it on SET, before any update. A value it refuses throws, so no host is written. CLEAR never runs it.hostGeneralPost()into helpers. The host form and mass edit both save through them. The five Enrolled Via words are one constant,SB_ENROLL_VIA, which also builds the mass edit picker.hostArchSelector()). Description is a textarea. Enrolled Via is a select, not free text.Fixed on the same path
''intohostImage. The foreign key refuses that, so the edit failed with "The database refused the update". SET to blank now writes NULL, as CLEAR does.toDisplayStored().Not included
Inventory tags, MACs, site, modules, snapins, printers and power management. These are per-host identity, association rows or tasks, not General-tab values.
Tests
tests/mass-edit-endpoint-is-gated.test.php: the whitelist carries the six fields and not the hostname.tests/mass-edit-form.test.php: the controls, the tabs, and each normalizer against the host form's rule.tests/mass-edit-fails-closed.test.php:normalizeruns on SET only, and a refusal throws.tests/fk-columns-clear-to-null.test.php: SET to blank writes NULL for image and architecture.tests/secureboot-enrolvia-vocabulary.test.php: reads the new constant.Each new check failed against the base before the change. Full suite: 356 passed, 0 failed. Both phpstan passes are clean.
Live check
The branch was served from a shadow tree against the lab database, on one throwaway host that was deleted afterward:
v0.3.0became0.3.0,MOKbecamemok, the bare-hex certificate was stored in colon form, the typed date was read in the viewer's zone).usb stick, together with a new description: 400 with the host form's message, and neither field changed.12:00:00, which was typed and saved as17:00:00UTC.🤖 Generated with Claude Code
https://claude.ai/code/session_01YaTKQnwMd6Y1QMGNKiorNW