Let OpenWeather Units fall through the settings cascade
The Units field carried a Default of "metric" and had no blank option, so the global panel layer always set a value and locked organizations and users out of changing it. Mirror the fix already applied to OpenSky's plan. - Plugin descriptor: drop the "metric" Default and add a blank "Not set" option; runtime still falls back to metric when no layer sets it. - Web App: add a "Not set" choice to the Units control and stop forcing metric back into the form on load. - Test guards that the units field has no Default and offers a blank option. - Rebuilt embedded frontend. Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
This commit is contained in:
co-authored by
Claude Opus 4.8
parent
6231b43076
commit
285551fe8a
@@ -38,6 +38,23 @@ func TestDescriptor(t *testing.T) {
|
||||
if f.Required {
|
||||
t.Errorf("config field %q must not be Required", f.Key)
|
||||
}
|
||||
// Units must be blank-able so the value can fall through the settings
|
||||
// cascade: a blank "" option and no Default, otherwise the global layer
|
||||
// always sets it and locks organizations/users out.
|
||||
if f.Key == "units" {
|
||||
if f.Default != "" {
|
||||
t.Errorf("units field must not carry a Default (got %q) — it would lock lower cascade layers", f.Default)
|
||||
}
|
||||
hasBlank := false
|
||||
for _, o := range f.Options {
|
||||
if o.Value == "" {
|
||||
hasBlank = true
|
||||
}
|
||||
}
|
||||
if !hasBlank {
|
||||
t.Error("units field must offer a blank \"\" (Not set) option so it can fall through the cascade")
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user