luci-mod-network: handle dynamic device configuration defaults
authorJo-Philipp Wich <[email protected]>
Tue, 7 Feb 2023 09:01:25 +0000 (10:01 +0100)
committerJo-Philipp Wich <[email protected]>
Mon, 3 Apr 2023 11:47:37 +0000 (13:47 +0200)
commit7ef5b102795ad564e4357c4b7d3d72f911330fd9
tree21ae22284b7814f96e9d22fc1a78918298b07cad
parent30645fdd093d8bbba73848d1a54d1d351dba6bba
luci-mod-network: handle dynamic device configuration defaults

Most uci network device configuration settings have no specific default
value which means that netifd will only alter the related sysfs parameters
if an explicit value is specified in uci. When omitted from the
configuration, the related sysfs setting is left untouched.

This behaviour collides with LuCI's approach of purging boolean options
from the configuration if they match their default value, leading to the
inability to disable or enable certain settings as described in #6219.

Solve this issue by replacing flag widgets with tri-state selects offering
an "automatic" (default) as well as an explicit "enabled" and "disabled"
choice. Also query sysfs on load and preset the automatic choice with an
indication whether the underlying sysfs settings is currently active or not.

Fixes: #6219
Signed-off-by: Jo-Philipp Wich <[email protected]>
(cherry picked from commit 276046c8e973ab0a02a4a17fdc5aea65786a0058)
modules/luci-mod-network/htdocs/luci-static/resources/tools/network.js
modules/luci-mod-network/root/usr/share/rpcd/acl.d/luci-mod-network.json