summaryrefslogtreecommitdiffhomepage
path: root/modules
diff options
context:
space:
mode:
authorFlorian Eckert <fe@dev.tdt.de>2020-10-06 11:15:45 +0200
committerFlorian Eckert <fe@dev.tdt.de>2020-10-06 11:30:48 +0200
commita75ae38b6b36fec76c259c8313857003f5b23841 (patch)
tree6265d82563a82b0439c1abb3d77b72eb5203ac1d /modules
parent61a4fca14756d40138e2ded2084155ed5f901d45 (diff)
luci-mod-system: fix uci led option remove callback
fixes #4478 Signed-off-by: Florian Eckert <fe@dev.tdt.de>
Diffstat (limited to 'modules')
-rw-r--r--modules/luci-mod-system/htdocs/luci-static/resources/view/system/leds.js26
1 files changed, 26 insertions, 0 deletions
diff --git a/modules/luci-mod-system/htdocs/luci-static/resources/view/system/leds.js b/modules/luci-mod-system/htdocs/luci-static/resources/view/system/leds.js
index 9fe1bff55..23feebc00 100644
--- a/modules/luci-mod-system/htdocs/luci-static/resources/view/system/leds.js
+++ b/modules/luci-mod-system/htdocs/luci-static/resources/view/system/leds.js
@@ -88,6 +88,32 @@ return view.extend({
var plugin = plugins[i];
plugin.form.addFormOptions(s);
}
+
+ var opts = s.getOption();
+
+ var removeIfNoneActive = function(original_remove_fn, section_id) {
+ var isAnyActive = false;
+
+ for (var optname in opts) {
+ if (opts[optname].ucioption != this.ucioption)
+ continue;
+
+ if (!opts[optname].isActive(section_id))
+ continue;
+
+ isAnyActive = true;
+ break;
+ }
+
+ if (!isAnyActive)
+ original_remove_fn.call(this, section_id);
+ };
+
+ for (var optname in opts) {
+ if (!opts[optname].ucioption || optname == opts[optname].ucioption)
+ continue;
+ opts[optname].remove = removeIfNoneActive.bind(opts[optname], opts[optname].remove);
+ }
};
return m.render();