luci-app-statistics: clean and fix plugin configurations
authorJo-Philipp Wich <jo@mein.io>
Sat, 22 Feb 2020 22:26:49 +0000 (23:26 +0100)
committerJo-Philipp Wich <jo@mein.io>
Sat, 22 Feb 2020 22:26:49 +0000 (23:26 +0100)
 - 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>
28 files changed:
applications/luci-app-statistics/htdocs/luci-static/resources/view/statistics/plugins/apcups.js
applications/luci-app-statistics/htdocs/luci-static/resources/view/statistics/plugins/cpu.js
applications/luci-app-statistics/htdocs/luci-static/resources/view/statistics/plugins/cpufreq.js
applications/luci-app-statistics/htdocs/luci-static/resources/view/statistics/plugins/csv.js
applications/luci-app-statistics/htdocs/luci-static/resources/view/statistics/plugins/curl.js
applications/luci-app-statistics/htdocs/luci-static/resources/view/statistics/plugins/df.js
applications/luci-app-statistics/htdocs/luci-static/resources/view/statistics/plugins/disk.js
applications/luci-app-statistics/htdocs/luci-static/resources/view/statistics/plugins/dns.js
applications/luci-app-statistics/htdocs/luci-static/resources/view/statistics/plugins/email.js
applications/luci-app-statistics/htdocs/luci-static/resources/view/statistics/plugins/exec.js
applications/luci-app-statistics/htdocs/luci-static/resources/view/statistics/plugins/interface.js
applications/luci-app-statistics/htdocs/luci-static/resources/view/statistics/plugins/iptables.js
applications/luci-app-statistics/htdocs/luci-static/resources/view/statistics/plugins/irq.js
applications/luci-app-statistics/htdocs/luci-static/resources/view/statistics/plugins/iwinfo.js
applications/luci-app-statistics/htdocs/luci-static/resources/view/statistics/plugins/memory.js
applications/luci-app-statistics/htdocs/luci-static/resources/view/statistics/plugins/netlink.js
applications/luci-app-statistics/htdocs/luci-static/resources/view/statistics/plugins/network.js
applications/luci-app-statistics/htdocs/luci-static/resources/view/statistics/plugins/nut.js
applications/luci-app-statistics/htdocs/luci-static/resources/view/statistics/plugins/olsrd.js
applications/luci-app-statistics/htdocs/luci-static/resources/view/statistics/plugins/openvpn.js
applications/luci-app-statistics/htdocs/luci-static/resources/view/statistics/plugins/ping.js
applications/luci-app-statistics/htdocs/luci-static/resources/view/statistics/plugins/processes.js
applications/luci-app-statistics/htdocs/luci-static/resources/view/statistics/plugins/rrdtool.js
applications/luci-app-statistics/htdocs/luci-static/resources/view/statistics/plugins/sensors.js
applications/luci-app-statistics/htdocs/luci-static/resources/view/statistics/plugins/tcpconns.js
applications/luci-app-statistics/htdocs/luci-static/resources/view/statistics/plugins/thermal.js
applications/luci-app-statistics/htdocs/luci-static/resources/view/statistics/plugins/unixsock.js
applications/luci-app-statistics/root/usr/bin/stat-genconfig

index d3059944285c86ab04a3ed47e8e98b722cb6af94..b4f170c8a721883112e990c6913d85818a1759e7 100644 (file)
@@ -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';
index 71e9c47f3c317cea8e0e6377bb2033ed81246b25..3a27a67dfe3a75814634ba27ab9c7d415f426381 100644 (file)
@@ -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' });
        },
 
index ab3f69172cc9764463381ec837d92d2d04dc0ab0..d336f97dea024d7277a78efbcb83aca94c9a06a7 100644 (file)
@@ -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');
        }
 });
index 683843ec564e73b887f5396568a5b6e208134d13..244a07be27a5f643245f29a2742e5264f5e08eeb 100644 (file)
@@ -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');
        },
 
index 1ae76f1a8cb0fcc25f7da6498e977a74ec76f416..c49c475c6b62d9eebd724a26b5550c604bdf883e 100644 (file)
@@ -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'));
 
index 2d317d38fb2771ed9619248675a17777b678f1eb..7b063869b2f29e77f39f3ef41841825b8248c55f 100644 (file)
@@ -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');
        },
 
index a2664d4eb28da6ea6e9f7197bc1a0dc0bc4cb629..c737a7dbe21ce4f566c0ca46bec66fbb5a82e095 100644 (file)
@@ -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');
        },
 
