summaryrefslogtreecommitdiffhomepage
path: root/modules/luci-mod-system/htdocs/luci-static/resources/view/system
diff options
context:
space:
mode:
authorFlorian Eckert <fe@dev.tdt.de>2021-10-28 15:47:44 +0200
committerGitHub <noreply@github.com>2021-10-28 15:47:44 +0200
commitb710c4a843d742b89b0d4df1fc730a5362d382b1 (patch)
tree9d9952516876dff448ea5442892ff65938c2ad2c /modules/luci-mod-system/htdocs/luci-static/resources/view/system
parentad360ec00a3667d530fa1a911ac19515b132d588 (diff)
parent5b42cd5b46c32bf168b7156602bfa0ba841904a1 (diff)
Merge pull request #5328 from TDT-AG/pr/20210903-luci-mod-system
luci-mod-system: add led-trigger description
Diffstat (limited to 'modules/luci-mod-system/htdocs/luci-static/resources/view/system')
-rw-r--r--modules/luci-mod-system/htdocs/luci-static/resources/view/system/led-trigger/default-on.js11
-rw-r--r--modules/luci-mod-system/htdocs/luci-static/resources/view/system/led-trigger/heartbeat.js2
-rw-r--r--modules/luci-mod-system/htdocs/luci-static/resources/view/system/led-trigger/netdev.js1
-rw-r--r--modules/luci-mod-system/htdocs/luci-static/resources/view/system/led-trigger/none.js11
-rw-r--r--modules/luci-mod-system/htdocs/luci-static/resources/view/system/led-trigger/timer.js9
-rw-r--r--modules/luci-mod-system/htdocs/luci-static/resources/view/system/leds.js29
6 files changed, 46 insertions, 17 deletions
diff --git a/modules/luci-mod-system/htdocs/luci-static/resources/view/system/led-trigger/default-on.js b/modules/luci-mod-system/htdocs/luci-static/resources/view/system/led-trigger/default-on.js
index ba7b00ede3..2de2743e4c 100644
--- a/modules/luci-mod-system/htdocs/luci-static/resources/view/system/led-trigger/default-on.js
+++ b/modules/luci-mod-system/htdocs/luci-static/resources/view/system/led-trigger/default-on.js
@@ -4,18 +4,9 @@
return baseclass.extend({
trigger: _('Always on (kernel: default-on)'),
+ description: _('The LED is always in default state on.'),
kernel: true,
addFormOptions(s){
var o;
-
- o = s.option(form.Flag, 'default', _('Default state'));
- o.rmempty = false;
- o.depends('trigger', 'default-on');
- o.textvalue = function(section_id) {
- var cval = this.cfgvalue(section_id);
- if (cval == null)
- cval = this.default;
- return (cval == this.enabled) ? _('On') : _('Off');
- };
}
});
diff --git a/modules/luci-mod-system/htdocs/luci-static/resources/view/system/led-trigger/heartbeat.js b/modules/luci-mod-system/htdocs/luci-static/resources/view/system/led-trigger/heartbeat.js
index 9050063bf2..1a6eeebd2c 100644
--- a/modules/luci-mod-system/htdocs/luci-static/resources/view/system/led-trigger/heartbeat.js
+++ b/modules/luci-mod-system/htdocs/luci-static/resources/view/system/led-trigger/heartbeat.js
@@ -3,6 +3,8 @@
return baseclass.extend({
trigger: _('Heartbeat interval (kernel: heartbeat)'),
+ description: _('The LED flashes to simulate actual heart beat.') +
+ _('The frequency is in direct proportion to 1-minute average CPU load.'),
kernel: true,
addFormOptions(s){
var o;
diff --git a/modules/luci-mod-system/htdocs/luci-static/resources/view/system/led-trigger/netdev.js b/modules/luci-mod-system/htdocs/luci-static/resources/view/system/led-trigger/netdev.js
index 692c887ea4..af70f449d2 100644
--- a/modules/luci-mod-system/htdocs/luci-static/resources/view/system/led-trigger/netdev.js
+++ b/modules/luci-mod-system/htdocs/luci-static/resources/view/system/led-trigger/netdev.js
@@ -5,6 +5,7 @@
return baseclass.extend({
trigger: _("Network device activity (kernel: netdev)"),
+ description: _('The LED flashes with link status and activity on the configured interface.'),
kernel: true,
addFormOptions(s){
var o;
diff --git a/modules/luci-mod-system/htdocs/luci-static/resources/view/system/led-trigger/none.js b/modules/luci-mod-system/htdocs/luci-static/resources/view/system/led-trigger/none.js
index ef21adc7dc..4b96cf087a 100644
--- a/modules/luci-mod-system/htdocs/luci-static/resources/view/system/led-trigger/none.js
+++ b/modules/luci-mod-system/htdocs/luci-static/resources/view/system/led-trigger/none.js
@@ -3,8 +3,19 @@
return baseclass.extend({
trigger: _('Always off (kernel: none)'),
+ description: _('The LED is always in default state off.'),
kernel: true,
addFormOptions(s){
var o;
+
+ o = s.option(form.Flag, 'default', _('Default state'));
+ o.rmempty = false;
+ o.depends('trigger', 'none');
+ o.textvalue = function(section_id) {
+ var cval = this.cfgvalue(section_id);
+ if (cval == null)
+ cval = this.default;
+ return (cval == this.enabled) ? _('On') : _('Off');
+ };
}
});
diff --git a/modules/luci-mod-system/htdocs/luci-static/resources/view/system/led-trigger/timer.js b/modules/luci-mod-system/htdocs/luci-static/resources/view/system/led-trigger/timer.js
index 1ec362b601..6213604a1a 100644
--- a/modules/luci-mod-system/htdocs/luci-static/resources/view/system/led-trigger/timer.js
+++ b/modules/luci-mod-system/htdocs/luci-static/resources/view/system/led-trigger/timer.js
@@ -4,15 +4,20 @@
return baseclass.extend({
trigger: _('Custom flash interval (kernel: timer)'),
+ description: _('The LED blinks with the configured on/off frequency'),
kernel: true,
addFormOptions(s){
var o;
- o = s.option(form.Value, 'delayon', _('On-State Delay'));
+ o = s.option(form.Value, 'delayon', _('On-State Delay'),
+ _('How long (in milliseconds) the LED should be on')
+ );
o.modalonly = true;
o.depends('trigger', 'timer');
- o = s.option(form.Value, 'delayoff', _('Off-State Delay'));
+ o = s.option(form.Value, 'delayoff', _('Off-State Delay'),
+ _('How long (in milliseconds) the LED should be off')
+ );
o.modalonly = true;
o.depends('trigger', 'timer');
}
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 23feebc005..c0cbd7a4f1 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
@@ -63,6 +63,7 @@ return view.extend({
s.addremove = true;
s.sortable = true;
s.addbtntitle = _('Add LED action');
+ s.nodescriptions = true;
s.option(form.Value, 'name', _('Name'));
@@ -75,13 +76,31 @@ return view.extend({
for (var i = 0; i < plugins.length; i++) {
var plugin = plugins[i];
- if ( plugin.form.kernel == false )
+ if ( plugin.form.kernel == false ) {
o.value(plugin.name, plugin.form.trigger);
- else
- for (var k = 0; k < triggers.length; k++)
- if ( plugin.name == triggers[k] )
- o.value(plugin.name, plugin.form.trigger);
+ }
+ else {
+ if (triggers.indexOf(plugin.name) >= 0)
+ o.value(plugin.name, plugin.form.trigger);
+ }
+ }
+ o.onchange = function(ev, section, value) {
+ for (var i = 0; i < plugins.length; i++) {
+ var plugin = plugins[i];
+ if ( plugin.name === value )
+ this.map.findElement('id', 'cbid.system.%s.trigger'.format(section))
+ .nextElementSibling.innerHTML = plugin.form.description || '';
+ }
}
+ o.load = function(section_id) {
+ var trigger = uci.get('system', section_id, 'trigger');
+ for (var i = 0; i < plugins.length; i++) {
+ var plugin = plugins[i];
+ if ( plugin.name === trigger)
+ this.description = plugin.form.description || '';
+ }
+ return trigger;
+ };
s.addModalOptions = function(s) {
for (var i = 0; i < plugins.length; i++) {