luci-mod-network: properly reflect config state in sysfs tristates

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>
This commit is contained in:
Jo-Philipp Wich 2023-12-08 12:38:51 +01:00
parent 6bdc577109
commit 4b6b00927b

View 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]);
}
});