index bdca0d65eefd84a697252d43f539679cf1ce72f5..27b08cf3935ed642bc6ac5283c1b474b58a0f9e7 100644 (file)
@@ -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.'));
index 2e0c6340fd32856f54ede05c160ad6c324fa1895..5306dd4cea4f23339559aca82036fb636ba6182e 100644 (file)
@@ -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');
        },
 
index 093f3fddbcd12c44a6b86703d1989dfdfecd5a5f..ff1a5a0ad9b4a1975470272b1120fcc295e6d195 100644 (file)
@@ -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) {
index 178b510a2be09f2f205ccb82b661afebce9a276d..1d60d644fd64612087fb0c580f416ee9e8a0a47e 100644 (file)
@@ -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');
        },
 
index 00d0ec88ff5a42b5019fb00eaadde26506f6630b..34b75f928463a815e84566cb2acff2dbe9546497 100644 (file)
@@ -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'),
index 073b9008a1d88316eb43c5b527a5d4358dd73d02..f6bac087239ead6262e686dbc0e57c88463e81ff 100644 (file)
@@ -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');
        },
 
index 5f9f73ad343d06408dcdc538e787317acb3404dd..3f9987236613f0dae78a3883e381848cafa39a81 100644 (file)
@@ -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');
        },
 
index cba3a7bdf70cef7e23671f4c0ce2fbc0ca1e7add..fdd55f0cf569f7bd5698ed3a1483c2f0099044d2 100644 (file)
@@ -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');
        },
 
index ab51632750a27eca467714215dc3864946e12dfa..3797b690ad7e6e93822f2d5229c19eacf43a71b9 100644 (file)
@@ -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');
        },
 
index 5fd42ab1e3fc596d8f6891f7ef932af506062636..5419e6d34f10c05b734eae2ad81db34d7f3d4a5d 100644 (file)
@@ -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');
index 09845dd3be6215f405341e6098059d71df05688d..7148ed11245256e50f12c253d3e9ca5a03dda381 100644 (file)
@@ -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) {
index 72cce1265616796efc06ac628702680deebc29bb..973c0858f3f7309140ae791ac90a1f452cebbb58 100644 (file)
@@ -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.'));
index 882fc4c3455b94d03ec5b98e5f985b7e90449171..b3e4f19331abac624a89026f42d553f011fe61fb 100644 (file)
@@ -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) {
index 62958e848802aecfa94ae0c3715885f7e1812411..07f0f509471bab9744dbfbe0f6b640437215db99 100644 (file)
@@ -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';
index fe2bbccd9de26fc568a5d10092d0d93740ea989d..e2331998a5e253528c68a02410618f42371abb38 100644 (file)
@@ -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';
index 82688cac68dfcfa00571ebc38e3844040dcaf54a..6e0b8e6a24822cdfb799f1af81f2655a52c69971 100644 (file)
@@ -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) {
index 0cf8482539c8a0058652e3f3eccb57baec544b0d..cda59a2a914f353b788edfa3e1b0b488c0c11343 100644 (file)
@@ -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');
        },
 
index 2040f86bc486757203a879b1bec27dced74e056a..9162418799b59eb03486ab9f1e1f36c310cbe756 100644 (file)
@@ -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' });
        },
 
index bd83944b46ddd3bc5bf3d399f88ba209da1d21de..c2def460981cf35789d13bddcbb05ba6a7f6310e 100644 (file)
@@ -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) {
index 1cbdb5f867f4d44809baac10823f58bed0c68fcf..c2f33a0a147bd651b2896317f1c56ab4ca102d47 100644 (file)
@@ -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';
index 152e584da44f4bb01c8d4d2f132923166c1c0658..b03b547d481a4d7d3532ac3b15239f13e77abe21 100755 (executable)
@@ -183,9 +183,11 @@ function config_network( c )
                                end
                end
 
-       return str .. _string( c["TimeToLive"], "TimeToLive" )
-                  .. _string( c["CacheFlush"], "CacheFlush" )
-                  .. _bool(   c["Forward"],    "Forward"    )
+       return str ..
+               _string(c["MaxPacketSize"], "MaxPacketSize") ..
+               _string(c["TimeToLive"], "TimeToLive") ..
+               _bool(c["Forward"], "Forward") ..
+               _bool(c["ReportStats"], "ReportStats")
 end