From 638f5ce071f229fb0c11456a0b59d425179ab288 Mon Sep 17 00:00:00 2001 From: Florian Eckert Date: Thu, 20 Feb 2020 12:04:12 +0100 Subject: luci-mod-system: add led plugin infrastructure This commit creates the possibility that not only kernel-led-triggers can be selected but also application-led-triggers from user space. This is done via a plugin mechanism. The application-led-triggers are scripts that set kernel-led-triggers on system events or services. Until now this has not been possible. The package rssileds is a kind of application-led-trigger. The following new packages are added: * luci-app-ledtrig-rssi (application-led-trigger) * luci-app-ledtrig-switch (kernel-led-trigger) not needed on every most devices * luci-app-ledtrig-usport (kernel-led-trigger) optional trigger Since we have now a plugin mechanism I have added the following triggers as a dependency. So this triggers are now installed per default on LuCI installation. * kmod-ledtrig-default-on * kmod-ledtrig-heartbeat * kmod-ledtrig-netdev * kmod-ledtrig-timer The kernel trigger kmod-ledtrig-usbdev was removed with the commit https://github.com/openwrt/openwrt/commit/d0b50c2770a0e2d54b37153f2801e2e7dc865fa6 So I have not ported the relevant code anymore. Signed-off-by: Florian Eckert --- .../resources/view/system/led-trigger/switch0.js | 18 ++++++++++++++++++ .../resources/view/system/led-trigger/switch1.js | 18 ++++++++++++++++++ 2 files changed, 36 insertions(+) create mode 100644 applications/luci-app-ledtrig-switch/htdocs/luci-static/resources/view/system/led-trigger/switch0.js create mode 100644 applications/luci-app-ledtrig-switch/htdocs/luci-static/resources/view/system/led-trigger/switch1.js (limited to 'applications/luci-app-ledtrig-switch/htdocs/luci-static') diff --git a/applications/luci-app-ledtrig-switch/htdocs/luci-static/resources/view/system/led-trigger/switch0.js b/applications/luci-app-ledtrig-switch/htdocs/luci-static/resources/view/system/led-trigger/switch0.js new file mode 100644 index 0000000000..2f59866a6c --- /dev/null +++ b/applications/luci-app-ledtrig-switch/htdocs/luci-static/resources/view/system/led-trigger/switch0.js @@ -0,0 +1,18 @@ +'use strict'; +'require form'; + +return L.Class.extend({ + trigger: _('switch0 (kernel)'), + kernel: true, + addFormOptions(s){ + var o; + + o = s.option(form.Value, 'port_mask', _('Switch Port Mask')); + o.modalonly = true; + o.depends('trigger', 'switch0'); + + o = s.option(form.Value, 'speed_mask', _('Switch Speed Mask')); + o.modalonly = true; + o.depends('trigger', 'switch0'); + } +}); diff --git a/applications/luci-app-ledtrig-switch/htdocs/luci-static/resources/view/system/led-trigger/switch1.js b/applications/luci-app-ledtrig-switch/htdocs/luci-static/resources/view/system/led-trigger/switch1.js new file mode 100644 index 0000000000..7800cba227 --- /dev/null +++ b/applications/luci-app-ledtrig-switch/htdocs/luci-static/resources/view/system/led-trigger/switch1.js @@ -0,0 +1,18 @@ +'use strict'; +'require form'; + +return L.Class.extend({ + trigger: _('switch1 (kernel)'), + kernel: true, + addFormOptions(s){ + var o; + + o = s.option(form.Value, 'port_mask', _('Switch Port Mask')); + o.modalonly = true; + o.depends('trigger', 'switch1'); + + o = s.option(form.Value, 'speed_mask', _('Switch Speed Mask')); + o.modalonly = true; + o.depends('trigger', 'switch1'); + } +}); -- cgit v1.2.3