summaryrefslogtreecommitdiffhomepage
path: root/applications
diff options
context:
space:
mode:
authorFlorian Eckert <fe@dev.tdt.de>2020-02-27 14:08:57 +0100
committerGitHub <noreply@github.com>2020-02-27 14:08:57 +0100
commitfe49108e024a7faf8dff0b425fc6367a0a933457 (patch)
tree67083f8d679418fa54ab0053bef8af926e5a967a /applications
parente5f4531b707867ae7d2fb1731ea579109069d953 (diff)
parent638f5ce071f229fb0c11456a0b59d425179ab288 (diff)
Merge pull request #3639 from TDT-AG/pr/20200217-leds
luci-mod-system: add led plugin infrastructure
Diffstat (limited to 'applications')
-rw-r--r--applications/luci-app-ledtrig-rssi/Makefile16
-rw-r--r--applications/luci-app-ledtrig-rssi/htdocs/luci-static/resources/view/system/led-trigger/rssi.js38
-rw-r--r--applications/luci-app-ledtrig-switch/Makefile15
-rw-r--r--applications/luci-app-ledtrig-switch/htdocs/luci-static/resources/view/system/led-trigger/switch0.js18
-rw-r--r--applications/luci-app-ledtrig-switch/htdocs/luci-static/resources/view/system/led-trigger/switch1.js18
-rw-r--r--applications/luci-app-ledtrig-usbport/Makefile16
-rw-r--r--applications/luci-app-ledtrig-usbport/htdocs/luci-static/resources/view/system/led-trigger/usbport.js46
7 files changed, 167 insertions, 0 deletions
diff --git a/applications/luci-app-ledtrig-rssi/Makefile b/applications/luci-app-ledtrig-rssi/Makefile
new file mode 100644
index 000000000..b3be2065c
--- /dev/null
+++ b/applications/luci-app-ledtrig-rssi/Makefile
@@ -0,0 +1,16 @@
+#
+# Copyright (C) 2020 TDT AG <development@tdt.de>
+#
+# This is free software, licensed under the Apache License Version 2.0.
+# See https://www.apache.org/licenses/LICENSE-2.0 for more information.
+#
+
+include $(TOPDIR)/rules.mk
+
+LUCI_TITLE:= LuCI Support for ledtrigger rssi
+LUCI_DEPENDS:=+rssileds
+LUCI_PKGARCH:=all
+
+include ../../luci.mk
+
+# call BuildPackage - OpenWrt buildroot signature
diff --git a/applications/luci-app-ledtrig-rssi/htdocs/luci-static/resources/view/system/led-trigger/rssi.js b/applications/luci-app-ledtrig-rssi/htdocs/luci-static/resources/view/system/led-trigger/rssi.js
new file mode 100644
index 000000000..611adc8b1
--- /dev/null
+++ b/applications/luci-app-ledtrig-rssi/htdocs/luci-static/resources/view/system/led-trigger/rssi.js
@@ -0,0 +1,38 @@
+'use strict';
+'require form';
+'require tools.widgets as widgets';
+
+return L.Class.extend({
+ trigger: _('rssi (service)'),
+ kernel: false,
+ addFormOptions(s){
+ var o;
+
+ o = s.option(widgets.DeviceSelect, '_rssi_iface', _('Device'));
+ o.rmempty = true;
+ o.ucioption = 'iface';
+ o.modalonly = true;
+ o.noaliases = true;
+ o.depends('trigger', 'rssi');
+
+ o = s.option(form.Value, 'minq', _('Minimal quality'));
+ o.rmempty = true;
+ o.modalonly = true;
+ o.depends('trigger', 'rssi');
+
+ o = s.option(form.Value, 'maxq', _('Maximal quality'));
+ o.rmempty = true;
+ o.modalonly = true;
+ o.depends('trigger', 'rssi');
+
+ o = s.option(form.Value, 'offset', _('Value offset'));
+ o.rmempty = true;
+ o.modalonly = true;
+ o.depends('trigger', 'rssi');
+
+ o = s.option(form.Value, 'factor', _('Multiplication factor'));
+ o.rmempty = true;
+ o.modalonly = true;
+ o.depends('trigger', 'rssi');
+ }
+});
diff --git a/applications/luci-app-ledtrig-switch/Makefile b/applications/luci-app-ledtrig-switch/Makefile
new file mode 100644
index 000000000..7cefc5029
--- /dev/null
+++ b/applications/luci-app-ledtrig-switch/Makefile
@@ -0,0 +1,15 @@
+#
+# Copyright (C) 2020 TDT AG <development@tdt.de>
+#
+# This is free software, licensed under the Apache License Version 2.0.
+# See https://www.apache.org/licenses/LICENSE-2.0 for more information.
+#
+
+include $(TOPDIR)/rules.mk
+
+LUCI_TITLE:= LuCI Support for ledtrigger switch
+LUCI_PKGARCH:=all
+
+include ../../luci.mk
+
+# call BuildPackage - OpenWrt buildroot signature
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 000000000..2f59866a6
--- /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 000000000..7800cba22
--- /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');
+ }
+});
diff --git a/applications/luci-app-ledtrig-usbport/Makefile b/applications/luci-app-ledtrig-usbport/Makefile
new file mode 100644
index 000000000..1a176676f
--- /dev/null
+++ b/applications/luci-app-ledtrig-usbport/Makefile
@@ -0,0 +1,16 @@
+#
+# Copyright (C) 2020 TDT AG <development@tdt.de>
+#
+# This is free software, licensed under the Apache License Version 2.0.
+# See https://www.apache.org/licenses/LICENSE-2.0 for more information.
+#
+
+include $(TOPDIR)/rules.mk
+
+LUCI_TITLE:= LuCI Support for ledtrigger usbport
+LUCI_DEPENDS:=+kmod-usb-ledtrig-usbport
+LUCI_PKGARCH:=all
+
+include ../../luci.mk
+
+# call BuildPackage - OpenWrt buildroot signature
diff --git a/applications/luci-app-ledtrig-usbport/htdocs/luci-static/resources/view/system/led-trigger/usbport.js b/applications/luci-app-ledtrig-usbport/htdocs/luci-static/resources/view/system/led-trigger/usbport.js
new file mode 100644
index 000000000..970016c42
--- /dev/null
+++ b/applications/luci-app-ledtrig-usbport/htdocs/luci-static/resources/view/system/led-trigger/usbport.js
@@ -0,0 +1,46 @@
+'use strict';
+'require rpc';
+'require uci';
+'require form';
+
+var callUSB = rpc.declare({
+ object: 'luci',
+ method: 'getUSBDevices',
+ expect: { 'ports': [] }
+});
+
+return L.Class.extend({
+ trigger: _('usbport (kernel)'),
+ kernel: true,
+ addFormOptions(s){
+ var o;
+
+ o = s.option(form.Value, 'port', _('USB Ports'));
+ o.depends('trigger', 'usbport');
+ o.rmempty = true;
+ o.modalonly = true;
+ o.load = function(s) {
+ return Promise.all([
+ callUSB()
+ ]).then(L.bind(function(usbport){
+ for (var i = 0; i < usbport[0].length; i++)
+ o.value(usbport[0][i].port, _('Port %s').format(usbport[0][i].port));
+ },this));
+ };
+ o.cfgvalue = function(section_id) {
+ var ports = [],
+ value = uci.get('system', section_id, 'port');
+
+ if (!Array.isArray(value))
+ value = String(value || '').split(/\s+/);
+
+ for (var i = 0; i < value.length; i++)
+ if (value[i].match(/^(\d+)-(\d+)$/))
+ ports.push('usb%d-port%d'.format(Regexp.$1, Regexp.$2));
+ else
+ ports.push(value[i]);
+
+ return ports;
+ };
+ }
+});