mirror of
https://github.com/ChuckBuilds/LEDMatrix.git
synced 2026-10-06 15:25:08 +00:00
fix(web): plugin settings form shows schema defaults for unsaved keys (#597)
The server-rendered plugin settings partial rendered straight from the saved config, so an option added in a plugin update (geochron 1.2.0's show_date / show_date_line, default true) drew as an unchecked box, and the save route's missing-checkbox handling then stored it as false. Enum dropdowns likewise showed their first option instead of the default. - _load_plugin_config_partial runs the stored section through prepare_plugin_config (as GET /plugins/config does) before masking secrets, so a secret's schema default is masked too. - render_field falls back to the field's own default, covering children of objects that declare a default of their own (where the defaults extraction stops). - The legacy-boolean parity test now compares against the config the plugin actually runs with (defaults included). Co-authored-by: Claude Opus 5 <noreply@anthropic.com>
This commit is contained in:
@@ -40,6 +40,14 @@ Config saves and plugin config preparation:
|
||||
the object, posting it back saves, and hot reload hands plugins the same
|
||||
shape (schema defaults included) they were constructed with.
|
||||
`schema_manager.prepare_plugin_config` is the one implementation.
|
||||
- A plugin's settings tab shows schema defaults for options its saved config
|
||||
doesn't have yet. A boolean added with `"default": true` in a plugin update
|
||||
(geochron 1.2.0's `show_date` and `show_date_line`) used to render unchecked,
|
||||
and the next save of that tab stored it as `false`. Enum dropdowns likewise
|
||||
showed their first option instead of the default. The partial now runs the
|
||||
stored section through `prepare_plugin_config` like `GET /plugins/config`
|
||||
(secrets are still masked, after the merge), and the form falls back to a
|
||||
field's own `default` inside objects that declare a default of their own.
|
||||
- `scripts/dev_server.py`, `check_plugin.py`, `render_plugin.py` and the plugin
|
||||
harness build configs the way a device does: nested defaults are included,
|
||||
a schema `enabled: false` no longer beats the forced `enabled: true` in the
|
||||
|
||||
Reference in New Issue
Block a user