diff options
author | Jo-Philipp Wich <jo@mein.io> | 2020-02-22 23:26:49 +0100 |
---|---|---|
committer | Jo-Philipp Wich <jo@mein.io> | 2020-02-22 23:26:49 +0100 |
commit | d4a475163e0fd87f5ade7a46b075a119178ae24a (patch) | |
tree | 09f2e6196e7b92fb81190efaa76e8329165e4f43 /applications/luci-app-statistics/htdocs | |
parent | d527c28ffa973e04f1ed3eac9f4a7504404b4fcd (diff) |
luci-app-statistics: clean and fix plugin configurations
- Remove redundant form flags
- Fix various default values
- Add some new collect options and remove options that do not exist anymore
Signed-off-by: Jo-Philipp Wich <jo@mein.io>
Diffstat (limited to 'applications/luci-app-statistics/htdocs')
27 files changed, 64 insertions, 132 deletions
diff --git a/applications/luci-app-statistics/htdocs/luci-static/resources/view/statistics/plugins/apcups.js b/applications/luci-app-statistics/htdocs/luci-static/resources/view/statistics/plugins/apcups.js index d30599442..b4f170c8a 100644 --- a/applications/luci-app-statistics/htdocs/luci-static/resources/view/statistics/plugins/apcups.js +++ b/applications/luci-app-statistics/htdocs/luci-static/resources/view/statistics/plugins/apcups.js @@ -9,7 +9,6 @@ return L.Class.extend({ var o; o = s.option(form.Flag, 'enable', _('Enable this plugin')); - o.default = '0'; o = s.option(form.DynamicList, 'Host', _('Monitor host')); o.default = 'localhost'; diff --git a/applications/luci-app-statistics/htdocs/luci-static/resources/view/statistics/plugins/cpu.js b/applications/luci-app-statistics/htdocs/luci-static/resources/view/statistics/plugins/cpu.js index 71e9c47f3..3a27a67df 100644 --- a/applications/luci-app-statistics/htdocs/luci-static/resources/view/statistics/plugins/cpu.js +++ b/applications/luci-app-statistics/htdocs/luci-static/resources/view/statistics/plugins/cpu.js @@ -9,21 +9,21 @@ return L.Class.extend({ var o; o = s.option(form.Flag, 'enable', _('Enable this plugin')); - o.default = '0'; o = s.option(form.Flag, 'ReportByCpu', _('Report by CPU'), _('By setting this, CPU is not aggregate of all processors on the system')); o.default = '1'; + o.rmempty = false; o.depends('enable', '1'); o = s.option(form.Flag, 'ReportByState', _('Report by state'), _('When set to true, reports per-state metric (system, user, idle)')); o.default = '1'; + o.rmempty = false; o.depends('enable', '1'); o = s.option(form.Flag, 'ValuesPercentage', _('Report in percent'), _('When set to true, we request percentage values')); - o.default = '0'; o.depends({ 'enable': '1', 'ReportByCpu': '1', 'ReportByState': '1' }); }, diff --git a/applications/luci-app-statistics/htdocs/luci-static/resources/view/statistics/plugins/cpufreq.js b/applications/luci-app-statistics/htdocs/luci-static/resources/view/statistics/plugins/cpufreq.js index ab3f69172..d336f97de 100644 --- a/applications/luci-app-statistics/htdocs/luci-static/resources/view/statistics/plugins/cpufreq.js +++ b/applications/luci-app-statistics/htdocs/luci-static/resources/view/statistics/plugins/cpufreq.js @@ -5,22 +5,7 @@ return L.Class.extend({ title: _('CPU Frequency Plugin Configuration'), description: _('This plugin collects statistics about the processor frequency scaling.'), - addFormOptions: function(s) { - var o; - - o = s.option(form.Flag, 'enable', _('Enable this plugin')); - o.default = '0'; - - o = s.option(form.Flag, 'ExtraItems', _('Extra items'), - _('More details about frequency usage and transitions')); - o.default = '0'; - o.optional = true; - o.depends('enable', '1'); - }, - configSummary: function(section) { - return (section.ExtraItems == '1') - ? _('Detailled CPU frequency monitoring enabled') - : _('Simple CPU frequency monitoring enabled'); + return _('CPU frequency monitoring enabled'); } }); diff --git a/applications/luci-app-statistics/htdocs/luci-static/resources/view/statistics/plugins/csv.js b/applications/luci-app-statistics/htdocs/luci-static/resources/view/statistics/plugins/csv.js index 683843ec5..244a07be2 100644 --- a/applications/luci-app-statistics/htdocs/luci-static/resources/view/statistics/plugins/csv.js +++ b/applications/luci-app-statistics/htdocs/luci-static/resources/view/statistics/plugins/csv.js @@ -9,14 +9,12 @@ return L.Class.extend({ var o; o = s.option(form.Flag, 'enable', _('Enable this plugin')); - o.default = '0'; o = s.option(form.Value, 'DataDir', _('Storage directory for the csv files')); - o.default = '127.0.0.1'; + o.default = '/tmp/csv'; o.depends('enable', '1'); o = s.option(form.Flag, 'StoreRates', _('Store data values as rates instead of absolute values')); - o.default = '0'; o.depends('enable', '1'); }, diff --git a/applications/luci-app-statistics/htdocs/luci-static/resources/view/statistics/plugins/curl.js b/applications/luci-app-statistics/htdocs/luci-static/resources/view/statistics/plugins/curl.js index 1ae76f1a8..c49c475c6 100644 --- a/applications/luci-app-statistics/htdocs/luci-static/resources/view/statistics/plugins/curl.js +++ b/applications/luci-app-statistics/htdocs/luci-static/resources/view/statistics/plugins/curl.js @@ -8,7 +8,6 @@ return L.Class.extend({ var o, ss; o = s.option(form.Flag, 'enable', _('Enable this plugin')); - o.default = '0'; o = s.option(form.SectionValue, '__pages', form.TableSection, 'collectd_curl_page'); o.title = _('Fetch pages'); @@ -20,6 +19,7 @@ return L.Class.extend({ o = ss.option(form.Flag, 'enable', _('Enable')); o.default = '1'; + o.rmempty = false; o = ss.option(form.Value, 'name', _('Name')); diff --git a/applications/luci-app-statistics/htdocs/luci-static/resources/view/statistics/plugins/df.js b/applications/luci-app-statistics/htdocs/luci-static/resources/view/statistics/plugins/df.js index 2d317d38f..7b063869b 100644 --- a/applications/luci-app-statistics/htdocs/luci-static/resources/view/statistics/plugins/df.js +++ b/applications/luci-app-statistics/htdocs/luci-static/resources/view/statistics/plugins/df.js @@ -10,7 +10,6 @@ return L.Class.extend({ var o; o = s.option(form.Flag, 'enable', _('Enable this plugin')); - o.default = '0'; o = s.option(form.DynamicList, 'Devices', _('Monitor devices')); o.optional = true; @@ -87,7 +86,6 @@ return L.Class.extend({ }; o = s.option(form.Flag, 'IgnoreSelected', _('Monitor all except specified')); - o.default = '0'; o.depends('enable', '1'); }, diff --git a/applications/luci-app-statistics/htdocs/luci-static/resources/view/statistics/plugins/disk.js b/applications/luci-app-statistics/htdocs/luci-static/resources/view/statistics/plugins/disk.js index a2664d4eb..c737a7dbe 100644 --- a/applications/luci-app-statistics/htdocs/luci-static/resources/view/statistics/plugins/disk.js +++ b/applications/luci-app-statistics/htdocs/luci-static/resources/view/statistics/plugins/disk.js @@ -10,11 +10,9 @@ return L.Class.extend({ var o; o = s.option(form.Flag, 'enable', _('Enable this plugin')); - o.default = '0'; o = s.option(form.DynamicList, 'Disks', _('Monitor disks and partitions'), _('When none selected, all disks will be monitored.')); - o.rmempty = true; o.depends('enable', '1'); o.load = function(section_id) { return fs.trimmed('/proc/partitions').then(L.bind(function(str) { @@ -31,7 +29,6 @@ return L.Class.extend({ }; o = s.option(form.Flag, 'IgnoreSelected', _('Monitor all except specified')); - o.default = '0'; o.depends('enable', '1'); }, diff --git a/applications/luci-app-statistics/htdocs/luci-static/resources/view/statistics/plugins/dns.js b/applications/luci-app-statistics/htdocs/luci-static/resources/view/statistics/plugins/dns.js index bdca0d65e..27b08cf39 100644 --- a/applications/luci-app-statistics/htdocs/luci-static/resources/view/statistics/plugins/dns.js +++ b/applications/luci-app-statistics/htdocs/luci-static/resources/view/statistics/plugins/dns.js @@ -10,7 +10,6 @@ return L.Class.extend({ var o; o = s.option(form.Flag, 'enable', _('Enable this plugin')); - o.default = '0'; o = s.option(widgets.DeviceSelect, 'Interfaces', _('Monitor interfaces'), _('When none selected, all interfaces will be monitored.')); diff --git a/applications/luci-app-statistics/htdocs/luci-static/resources/view/statistics/plugins/email.js b/applications/luci-app-statistics/htdocs/luci-static/resources/view/statistics/plugins/email.js index 2e0c6340f..5306dd4ce 100644 --- a/applications/luci-app-statistics/htdocs/luci-static/resources/view/statistics/plugins/email.js +++ b/applications/luci-app-statistics/htdocs/luci-static/resources/view/statistics/plugins/email.js @@ -10,7 +10,6 @@ return L.Class.extend({ var o; o = s.option(form.Flag, 'enable', _('Enable this plugin')); - o.default = '0'; o = s.option(form.Value, 'SocketFile', _('Socket file')); o.default = '/var/run/collect-email.sock'; @@ -19,13 +18,11 @@ return L.Class.extend({ o = s.option(widgets.GroupSelect, 'SocketGroup', _('Socket group')); o.default = 'nogroup'; o.optional = true; - o.rmempty = true; o.depends('enable', '1'); o = s.option(form.Value, 'SocketPerms', _('Socket permissions')); o.default = '0770'; o.optional = true; - o.rmempty = true; o.depends('enable', '1'); o.validate = function(section_id, v) { if (v == '') @@ -41,7 +38,6 @@ return L.Class.extend({ o.datatype = 'range(1,16384)'; o.default = '5'; o.optional = true; - o.rmempty = true; o.depends('enable', '1'); }, diff --git a/applications/luci-app-statistics/htdocs/luci-static/resources/view/statistics/plugins/exec.js b/applications/luci-app-statistics/htdocs/luci-static/resources/view/statistics/plugins/exec.js index 093f3fddb..ff1a5a0ad 100644 --- a/applications/luci-app-statistics/htdocs/luci-static/resources/view/statistics/plugins/exec.js +++ b/applications/luci-app-statistics/htdocs/luci-static/resources/view/statistics/plugins/exec.js @@ -10,7 +10,6 @@ return L.Class.extend({ var o, ss; o = s.option(form.Flag, 'enable', _('Enable this plugin')); - o.default = '0'; o = s.option(form.SectionValue, '__input', form.TableSection, 'collectd_exec_input'); o.title = _('Add command for reading values'); @@ -27,12 +26,10 @@ return L.Class.extend({ o = ss.option(widgets.UserSelect, 'cmduser', _('User')); o.default = 'nobody'; o.optional = true; - o.rmempty = true; o = ss.option(widgets.GroupSelect, 'cmdgroup', _('Group')); o.default = 'nogroup'; o.optional = true; - o.rmempty = true; o = s.option(form.SectionValue, '__notify', form.TableSection, 'collectd_exec_notify'); o.title = _('Add notification command'); @@ -49,12 +46,10 @@ return L.Class.extend({ o = ss.option(widgets.UserSelect, 'cmduser', _('User')); o.default = 'nobody'; o.optional = true; - o.rmempty = true; o = ss.option(widgets.GroupSelect, 'cmdgroup', _('Group')); o.default = 'nogroup'; o.optional = true; - o.rmempty = true; }, configSummary: function(section) { diff --git a/applications/luci-app-statistics/htdocs/luci-static/resources/view/statistics/plugins/interface.js b/applications/luci-app-statistics/htdocs/luci-static/resources/view/statistics/plugins/interface.js index 178b510a2..1d60d644f 100644 --- a/applications/luci-app-statistics/htdocs/luci-static/resources/view/statistics/plugins/interface.js +++ b/applications/luci-app-statistics/htdocs/luci-static/resources/view/statistics/plugins/interface.js @@ -10,7 +10,6 @@ return L.Class.extend({ var o; o = s.option(form.Flag, 'enable', _('Enable this plugin')); - o.default = '0'; o = s.option(widgets.DeviceSelect, 'Interfaces', _('Monitor interfaces')); o.multiple = true; @@ -18,7 +17,6 @@ return L.Class.extend({ o.depends('enable', '1'); o = s.option(form.Flag, 'IgnoreSelected', _('Monitor all except specified')); - o.default = '0'; o.depends('enable', '1'); }, diff --git a/applications/luci-app-statistics/htdocs/luci-static/resources/view/statistics/plugins/iptables.js b/applications/luci-app-statistics/htdocs/luci-static/resources/view/statistics/plugins/iptables.js index 00d0ec88f..34b75f928 100644 --- a/applications/luci-app-statistics/htdocs/luci-static/resources/view/statistics/plugins/iptables.js +++ b/applications/luci-app-statistics/htdocs/luci-static/resources/view/statistics/plugins/iptables.js @@ -11,7 +11,6 @@ return L.Class.extend({ var o, ss; o = s.option(form.Flag, 'enable', _('Enable this plugin')); - o.default = '0'; for (var family = 4; family <= 6; family += 2) { var suffix = (family == 4 ? '' : '6'); @@ -85,7 +84,6 @@ return L.Class.extend({ o = ss.option(form.Value, 'table', _('Table')); o.default = 'filter'; o.optional = true; - o.rmempty = true; o.transformChoices = function() { return this.super('transformChoices', []) || {} }; o.validate = function(section_id, table) { var chain_opt = this.section.children.filter(function(o) { return o.option == 'chain' })[0], @@ -99,7 +97,6 @@ return L.Class.extend({ o = ss.option(form.Value, 'chain', _('Chain')); o.optional = true; - o.rmempty = true; o.transformChoices = function() { return this.super('transformChoices', []) || {} }; o.validate = function(section_id, chain) { var table_opt = this.section.children.filter(function(o) { return o.option == 'table' })[0], @@ -138,7 +135,6 @@ return L.Class.extend({ o = ss.option(form.Value, 'rule', _('Comment / Rule Number')); o.optional = true; - o.rmempty = true; o.transformChoices = function() { return this.super('transformChoices', []) || {} }; o.load = function(section_id) { var table = uci.get('luci_statistics', section_id, 'table'), diff --git a/applications/luci-app-statistics/htdocs/luci-static/resources/view/statistics/plugins/irq.js b/applications/luci-app-statistics/htdocs/luci-static/resources/view/statistics/plugins/irq.js index 073b9008a..f6bac0872 100644 --- a/applications/luci-app-statistics/htdocs/luci-static/resources/view/statistics/plugins/irq.js +++ b/applications/luci-app-statistics/htdocs/luci-static/resources/view/statistics/plugins/irq.js @@ -10,7 +10,6 @@ return L.Class.extend({ var o; o = s.option(form.Flag, 'enable', _('Enable this plugin')); - o.default = '0'; o = s.option(form.DynamicList, 'Irqs', _('Monitor interrupts')); o.optional = true; @@ -41,8 +40,6 @@ return L.Class.extend({ }; o = s.option(form.Flag, 'IgnoreSelected', _('Monitor all except specified')); - o.default = '0'; - o.optional = 'true'; o.depends('enable', '1'); }, diff --git a/applications/luci-app-statistics/htdocs/luci-static/resources/view/statistics/plugins/iwinfo.js b/applications/luci-app-statistics/htdocs/luci-static/resources/view/statistics/plugins/iwinfo.js index 5f9f73ad3..3f9987236 100644 --- a/applications/luci-app-statistics/htdocs/luci-static/resources/view/statistics/plugins/iwinfo.js +++ b/applications/luci-app-statistics/htdocs/luci-static/resources/view/statistics/plugins/iwinfo.js @@ -10,7 +10,6 @@ return L.Class.extend({ var o; o = s.option(form.Flag, 'enable', _('Enable this plugin')); - o.default = '0'; o = s.option(widgets.DeviceSelect, 'Interfaces', _('Monitor interfaces'), _('Leave unselected to automatically determine interfaces to monitor.')); o.multiple = true; @@ -23,7 +22,6 @@ return L.Class.extend({ }; o = s.option(form.Flag, 'IgnoreSelected', _('Monitor all except specified')); - o.default = '0'; o.depends('enable', '1'); }, diff --git a/applications/luci-app-statistics/htdocs/luci-static/resources/view/statistics/plugins/memory.js b/applications/luci-app-statistics/htdocs/luci-static/resources/view/statistics/plugins/memory.js index cba3a7bdf..fdd55f0cf 100644 --- a/applications/luci-app-statistics/htdocs/luci-static/resources/view/statistics/plugins/memory.js +++ b/applications/luci-app-statistics/htdocs/luci-static/resources/view/statistics/plugins/memory.js @@ -9,18 +9,12 @@ return L.Class.extend({ var o; o = s.option(form.Flag, 'enable', _('Enable this plugin')); - o.default = '0'; - o = s.option(form.Flag, 'ValuesAbsolute', _('Absolute values'), - _('When set to true, we request absolute values')); + o = s.option(form.Flag, 'ValuesAbsolute', _('Absolute values'), _('When set to true, we request absolute values')); o.default = '1'; - o.optional = false; o.depends('enable', '1'); - o = s.option(form.Flag, 'ValuesPercentage', _('Percent values'), - _('When set to true, we request percentage values')); - o.default = '0'; - o.optional = false; + o = s.option(form.Flag, 'ValuesPercentage', _('Percent values'), _('When set to true, we request percentage values')); o.depends('enable', '1'); }, diff --git a/applications/luci-app-statistics/htdocs/luci-static/resources/view/statistics/plugins/netlink.js b/applications/luci-app-statistics/htdocs/luci-static/resources/view/statistics/plugins/netlink.js index ab5163275..3797b690a 100644 --- a/applications/luci-app-statistics/htdocs/luci-static/resources/view/statistics/plugins/netlink.js +++ b/applications/luci-app-statistics/htdocs/luci-static/resources/view/statistics/plugins/netlink.js @@ -38,7 +38,6 @@ return L.Class.extend({ o.depends('enable', '1'); o = s.option(form.Flag, 'IgnoreSelected', _('Monitor all except specified')); - o.default = '0'; o.depends('enable', '1'); }, diff --git a/applications/luci-app-statistics/htdocs/luci-static/resources/view/statistics/plugins/network.js b/applications/luci-app-statistics/htdocs/luci-static/resources/view/statistics/plugins/network.js index 5fd42ab1e..5419e6d34 100644 --- a/applications/luci-app-statistics/htdocs/luci-static/resources/view/statistics/plugins/network.js +++ b/applications/luci-app-statistics/htdocs/luci-static/resources/view/statistics/plugins/network.js @@ -12,21 +12,19 @@ return L.Class.extend({ o.default = '0'; o = s.option(form.Value, 'TimeToLive', _('TTL for network packets')); - o.default = '128'; - o.datatype = 'range(0, 255)'; - o.optional = true; + o.placeholder = '1'; + o.datatype = 'range(1, 255)'; o.depends('enable', '1'); - o = s.option(form.Flag, 'Forward', _('Forwarding between listen and server addresses')); - o.default = '0'; - o.optional = true; + o = s.option(form.Value, 'MaxPacketSize', _('Maximum packet size'), _('Set the maximum size for datagrams sent over the network')); + o.placeholder = '1452'; + o.datatype = 'range(1024, 65535)'; + o.depends('enable', '1'); + + o = s.option(form.Flag, 'Forward', _('Enable forwarding'), _('Forwarding between listen and server addresses')); o.depends('enable', '1'); - o = s.option(form.Value, 'CacheFlush', _('Cache flush interval'), - _('Seconds')); - o.default = '86400'; - o.datatype = 'uinteger'; - o.optional = true; + o = s.option(form.Flag, 'ReportStats', _('Enable statistics'), _('Create statistics about the network plugin itself')); o.depends('enable', '1'); o = s.option(form.SectionValue, '__listeners', form.TableSection, 'collectd_network_listen'); diff --git a/applications/luci-app-statistics/htdocs/luci-static/resources/view/statistics/plugins/nut.js b/applications/luci-app-statistics/htdocs/luci-static/resources/view/statistics/plugins/nut.js index 09845dd3b..7148ed112 100644 --- a/applications/luci-app-statistics/htdocs/luci-static/resources/view/statistics/plugins/nut.js +++ b/applications/luci-app-statistics/htdocs/luci-static/resources/view/statistics/plugins/nut.js @@ -9,10 +9,8 @@ return L.Class.extend({ var o; o = s.option(form.Flag, 'enable', _('Enable this plugin')); - o.default = '0'; o = s.option(form.Value, 'UPS', _('UPS'), _('UPS name in NUT ups@host format')); - o.rmempty = true; }, configSummary: function(section) { diff --git a/applications/luci-app-statistics/htdocs/luci-static/resources/view/statistics/plugins/olsrd.js b/applications/luci-app-statistics/htdocs/luci-static/resources/view/statistics/plugins/olsrd.js index 72cce1265..973c0858f 100644 --- a/applications/luci-app-statistics/htdocs/luci-static/resources/view/statistics/plugins/olsrd.js +++ b/applications/luci-app-statistics/htdocs/luci-static/resources/view/statistics/plugins/olsrd.js @@ -9,16 +9,13 @@ return L.Class.extend({ var o; o = s.option(form.Flag, 'enable', _('Enable this plugin')); - o.default = '0'; o = s.option(form.Value, 'Host', _('Host'), _('IP or hostname where to get the txtinfo output from')); o.datatype = 'host'; - o.rmempty = true; o = s.option(form.Value, 'Port', _('Port')); o.datatype = 'port'; - o.rmempty = true; o = s.option(form.ListValue, 'CollectLinks', _('CollectLinks'), _('Specifies what information to collect about links.')); diff --git a/applications/luci-app-statistics/htdocs/luci-static/resources/view/statistics/plugins/openvpn.js b/applications/luci-app-statistics/htdocs/luci-static/resources/view/statistics/plugins/openvpn.js index 882fc4c34..b3e4f1933 100644 --- a/applications/luci-app-statistics/htdocs/luci-static/resources/view/statistics/plugins/openvpn.js +++ b/applications/luci-app-statistics/htdocs/luci-static/resources/view/statistics/plugins/openvpn.js @@ -10,30 +10,20 @@ return L.Class.extend({ var o; o = s.option(form.Flag, 'enable', _('Enable this plugin')); - o.default = '0'; o = s.option(form.Flag, 'CollectIndividualUsers', _('Generate a separate graph for each logged user')); - o.default = '0'; - o.rmempty = true; o.depends('enable', '1'); o = s.option(form.Flag, 'CollectUserCount', _('Aggregate number of connected users')); - o.default = '0'; - o.rmempty = true; o.depends('enable', '1'); o = s.option(form.Flag, 'CollectCompression', _('Gather compression statistics')); - o.default = '0'; - o.rmempty = true; o.depends('enable', '1'); o = s.option(form.Flag, 'ImprovedNamingSchema', _('Use improved naming schema')); - o.default = '0'; - o.rmempty = true; o.depends('enable', '1'); o = s.option(form.DynamicList, 'StatusFile', _('OpenVPN status files')); - o.rmempty = true; o.depends('enable', '1'); o.load = function(section_id) { return L.resolveDefault(fs.list('/var/run'), []).then(L.bind(function(entries) { diff --git a/applications/luci-app-statistics/htdocs/luci-static/resources/view/statistics/plugins/ping.js b/applications/luci-app-statistics/htdocs/luci-static/resources/view/statistics/plugins/ping.js index 62958e848..07f0f5094 100644 --- a/applications/luci-app-statistics/htdocs/luci-static/resources/view/statistics/plugins/ping.js +++ b/applications/luci-app-statistics/htdocs/luci-static/resources/view/statistics/plugins/ping.js @@ -9,7 +9,6 @@ return L.Class.extend({ var o; o = s.option(form.Flag, 'enable', _('Enable this plugin')); - o.default = '0'; o = s.option(form.DynamicList, 'Hosts', _('Monitor hosts')); o.default = '127.0.0.1'; diff --git a/applications/luci-app-statistics/htdocs/luci-static/resources/view/statistics/plugins/processes.js b/applications/luci-app-statistics/htdocs/luci-static/resources/view/statistics/plugins/processes.js index fe2bbccd9..e2331998a 100644 --- a/applications/luci-app-statistics/htdocs/luci-static/resources/view/statistics/plugins/processes.js +++ b/applications/luci-app-statistics/htdocs/luci-static/resources/view/statistics/plugins/processes.js @@ -9,7 +9,6 @@ return L.Class.extend({ var o; o = s.option(form.Flag, 'enable', _('Enable this plugin')); - o.default = '0'; o = s.option(form.DynamicList, 'Processes', _('Monitor processes')); o.default = 'uhttpd dropbear dnsmasq'; diff --git a/applications/luci-app-statistics/htdocs/luci-static/resources/view/statistics/plugins/rrdtool.js b/applications/luci-app-statistics/htdocs/luci-static/resources/view/statistics/plugins/rrdtool.js index 82688cac6..6e0b8e6a2 100644 --- a/applications/luci-app-statistics/htdocs/luci-static/resources/view/statistics/plugins/rrdtool.js +++ b/applications/luci-app-statistics/htdocs/luci-static/resources/view/statistics/plugins/rrdtool.js @@ -9,44 +9,33 @@ return L.Class.extend({ var o; o = s.option(form.Flag, 'enable', _('Enable this plugin')); - o.default = '0'; o = s.option(form.Value, 'DataDir', _('Storage directory'), _('Note: as pages are rendered by user \'nobody\', the *.rrd files, the storage directory and all its parent directories need to be world readable.')); - o.default = '/tmp'; - o.optional = true; - o.rmempty = true; + o.default = '/tmp/rrd'; o.depends('enable', '1'); - o = s.option(form.Value, 'StepSize', _('RRD step interval'), - _('Seconds')); - o.default = '30'; - o.optional = true; - o.rmempty = true; + o = s.option(form.Value, 'StepSize', _('RRD step interval'), _('Seconds')); + o.placeholder = '30'; + o.datatype = 'uinteger'; o.depends('enable', '1'); - o = s.option(form.Value, 'HeartBeat', _('RRD heart beat interval'), - _('Seconds')); - o.default = '60'; - o.optional = true; - o.rmempty = true; + o = s.option(form.Value, 'HeartBeat', _('RRD heart beat interval'), _('Seconds')); + o.placeholder = '60'; + o.datatype = 'uinteger'; o.depends('enable', '1'); - o = s.option(form.Flag, 'RRASingle', _('Only create average RRAs'), - _('reduces rrd size')); - o.default = 'true'; + o = s.option(form.Flag, 'RRASingle', _('Only create average RRAs'), _('reduces rrd size')); + o.default = '1'; + o.rmempty = false; o.depends('enable', '1'); o = s.option(form.Flag, 'RRAMax', _('Show max values instead of averages'), _('Max values for a period can be used instead of averages when not using \'only average RRAs\'')); - o.default = 'false'; - o.rmempty = true; o.depends('RRASingle', '0'); o = s.option(form.DynamicList, 'RRATimespans', _('Stored timespans')); o.default = '10min 1day 1week 1month 1year'; - o.optional = true; - o.rmempty = true; o.depends('enable', '1'); o.validate = function(section_id, value) { if (value == '') @@ -59,30 +48,46 @@ return L.Class.extend({ }; o = s.option(form.Value, 'RRARows', _('Rows per RRA')); - o.default = '100'; - o.optional = true; - o.rmempty = true; + o.placeholder = '1200'; + o.datatype = 'min(1)'; o.depends('enable', '1'); o = s.option(form.Value, 'XFF', _('RRD XFiles Factor')); - o.default = '0.1'; - o.optional = true; - o.rmempty = true; + o.placeholder = '0.1'; o.depends('enable', '1'); + o.validate = function(section_id, value) { + if (value == '') + return true; + + if (value.match(/^[0-9]+(?:\.[0-9]+)?$/) && +value >= 0 && +value < 1) + return true; - o = s.option(form.Value, 'CacheTimeout', _('Cache collected data for'), - _('Seconds')); - o.default = '100'; - o.optional = true; - o.rmempty = true; + return _('Expecting decimal value lower than one'); + }; + + o = s.option(form.Value, 'CacheTimeout', _('Cache collected data for'), _('Seconds')); o.depends('enable', '1'); + o.datatype = 'uinteger'; + o.placeholder = '0'; + o.validate = function(section_id, value) { + var flushinp = this.map.findElement('id', 'widget.cbid.luci_statistics.collectd_rrdtool.CacheFlush'); + + if (value != '' && !isNaN(value) && +value > 0) { + flushinp.placeholder = 10 * +value; + flushinp.disabled = false; + } + else { + flushinp.value = ''; + flushinp.placeholder = '0'; + flushinp.disabled = true; + } + + return true; + }; - o = s.option(form.Value, 'CacheFlush', _('Flush cache after'), - _('Seconds')); - o.default = '100'; - o.optional = true; - o.rmempty = true; + o = s.option(form.Value, 'CacheFlush', _('Flush cache after'), _('Seconds')); o.depends('enable', '1'); + o.datatype = 'uinteger'; }, configSummary: function(section) { diff --git a/applications/luci-app-statistics/htdocs/luci-static/resources/view/statistics/plugins/sensors.js b/applications/luci-app-statistics/htdocs/luci-static/resources/view/statistics/plugins/sensors.js index 0cf848253..cda59a2a9 100644 --- a/applications/luci-app-statistics/htdocs/luci-static/resources/view/statistics/plugins/sensors.js +++ b/applications/luci-app-statistics/htdocs/luci-static/resources/view/statistics/plugins/sensors.js @@ -18,7 +18,6 @@ return L.Class.extend({ var o; o = s.option(form.Flag, 'enable', _('Enable this plugin')); - o.default = '0'; o = s.option(form.DynamicList, 'Sensor', _('Sensor list')); o.rmempty = true; @@ -45,8 +44,6 @@ return L.Class.extend({ }; o = s.option(form.Flag, 'IgnoreSelected', _('Monitor all except specified')); - o.default = '0'; - o.rmempty = true; o.depends('enable', '1'); }, diff --git a/applications/luci-app-statistics/htdocs/luci-static/resources/view/statistics/plugins/tcpconns.js b/applications/luci-app-statistics/htdocs/luci-static/resources/view/statistics/plugins/tcpconns.js index 2040f86bc..916241879 100644 --- a/applications/luci-app-statistics/htdocs/luci-static/resources/view/statistics/plugins/tcpconns.js +++ b/applications/luci-app-statistics/htdocs/luci-static/resources/view/statistics/plugins/tcpconns.js @@ -9,18 +9,20 @@ return L.Class.extend({ var o; o = s.option(form.Flag, 'enable', _('Enable this plugin')); - o.default = '0'; o = s.option(form.Flag, 'ListeningPorts', _('Monitor all local listen ports')); - o.default = '1'; o.depends('enable', '1'); + o.rmempty = false; + o.default = '1'; - o = s.option(form.Value, 'LocalPorts', _('Monitor local ports')); + o = s.option(form.DynamicList, 'LocalPorts', _('Monitor local ports')); o.optional = true; + o.datatype = 'port'; o.depends({ enable: '1', ListeningPorts: '0' }); - o = s.option(form.Value, 'RemotePorts', _('Monitor remote ports')); + o = s.option(form.DynamicList, 'RemotePorts', _('Monitor remote ports')); o.optional = true; + o.datatype = 'port'; o.depends({ enable: '1', ListeningPorts: '0' }); }, diff --git a/applications/luci-app-statistics/htdocs/luci-static/resources/view/statistics/plugins/thermal.js b/applications/luci-app-statistics/htdocs/luci-static/resources/view/statistics/plugins/thermal.js index bd83944b4..c2def4609 100644 --- a/applications/luci-app-statistics/htdocs/luci-static/resources/view/statistics/plugins/thermal.js +++ b/applications/luci-app-statistics/htdocs/luci-static/resources/view/statistics/plugins/thermal.js @@ -10,7 +10,6 @@ return L.Class.extend({ var o; o = s.option(form.Flag, 'enable', _('Enable this plugin')); - o.default = '0'; o = s.option(form.DynamicList, 'Device', _('Monitor device(s) / thermal zone(s)'), _('Empty value = monitor all')); o.load = function(section_id) { diff --git a/applications/luci-app-statistics/htdocs/luci-static/resources/view/statistics/plugins/unixsock.js b/applications/luci-app-statistics/htdocs/luci-static/resources/view/statistics/plugins/unixsock.js index 1cbdb5f86..c2f33a0a1 100644 --- a/applications/luci-app-statistics/htdocs/luci-static/resources/view/statistics/plugins/unixsock.js +++ b/applications/luci-app-statistics/htdocs/luci-static/resources/view/statistics/plugins/unixsock.js @@ -10,7 +10,6 @@ return L.Class.extend({ var o; o = s.option(form.Flag, 'enable', _('Enable this plugin')); - o.default = '0'; o = s.option(form.Value, 'SocketFile', _('Socket path')); o.default = '/var/run/collect-query.socket'; |