luci-mod-network: properly reflect config state in sysfs tristates
authorJo-Philipp Wich <jo@mein.io>
Fri, 8 Dec 2023 11:38:51 +0000 (12:38 +0100)
committerJo-Philipp Wich <jo@mein.io>
Fri, 8 Dec 2023 11:38:51 +0000 (12:38 +0100)
When a boolean sysfs option is forcibly set to `0` or `1` in uci, then make
sure to properly reflect that choice state when rendering the widget.

Right now the dropdown incorrectly reverted to "automatic" after saving but
not applying the changes.

Signed-off-by: Jo-Philipp Wich <jo@mein.io>
modules/luci-mod-network/htdocs/luci-static/resources/tools/network.js

index 092bbbc14a69131585437f3e0abdfa1ea6f52c5a..318373c7c7b29dda8d63af04df35c8d4e0fcee89 100644 (file)
@@ -198,7 +198,7 @@ var cbiFlagTristate = form.ListValue.extend({
                        this.vallist[0] = sysdef ? _('automatic (enabled)') : _('automatic (disabled)');
                }
 
-               return this.super('renderWidget', [section_id, option_index, cfgvalue]);
+               return this.super('renderWidget', [section_id, option_index, cfgvalue ? cfgvalue + '!' : null]);
        }
 });