Skip to content

Let mass edit set the rest of a host's General tab - #1758

Merged
fog-workflows[bot] merged 1 commit into
working-1.6from
feat/mass-edit-host-fields
Sep 11, 2026
Merged

fog-workflows[bot] merged 1 commit into
working-1.6from
feat/mass-edit-host-fields

Conversation

@mastacontrola

@mastacontrola mastacontrola commented Sep 11, 2026

Copy link
Copy Markdown
Member

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:

  • description
  • architecture
  • desired agent version
  • Secure Boot enrollment date, Enrolled Via and enrolled certificate

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.
  • A spec entry can carry normalize. MassEdit::columnUpdates() runs it on SET, before any update. A value it refuses throws, so no host is written. CLEAR never runs it.
  • The architecture, enrollment date, Enrolled Via and certificate checks moved out of 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.
  • Architecture uses the host form's picker (hostArchSelector()). Description is a textarea. Enrolled Via is a select, not free text.

Fixed on the same path

  • SET on the image picker's blank option wrote '' into hostImage. The foreign key refuses that, so the edit failed with "The database refused the update". SET to blank 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. For a user with a time zone preference, every Update moved the date. The form and the mass edit hint now show it through 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: normalize runs 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:

  • The form renders all six new controls, with the architecture list and the Enrolled Via picker.
  • SET on all six plus image: 202, and each value stored as the host form stores it (v0.3.0 became 0.3.0, MOK became mok, the bare-hex certificate was stored in colon form, the typed date was read in the viewer's zone).
  • SET Enrolled Via to usb stick, together with a new description: 400 with the host form's message, and neither field changed.
  • SET image and architecture to the blank option, and CLEAR the enrollment record: 202, all stored as NULL.
  • The host page showed Secure Boot Enrolled as 12:00:00, which was typed and saved as 17:00:00 UTC.

🤖 Generated with Claude Code

https://claude.ai/code/session_01YaTKQnwMd6Y1QMGNKiorNW

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
@fog-workflows
fog-workflows Bot enabled auto-merge September 11, 2026 11:00
@fog-workflows
fog-workflows Bot added this pull request to the merge queue Sep 11, 2026
Merged via the queue into working-1.6 with commit 3ade7e6 Sep 11, 2026
11 checks passed
@fog-workflows
fog-workflows Bot deleted the feat/mass-edit-host-fields branch September 11, 2026 11:08
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant