luci-mod-system: leds.js: display default state as On/Off
authorJo-Philipp Wich <jo@mein.io>
Mon, 11 Nov 2019 09:14:03 +0000 (10:14 +0100)
committerJo-Philipp Wich <jo@mein.io>
Mon, 11 Nov 2019 09:14:03 +0000 (10:14 +0100)
Fixes: #3289
Signed-off-by: Jo-Philipp Wich <jo@mein.io>
modules/luci-mod-system/htdocs/luci-static/resources/view/system/leds.js

index b571032efc93348d1dee64138bca73fa917fc212..edd4a24e0673656f2318cb52b6182208f9676aa4 100644 (file)
@@ -53,6 +53,14 @@ return L.view.extend({
 
                o = s.option(form.Flag, 'default', _('Default state'));
                o.rmempty = false;
+               o.textvalue = function(section_id) {
+                       var cval = this.cfgvalue(section_id);
+
+                       if (cval == null)
+                               cval = this.default;
+
+                       return (cval == this.enabled) ? _('On') : _('Off');
+               };
 
                o = s.option(form.ListValue, 'trigger', _('Trigger'));
                if (usb.devices && usb.devices.length)