luci-base: override the load() function to return boolean for FlagValue
authorPaul Donald <[email protected]>
Fri, 25 Apr 2025 15:17:51 +0000 (17:17 +0200)
committerPaul Donald <[email protected]>
Fri, 25 Apr 2025 15:17:51 +0000 (17:17 +0200)
commit1355a6fa253d765140f5571354939d2e93e6d967
tree1c87631177b66172b50fe54ffb433d7e2465c033
parent815fbc019c73d4c707c891867e1bcb203dd78e39
luci-base: override the load() function to return boolean for FlagValue

In the underlying uci system, all variables are effectively strings, so
for those configuration values which serve as 'boolean' flags, we need
to coerce the various forms into a real boolean. Only the following
string values result in true: 1|on|true|yes|enabled. Otherwise, false.

Checkboxes now fill correctly.

"Unchanged" configurations may write changed values as the Flag values
are coerced to '1' or '0' on write, but the configuration behaviour
remains synonymous.

Signed-off-by: Paul Donald <[email protected]>
modules/luci-base/htdocs/luci-static/resources/form.js