luci-app-statistics: js linting fixes / ES6 treatment
authorPaul Donald <redacted>
Sun, 15 Feb 2026 06:51:05 +0000 (07:51 +0100)
committerPaul Donald <redacted>
Mon, 16 Feb 2026 00:42:57 +0000 (01:42 +0100)
Fix errors

Signed-off-by: Paul Donald <redacted>
79 files changed:
applications/luci-app-statistics/htdocs/luci-static/resources/statistics/rrdtool.js
applications/luci-app-statistics/htdocs/luci-static/resources/statistics/rrdtool/definitions/apcups.js
applications/luci-app-statistics/htdocs/luci-static/resources/statistics/rrdtool/definitions/chrony.js
applications/luci-app-statistics/htdocs/luci-static/resources/statistics/rrdtool/definitions/conntrack.js
applications/luci-app-statistics/htdocs/luci-static/resources/statistics/rrdtool/definitions/contextswitch.js
applications/luci-app-statistics/htdocs/luci-static/resources/statistics/rrdtool/definitions/cpu.js
applications/luci-app-statistics/htdocs/luci-static/resources/statistics/rrdtool/definitions/cpufreq.js
applications/luci-app-statistics/htdocs/luci-static/resources/statistics/rrdtool/definitions/curl.js
applications/luci-app-statistics/htdocs/luci-static/resources/statistics/rrdtool/definitions/df.js
applications/luci-app-statistics/htdocs/luci-static/resources/statistics/rrdtool/definitions/dhcpleases.js
applications/luci-app-statistics/htdocs/luci-static/resources/statistics/rrdtool/definitions/disk.js
applications/luci-app-statistics/htdocs/luci-static/resources/statistics/rrdtool/definitions/dns.js
applications/luci-app-statistics/htdocs/luci-static/resources/statistics/rrdtool/definitions/dsl.js
applications/luci-app-statistics/htdocs/luci-static/resources/statistics/rrdtool/definitions/entropy.js
applications/luci-app-statistics/htdocs/luci-static/resources/statistics/rrdtool/definitions/interface.js
applications/luci-app-statistics/htdocs/luci-static/resources/statistics/rrdtool/definitions/ip6tables.js
applications/luci-app-statistics/htdocs/luci-static/resources/statistics/rrdtool/definitions/ipstatistics.js
applications/luci-app-statistics/htdocs/luci-static/resources/statistics/rrdtool/definitions/iptables.js
applications/luci-app-statistics/htdocs/luci-static/resources/statistics/rrdtool/definitions/irq.js
applications/luci-app-statistics/htdocs/luci-static/resources/statistics/rrdtool/definitions/iwinfo.js
applications/luci-app-statistics/htdocs/luci-static/resources/statistics/rrdtool/definitions/load.js
applications/luci-app-statistics/htdocs/luci-static/resources/statistics/rrdtool/definitions/memory.js
applications/luci-app-statistics/htdocs/luci-static/resources/statistics/rrdtool/definitions/netlink.js
applications/luci-app-statistics/htdocs/luci-static/resources/statistics/rrdtool/definitions/nut.js
applications/luci-app-statistics/htdocs/luci-static/resources/statistics/rrdtool/definitions/olsrd.js
applications/luci-app-statistics/htdocs/luci-static/resources/statistics/rrdtool/definitions/openvpn.js
applications/luci-app-statistics/htdocs/luci-static/resources/statistics/rrdtool/definitions/ping.js
applications/luci-app-statistics/htdocs/luci-static/resources/statistics/rrdtool/definitions/processes.js
applications/luci-app-statistics/htdocs/luci-static/resources/statistics/rrdtool/definitions/sensors.js
applications/luci-app-statistics/htdocs/luci-static/resources/statistics/rrdtool/definitions/snmp6.js
applications/luci-app-statistics/htdocs/luci-static/resources/statistics/rrdtool/definitions/splash_leases.js
applications/luci-app-statistics/htdocs/luci-static/resources/statistics/rrdtool/definitions/sqm.js
applications/luci-app-statistics/htdocs/luci-static/resources/statistics/rrdtool/definitions/sqmcake.js
applications/luci-app-statistics/htdocs/luci-static/resources/statistics/rrdtool/definitions/tcpconns.js
applications/luci-app-statistics/htdocs/luci-static/resources/statistics/rrdtool/definitions/thermal.js
applications/luci-app-statistics/htdocs/luci-static/resources/statistics/rrdtool/definitions/uptime.js
applications/luci-app-statistics/htdocs/luci-static/resources/statistics/rrdtool/definitions/users.js
applications/luci-app-statistics/htdocs/luci-static/resources/view/statistics/collectd.js
applications/luci-app-statistics/htdocs/luci-static/resources/view/statistics/graphs.js
applications/luci-app-statistics/htdocs/luci-static/resources/view/statistics/plugins/apcups.js
applications/luci-app-statistics/htdocs/luci-static/resources/view/statistics/plugins/chrony.js
applications/luci-app-statistics/htdocs/luci-static/resources/view/statistics/plugins/conntrack.js
applications/luci-app-statistics/htdocs/luci-static/resources/view/statistics/plugins/contextswitch.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/dhcpleases.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/entropy.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/ipstatistics.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/load.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/mqtt.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/snmp6.js
applications/luci-app-statistics/htdocs/luci-static/resources/view/statistics/plugins/splash_leases.js
applications/luci-app-statistics/htdocs/luci-static/resources/view/statistics/plugins/syslog.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/htdocs/luci-static/resources/view/statistics/plugins/uptime.js
applications/luci-app-statistics/htdocs/luci-static/resources/view/statistics/plugins/users.js

index 0e8414ff2f5ce4825ce1022dbda5f71a7acd3ad3..5231194a1961cd258d85ec55e6076a4a0e6dca6b 100644 (file)
@@ -17,9 +17,9 @@ function subst(str, val) {
        });
 }
 
-var i18n = L.Class.singleton({
-       title: function(host, plugin, pinst, dtype, dinst, user_title) {
-               var title = user_title || 'p=%s/pi=%s/dt=%s/di=%s'.format(
+const i18n = L.Class.singleton({
+       title(host, plugin, pinst, dtype, dinst, user_title) {
+               const title = user_title || 'p=%s/pi=%s/dt=%s/di=%s'.format(
                        plugin,
                        pinst || '(nil)',
                        dtype || '(nil)',
@@ -35,8 +35,8 @@ var i18n = L.Class.singleton({
                });
        },
 
-       label: function(host, plugin, pinst, dtype, dinst, user_label) {
-               var label = user_label || 'dt=%s/%di=%s'.format(
+       label(host, plugin, pinst, dtype, dinst, user_label) {
+               const label = user_label || 'dt=%s/%di=%s'.format(
                        dtype || '(nil)',
                        dinst || '(nil)'
                );
@@ -50,8 +50,8 @@ var i18n = L.Class.singleton({
                });
        },
 
-       ds: function(host, source) {
-               var label = source.title || 'dt=%s/di=%s/ds=%s'.format(
+       ds(host, source) {
+               const label = source.title || 'dt=%s/di=%s/ds=%s'.format(
                        source.type     || '(nil)',
                        source.instance || '(nil)',
                        source.ds       || '(nil)'
@@ -66,8 +66,8 @@ var i18n = L.Class.singleton({
        }
 });
 
-var colors = L.Class.singleton({
-       fromString: function(s) {
+const colors = L.Class.singleton({
+       fromString(s) {
                if (typeof(s) != 'string' || !s.match(/^[0-9a-fA-F]{6}$/))
                        return null;
 
@@ -78,15 +78,15 @@ var colors = L.Class.singleton({
                ];
        },
 
-       asString: function(c) {
+       asString(c) {
                if (!Array.isArray(c) || c.length != 3)
                        return null;
 
                return '%02x%02x%02x'.format(c[0], c[1], c[2]);
        },
 
-       defined: function(i) {
-               var t = [
+       defined(i) {
+               const t = [
                        [230, 25, 75],
                        [245, 130, 48],
                        [255, 225, 25],
@@ -100,22 +100,22 @@ var colors = L.Class.singleton({
                return this.asString(t[i % t.length]);
        },
 
-       random: function() {
-               var r = random.get(255),
-                   g = random.get(255),
-                   min = 0, max = 255;
+       random() {
+               const r = random.get(255);
+               const g = random.get(255);
+               let min = 0, max = 255;
 
                if (r + g < 255)
                        min = 255 - r - g;
                else
                        max = 511 - r - g;
 
-               var b = min + Math.floor(random.get() * (max - min));
+               const b = min + Math.floor(random.get() * (max - min));
 
                return [ r, g, b ];
        },
 
-       faded: function(fg, bg, alpha) {
+       faded(fg, bg, alpha) {
                fg = this.fromString(fg) || (this.asString(fg) ? fg : null);
                bg = this.fromString(bg) || (this.asString(bg) ? bg : [255, 255, 255]);
                alpha = !isNaN(alpha) ? +alpha : 0.25;
@@ -131,23 +131,20 @@ var colors = L.Class.singleton({
        }
 });
 
-var rrdtree = {},
-    graphdefs = {};
+const rrdtree = {};
+const graphdefs = {};
 
 return baseclass.extend({
-       __init__: function() {
+       __init__() {
                this.opts = {};
        },
 
-       load: function() {
+       load() {
                return Promise.all([
                        L.resolveDefault(fs.list('/www' + L.resource('statistics/rrdtool/definitions')), []),
                        fs.trimmed('/proc/sys/kernel/hostname'),
                        uci.load('luci_statistics')
-               ]).then(L.bind(function(data) {
-                       var definitions = data[0],
-                           hostname = data[1];
-
+               ]).then(L.bind(function([definitions, hostname]) {
                        this.opts.host      = uci.get('luci_statistics', 'collectd', 'Hostname')        || hostname;
                        this.opts.timespan  = uci.get('luci_statistics', 'rrdtool', 'default_timespan') || 3600;
                        this.opts.width     = uci.get('luci_statistics', 'rrdtool', 'image_width')      || 600;
@@ -156,14 +153,14 @@ return baseclass.extend({
                        this.opts.rrasingle = (uci.get('luci_statistics', 'collectd_rrdtool', 'RRASingle') == '1');
                        this.opts.rramax    = (uci.get('luci_statistics', 'collectd_rrdtool', 'RRAMax') == '1');
 
-                       graphdefs = {};
+                       const graphdefs = {};
 
-                       var tasks = [ this.scan() ];
+                       const tasks = [ this.scan() ];
 
-                       for (var i = 0; i < definitions.length; i++) {
-                               var m = definitions[i].name.match(/^(.+)\.js$/);
+                       for (let def of definitions) {
+                               const m = def.name.match(/^(.+)\.js$/);
 
-                               if (definitions[i].type != 'file' || m == null)
+                               if (def.type != 'file' || m == null)
                                        continue;
 
                                tasks.push(L.require('statistics.rrdtool.definitions.' + m[1]).then(L.bind(function(name, def) {
@@ -175,30 +172,30 @@ return baseclass.extend({
                }, this));
        },
 
-       ls: function() {
-               var dir = this.opts.rrdpath;
+       ls() {
+               const dir = this.opts.rrdpath;
 
                return L.resolveDefault(fs.list(dir), []).then(function(entries) {
-                       var tasks = [];
+                       const tasks = [];
 
-                       for (var i = 0; i < entries.length; i++) {
-                               if (entries[i].type != 'directory')
+                       for (let entr of entries) {
+                               if (entr.type != 'directory')
                                        continue;
 
-                               tasks.push(L.resolveDefault(fs.list(dir + '/' + entries[i].name), []).then(L.bind(function(entries) {
-                                       var tasks = [];
+                               tasks.push(L.resolveDefault(fs.list(dir + '/' + entr.name), []).then(L.bind(function(entries) {
+                                       const tasks = [];
 
-                                       for (var j = 0; j < entries.length; j++) {
-                                               if (entries[j].type != 'directory')
+                                       for (let dir of entries) {
+                                               if (dir.type != 'directory')
                                                        continue;
 
-                                               tasks.push(L.resolveDefault(fs.list(dir + '/' + this.name + '/' + entries[j].name), []).then(L.bind(function(entries) {
+                                               tasks.push(L.resolveDefault(fs.list(dir + '/' + this.name + '/' + dir.name), []).then(L.bind(function(entries) {
                                                        return Object.assign(this, {
                                                                entries: entries.filter(function(e) {
                                                                        return e.type == 'file' && e.name.match(/\.rrd$/);
                                                                })
                                                        });
-                                               }, entries[j])));
+                                               }, dir)));
                                        }
 
                                        return Promise.all(tasks).then(L.bind(function(entries) {
@@ -206,42 +203,42 @@ return baseclass.extend({
                                                        entries: entries
                                                });
                                        }, this));
-                               }, entries[i])));
+                               }, entr)));
                        }
 
                        return Promise.all(tasks);
                });
        },
 
-       scan: function() {
+       scan() {
                return this.ls().then(L.bind(function(entries) {
-                       rrdtree = {};
+                       const rrdtree = {};
 
-                       for (var i = 0; i < entries.length; i++) {
-                               var hostInstance = entries[i].name;
+                       for (let entr of entries) {
+                               const hostInstance = entr.name;
 
                                rrdtree[hostInstance] = rrdtree[hostInstance] || {};
 
-                               for (var j = 0; j < entries[i].entries.length; j++) {
-                                       var m = entries[i].entries[j].name.match(/^([^-]+)(?:-(.+))?$/);
+                               for (let jentr of entr.entries) {
+                                       const m = jentr.name.match(/^([^-]+)(?:-(.+))?$/);
 
                                        if (!m)
                                                continue;
 
-                                       var pluginName = m[1],
-                                           pluginInstance = m[2] || '';
+                                       const pluginName = m[1];
+                                       const pluginInstance = m[2] || '';
 
                                        rrdtree[hostInstance][pluginName] = rrdtree[hostInstance][pluginName] || {};
                                        rrdtree[hostInstance][pluginName][pluginInstance] = rrdtree[hostInstance][pluginName][pluginInstance] || {};
 
-                                       for (var k = 0; k < entries[i].entries[j].entries.length; k++) {
-                                               var m = entries[i].entries[j].entries[k].name.match(/^([^-]+)(?:-(.+))?\.rrd$/);
+                                       for (let kentr of jentr.entries) {
+                                               const m = kentr.name.match(/^([^-]+)(?:-(.+))?\.rrd$/);
 
                                                if (!m)
                                                        continue;
 
-                                               var dataType = m[1],
-                                                   dataInstance = m[2] || '';
+                                               const dataType = m[1];
+                                               const dataInstance = m[2] || '';
 
                                                rrdtree[hostInstance][pluginName][pluginInstance][dataType] = rrdtree[hostInstance][pluginName][pluginInstance][dataType] || [];
                                                rrdtree[hostInstance][pluginName][pluginInstance][dataType].push(dataInstance);
@@ -251,18 +248,18 @@ return baseclass.extend({
                }, this));
        },
 
-       hostInstances: function() {
+       hostInstances() {
                return Object.keys(rrdtree).sort();
        },
 
-       pluginNames: function(hostInstance) {
+       pluginNames(hostInstance) {
                return Object.keys(rrdtree[hostInstance] || {}).sort();
        },
 
-       pluginInstances: function(hostInstance, pluginName) {
+       pluginInstances(hostInstance, pluginName) {
                return Object.keys((rrdtree[hostInstance] || {})[pluginName] || {}).sort(function(a, b) {
-                       var x = a.match(/^(\d+)\b/),
-                           y = b.match(/^(\d+)\b/);
+                       const x = a.match(/^(\d+)\b/);
+                       const y = b.match(/^(\d+)\b/);
 
                        if (!x != !y)
                                return !x - !y;
@@ -273,40 +270,40 @@ return baseclass.extend({
                });
        },
 
-       dataTypes: function(hostInstance, pluginName, pluginInstance) {
+       dataTypes(hostInstance, pluginName, pluginInstance) {
                return Object.keys(((rrdtree[hostInstance] || {})[pluginName] || {})[pluginInstance] || {}).sort();
        },
 
-       dataInstances: function(hostInstance, pluginName, pluginInstance, dataType) {
+       dataInstances(hostInstance, pluginName, pluginInstance, dataType) {
                return ((((rrdtree[hostInstance] || {})[pluginName] || {})[pluginInstance] || {})[dataType] || []).sort();
        },
 
-       pluginTitle: function(pluginName) {
-               var def = graphdefs[pluginName];
+       pluginTitle(pluginName) {
+               const def = graphdefs[pluginName];
                return (def ? def.title : null) || pluginName;
        },
 
-       hasDefinition: function(pluginName) {
+       hasDefinition(pluginName) {
                return (graphdefs[pluginName] != null);
        },
 
-       hasInstanceDetails: function(hostInstance, pluginName, pluginInstance) {
-               var def = graphdefs[pluginName];
+       hasInstanceDetails(hostInstance, pluginName, pluginInstance) {
+               const def = graphdefs[pluginName];
 
                if (!def || typeof(def.rrdargs) != 'function')
                        return false;
 
-               var optlist = this._forcelol(def.rrdargs(this, hostInstance, pluginName, pluginInstance, null, false));
+               const optlist = this._forcelol(def.rrdargs(this, hostInstance, pluginName, pluginInstance, null, false));
 
-               for (var i = 0; i < optlist.length; i++)
-                       if (optlist[i].detail)
+               for (let opt of optlist)
+                       if (opt.detail)
                                return true;
 
                return false;
        },
 
-       _mkpath: function(host, plugin, plugin_instance, dtype, data_instance) {
-               var path = host + '/' + plugin;
+       _mkpath(host, plugin, plugin_instance, dtype, data_instance) {
+               let path = host + '/' + plugin;
 
                if (plugin_instance != null && plugin_instance != '')
                        path += '-' + plugin_instance;
@@ -319,19 +316,19 @@ return baseclass.extend({
                return path;
        },
 
-       mkrrdpath: function(/* ... */) {
+       mkrrdpath(/* ... */) {
                return '%s/%s.rrd'.format(
                        this.opts.rrdpath,
                        this._mkpath.apply(this, arguments)
                ).replace(/[\\:]/g, '\\$&');
        },
 
-       _forcelol: function(list) {
+       _forcelol(list) {
                return L.isObject(list[0]) ? list : [ list ];
        },
 
-       _rrdtool: function(def, rrd, timespan, width, height, cache) {
-               var cmdline = [
+       _rrdtool(def, rrd, timespan, width, height, cache) {
+               const cmdline = [
                        'graph', '-', '-a', 'PNG',
                        '-s', 'NOW-%s'.format(timespan || this.opts.timespan),
                        '-e', 'NOW-15',
@@ -339,8 +336,8 @@ return baseclass.extend({
                        '-h', height || this.opts.height
                ];
 
-               for (var i = 0; i < def.length; i++) {
-                       var opt = String(def[i]);
+               for (let d of def) {
+                       let opt = String(d);
 
                        if (rrd)
                                opt = opt.replace(/\{file\}/g, rrd);
@@ -349,7 +346,7 @@ return baseclass.extend({
                }
 
                if (L.isObject(cache)) {
-                       var key = sfh(cmdline.join('\0'));
+                       const key = sfh(cmdline.join('\0'));
 
                        if (!cache.hasOwnProperty(key))
                                cache[key] = fs.exec_direct('/usr/bin/rrdtool', cmdline, 'blob', true);
@@ -360,24 +357,24 @@ return baseclass.extend({
                return fs.exec_direct('/usr/bin/rrdtool', cmdline, 'blob', true);
        },
 
-       _generic: function(opts, host, plugin, plugin_instance, dtype, index) {
-               var defs = [],
-                   gopts = this.opts,
-                   _args = [],
-                   _sources = [],
-                   _stack_neg = [],
-                   _stack_pos = [],
-                   _longest_name = 0,
-                   _has_totals = false;
+       _generic(opts, host, plugin, plugin_instance, dtype, index) {
+               const defs = [];
+               const gopts = this.opts;
+               let _args = [];
+               let _sources = [];
+               let _stack_neg = [];
+               let _stack_pos = [];
+               let _longest_name = 0;
+               let _has_totals = false;
 
                /* use the plugin+instance+type as seed for the prng to ensure the
                   same pseudo-random color sequence for each render */
                random.seed(sfh([plugin, plugin_instance || '', dtype || ''].join('.')));
 
                function __def(source) {
-                       var inst = source.sname,
-                           rrd  = source.rrd,
-                           ds   = source.ds || 'value';
+                       const inst = source.sname;
+                       const rrd  = source.rrd;
+                       const ds   = source.ds || 'value';
 
                        _args.push(
                                'DEF:%s_avg_raw=%s:%s:AVERAGE'.format(inst, rrd, ds),
@@ -398,7 +395,7 @@ return baseclass.extend({
                }
 
                function __cdef(source) {
-                       var prev;
+                       let prev;
 
                        if (source.flip)
                                prev = _stack_neg[_stack_neg.length - 1];
@@ -470,7 +467,7 @@ return baseclass.extend({
 
                /* local helper: create line and area statements */
                function __line(source) {
-                       var line_color, area_color, legend, variable;
+                       let line_color, area_color, legend, variable;
 
                        /* find colors: try source, then opts.colors; fall back to random color */
                        if (typeof(source.color) == 'string') {
@@ -508,8 +505,8 @@ return baseclass.extend({
 
                /* local helper: create gprint statements */
                function __gprint(source) {
-                       var numfmt = opts.number_format || '%6.1lf',
-                           totfmt = opts.totals_format || '%5.1lf%s';
+                       const numfmt = opts.number_format || '%6.1lf';
+                       const totfmt = opts.totals_format || '%5.1lf%s';
 
                        /* don't include MIN if rrasingle is enabled */
                        if (!gopts.rrasingle)
@@ -535,7 +532,7 @@ return baseclass.extend({
                 */
 
                /* find data types */
-               var data_types = dtype ? [ dtype ] : (opts.data.types || []);
+               const data_types = dtype ? [ dtype ] : (opts.data.types || []);
 
                if (!(dtype || opts.data.types)) {
                        if (L.isObject(opts.data.instances))
@@ -546,45 +543,45 @@ return baseclass.extend({
                }
 
                /* iterate over data types */
-               for (var i = 0; i < data_types.length; i++) {
+               for (let dt of data_types) {
                        /* find instances */
-                       var data_instances;
+                       let data_instances;
 
                        if (!opts.per_instance) {
-                               if (L.isObject(opts.data.instances) && Array.isArray(opts.data.instances[data_types[i]]))
-                                       data_instances = opts.data.instances[data_types[i]];
+                               if (L.isObject(opts.data.instances) && Array.isArray(opts.data.instances[dt]))
+                                       data_instances = opts.data.instances[dt];
                                else
-                                       data_instances = this.dataInstances(host, plugin, plugin_instance, data_types[i]);
+                                       data_instances = this.dataInstances(host, plugin, plugin_instance, dt);
                        }
 
                        if (!Array.isArray(data_instances) || data_instances.length == 0)
                                data_instances = [ '' ];
 
                        /* iterate over data instances */
-                       for (var j = 0; j < data_instances.length; j++) {
+                       for (let di of data_instances) {
                                /* construct combined data type / instance name */
-                               var dname = data_types[i];
+                               let dname = dt;
 
-                               if (data_instances[j].length)
-                                       dname += '_' + data_instances[j];
+                               if (di.length)
+                                       dname += '_' + di;
 
                                /* find sources */
-                               var data_sources = [ 'value' ];
+                               let data_sources = [ 'value' ];
 
                                if (L.isObject(opts.data.sources)) {
                                        if (Array.isArray(opts.data.sources[dname]))
                                                data_sources = opts.data.sources[dname];
-                                       else if (Array.isArray(opts.data.sources[data_types[i]]))
-                                               data_sources = opts.data.sources[data_types[i]];
+                                       else if (Array.isArray(opts.data.sources[dt]))
+                                               data_sources = opts.data.sources[dt];
                                }
 
                                /* iterate over data sources */
-                               for (var k = 0; k < data_sources.length; k++) {
-                                       var dsname  = data_types[i] + '_' + data_instances[j].replace(/\W/g, '_') + '_' + data_sources[k],
-                                           altname = data_types[i] + '__' + data_sources[k];
+                               for (let ds of data_sources) {
+                                       const dsname  = dt + '_' + di.replace(/\W/g, '_') + '_' + ds;
+                                       const altname = dt + '__' + ds;
 
                                        /* find datasource options */
-                                       var dopts = {};
+                                       let dopts = {};
 
                                        if (L.isObject(opts.data.options)) {
                                                if (L.isObject(opts.data.options[dsname]))
@@ -593,13 +590,13 @@ return baseclass.extend({
                                                        dopts = opts.data.options[altname];
                                                else if (L.isObject(opts.data.options[dname]))
                                                        dopts = opts.data.options[dname];
-                                               else if (L.isObject(opts.data.options[data_types[i]]))
-                                                       dopts = opts.data.options[data_types[i]];
+                                               else if (L.isObject(opts.data.options[dt]))
+                                                       dopts = opts.data.options[dt];
                                        }
 
                                        /* store values */
-                                       var source = {
-                                               rrd: dopts.rrd || this.mkrrdpath(host, plugin, plugin_instance, data_types[i], data_instances[j]),
+                                       const source = {
+                                               rrd: dopts.rrd || this.mkrrdpath(host, plugin, plugin_instance, dt, di),
                                                color: dopts.color || colors.asString(colors.random()),
                                                flip: dopts.flip || false,
                                                total: dopts.total || false,
@@ -608,12 +605,12 @@ return baseclass.extend({
                                                noarea: dopts.noarea || false,
                                                noavg: dopts.noavg || false,
                                                title: dopts.title || null,
-                                               weight: dopts.weight || (dopts.negweight ? -+data_instances[j] : null) || (dopts.posweight ? +data_instances[j] : null) || null,
-                                               ds: data_sources[k],
-                                               type: data_types[i],
-                                               instance: data_instances[j],
+                                               weight: dopts.weight || (dopts.negweight ? -+di : null) || (dopts.posweight ? +di : null) || null,
+                                               ds: ds,
+                                               type: dt,
+                                               instance: di,
                                                index: _sources.length + 1,
-                                               sname: String(_sources.length + 1) + data_types[i]
+                                               sname: String(_sources.length + 1) + dt
                                        };
 
                                        _sources.push(source);
@@ -637,17 +634,17 @@ return baseclass.extend({
 
                /* if per_instance is enabled then find all instances from the first datasource in diagram */
                /* if per_instance is disabled then use an empty pseudo instance and use model provided values */
-               var instances = [ '' ];
+               let instances = [ '' ];
 
                if (opts.per_instance)
                        instances = this.dataInstances(host, plugin, plugin_instance, _sources[0].type);
 
                /* iterate over instances */
-               for (var i = 0; i < instances.length; i++) {
+               for (let inst of instances) {
                        /* store title and vlabel */
                        _args.push(
-                               '-t', i18n.title(host, plugin, plugin_instance, _sources[0].type, instances[i], opts.title),
-                               '-v', i18n.label(host, plugin, plugin_instance, _sources[0].type, instances[i], opts.vlabel)
+                               '-t', i18n.title(host, plugin, plugin_instance, _sources[0].type, inst, opts.title),
+                               '-v', i18n.label(host, plugin, plugin_instance, _sources[0].type, inst, opts.vlabel)
                        );
 
                        if (opts.y_max)
@@ -667,44 +664,44 @@ return baseclass.extend({
 
                        /* store additional rrd options */
                        if (Array.isArray(opts.rrdopts))
-                               for (var j = 0; j < opts.rrdopts.length; j++)
-                                       _args.push(String(opts.rrdopts[j]));
+                               for (let opt of opts.rrdopts)
+                                       _args.push(String(opt));
 
                        /* sort sources */
                        _sources.sort(function(a, b) {
-                               var x = a.weight || a.index || 0,
-                                   y = b.weight || b.index || 0;
+                               const x = a.weight || a.index || 0;
+                               const y = b.weight || b.index || 0;
 
                                return +x - +y;
                        });
 
                        /* define colors in order */
                        if (opts.ordercolor)
-                               for (var j = 0; j < _sources.length; j++)
+                               for (let j = 0; j < _sources.length; j++)
                                        _sources[j].color = colors.defined(j);
 
                        /* create DEF statements for each instance */
-                       for (var j = 0; j < _sources.length; j++) {
+                       for (let src of _sources) {
                                /* fixup properties for per instance mode... */
                                if (opts.per_instance) {
-                                       _sources[j].instance = instances[i];
-                                       _sources[j].rrd      = this.mkrrdpath(host, plugin, plugin_instance, _sources[j].type, instances[i]);
+                                       src.instance = inst;
+                                       src.rrd      = this.mkrrdpath(host, plugin, plugin_instance, src.type, inst);
                                }
 
-                               __def(_sources[j]);
+                               __def(src);
                        }
 
                        /* create CDEF required for calculating totals */
                        __cdef_totals();
 
                        /* create CDEF statements for each instance in reversed order */
-                       for (var j = _sources.length - 1; j >= 0; j--)
+                       for (let j = _sources.length - 1; j >= 0; j--)
                                __cdef(_sources[j]);
 
                        /* create LINE1, AREA and GPRINT statements for each instance */
-                       for (var j = 0; j < _sources.length; j++) {
-                               __line(_sources[j]);
-                               __gprint(_sources[j]);
+                       for (let src of _sources) {
+                               __line(src);
+                               __gprint(src);
                        }
 
                        /* push arg stack to definition list */
@@ -719,28 +716,28 @@ return baseclass.extend({
                return defs;
        },
 
-       render: function(plugin, plugin_instance, is_index, hostname, timespan, width, height, cache) {
-               var pngs = [];
+       render(plugin, plugin_instance, is_index, hostname, timespan, width, height, cache) {
+               const pngs = [];
 
                /* check for a whole graph handler */
-               var def = graphdefs[plugin];
+               const def = graphdefs[plugin];
 
                if (def && typeof(def.rrdargs) == 'function') {
                        /* temporary image matrix */
-                       var _images = [];
+                       const _images = [];
 
                        /* get diagram definitions */
-                       var optlist = this._forcelol(def.rrdargs(this, hostname, plugin, plugin_instance, null, is_index));
-                       for (var i = 0; i < optlist.length; i++) {
-                               var opt = optlist[i];
+                       const optlist = this._forcelol(def.rrdargs(this, hostname, plugin, plugin_instance, null, is_index));
+                       for (let i = 0; i < optlist.length; i++) {
+                               const opt = optlist[i];
                                if (!is_index || !opt.detail) {
                                        _images[i] = [];
 
                                        /* get diagram definition instances */
-                                       var diagrams = this._generic(opt, hostname, plugin, plugin_instance, null, i);
+                                       const diagrams = this._generic(opt, hostname, plugin, plugin_instance, null, i);
 
                                        /* render all diagrams */
-                                       for (var j = 0; j < diagrams.length; j++) {
+                                       for (let j = 0; j < diagrams.length; j++) {
                                                /* exec */
                                                _images[i][j] = this._rrdtool(diagrams[j], null, timespan, width, height, cache);
                                        }
@@ -748,8 +745,8 @@ return baseclass.extend({
                        }
 
                        /* remember images - XXX: fixme (will cause probs with asymmetric data) */
-                       for (var y = 0; y < _images[0].length; y++)
-                               for (var x = 0; x < _images.length; x++)
+                       for (let y = 0; y < _images[0].length; y++)
+                               for (let x = 0; x < _images.length; x++)
                                        pngs.push(_images[x][y]);
                }
 
index c03e38cf57e0a2460a5dab2bd8b43e5d8f6a3b09..2a5204904ecd1149ab47fe86e7d01b8e486a81ed 100644 (file)
@@ -6,8 +6,8 @@
 return baseclass.extend({
        title: _('APC UPS'),
 
-       rrdargs: function(graph, host, plugin, plugin_instance, dtype) {
-               var rv = [];
+       rrdargs(graph, host, plugin, plugin_instance, dtype) {
+               const rv = [];
 
                /*
                 * Types and instances supported by APC UPS
@@ -15,15 +15,15 @@ return baseclass.extend({
                 * e.g. ups_inst['voltage'] -> [ 'input', 'battery' ]
                 */
 
-               var ups_types = graph.dataTypes(host, plugin, plugin_instance),
-                   ups_inst = {};
+               const ups_types = graph.dataTypes(host, plugin, plugin_instance);
+               const ups_inst = {};
 
-               for (var i = 0; i < ups_types.length; i++)
-                       ups_inst[ups_types[i]] = graph.dataInstances(host, plugin, plugin_instance, ups_types[i]);
+               for (let upst of ups_types)
+                       ups_inst[upst] = graph.dataInstances(host, plugin, plugin_instance, upst);
 
                /* Check if hash table or array is empty or nil-filled */
                function empty(t) {
-                       for (var k in t)
+                       for (let k in t)
                                if (t[k] != null)
                                        return false;
 
@@ -34,12 +34,12 @@ return baseclass.extend({
                /* supported and available to the plugin and UPS. */
 
                function add_supported(t, defs) {
-                       var def_inst = defs['data']['instances'];
+                       const def_inst = defs['data']['instances'];
 
                        if (L.isObject(def_inst)) {
-                               for (var k in def_inst) {
+                               for (let k in def_inst) {
                                        if (ups_types.filter(function(t) { return t == k }).length) {
-                                               for (var i = def_inst[k].length - 1; i >= 0; i--)
+                                               for (let i = def_inst[k].length - 1; i >= 0; i--)
                                                        if (!ups_inst[k].filter(function(n) { return n == def_inst[k][i] }).length)
                                                                def_inst[k].splice(i, 1);
 
@@ -62,7 +62,7 @@ return baseclass.extend({
                /* Graph definitions for APC UPS measurements MUST use only 'instances': */
                /* e.g. instances = { voltage = {  "input", "output" } } */
 
-               var voltagesdc = {
+               const voltagesdc = {
                        title: "%H: Voltages on APC UPS - Battery",
                        vlabel: "Volts DC",
                        alt_autoscale: true,
@@ -78,7 +78,7 @@ return baseclass.extend({
                };
                add_supported(rv, voltagesdc);
 
-               var voltagesac = {
+               const voltagesac = {
                        title: "%H: Voltages on APC UPS - AC",
                        vlabel: "Volts AC",
                        alt_autoscale: true,
@@ -95,7 +95,7 @@ return baseclass.extend({
                };
                add_supported(rv, voltagesac);
 
-               var percentload = {
+               const percentload = {
                        title: "%H: Load on APC UPS ",
                        vlabel: "Percent",
                        y_min: "0",
@@ -112,7 +112,7 @@ return baseclass.extend({
                };
                add_supported(rv, percentload);
 
-               var charge_percent = {
+               const charge_percent = {
                        title: "%H: Battery charge on APC UPS ",
                        vlabel: "Percent",
                        y_min: "0",
@@ -129,7 +129,7 @@ return baseclass.extend({
                };
                add_supported(rv, charge_percent);
 
-               var temperature = {
+               const temperature = {
                        title: "%H: Battery temperature on APC UPS ",
                        vlabel: "\u00b0C",
                        number_format: "%5.1lf\u00b0C",
@@ -143,7 +143,7 @@ return baseclass.extend({
                };
                add_supported(rv, temperature);
 
-               var timeleft = {
+               const timeleft = {
                        title: "%H: Time left on APC UPS ",
                        vlabel: "Minutes",
                        number_format: "%.1lfm",
@@ -158,7 +158,7 @@ return baseclass.extend({
                };
                add_supported(rv, timeleft);
 
-               var frequency = {
+               const frequency = {
                        title: "%H: Incoming line frequency on APC UPS ",
                        vlabel: "Hz",
                        number_format: "%5.0lfhz",
index 4730adfbd8a3f42f1d31b8801eabe1f48281e308..2064c7d3004a585b7b3b97dad14609b10bc4c86d 100644 (file)
@@ -7,8 +7,8 @@
 return baseclass.extend({
        title: _('Chrony'),
 
-       rrdargs: function(graph, host, plugin, plugin_instance, dtype) {
-               var offset = {
+       rrdargs(graph, host, plugin, plugin_instance, dtype) {
+               const offset = {
                        title: "%H: Chrony - time offset",
                        vlabel: "Time offset (ms)",
                        number_format: "%9.3lf ms",
@@ -32,7 +32,7 @@ return baseclass.extend({
                        }
                };
 
-               var stratum = {
+               const stratum = {
                        title: "%H: Chrony - clock stratum",
                        vlabel: "Clock stratum",
                        number_format: "%3.1lf%S",
index 35951dffba59998498e866d2c5c693330369cd21..1f757cf5998f03ca511223632b42ac8e4039576c 100644 (file)
@@ -6,8 +6,8 @@
 return baseclass.extend({
        title: _('Conntrack'),
 
-       rrdargs: function(graph, host, plugin, plugin_instance, dtype) {
-               var entries = {
+       rrdargs(graph, host, plugin, plugin_instance, dtype) {
+               const entries = {
                        title: "%H: Conntrack entries",
                        vlabel: "Count",
                        number_format: "%5.0lf",
@@ -28,7 +28,7 @@ return baseclass.extend({
                        }
                };
 
-               var percent = {
+               const percent = {
                        title: "%H: Conntrack usage",
                        vlabel: "Percent",
                        number_format: "%5.1lf%%",
index 8dc3cc75fba7cb905c6af7d517351198b16fec2d..ef6f0a81dc77b615447fa45c220ca3c7de3f4268 100644 (file)
@@ -6,7 +6,7 @@
 return baseclass.extend({
        title: _('Context Switches'),
 
-       rrdargs: function(graph, host, plugin, plugin_instance, dtype) {
+       rrdargs(graph, host, plugin, plugin_instance, dtype) {
                return {
                        title: "%H: Context switches",
                        alt_autoscale: true,
index bbd0e476426c06ca1051e3c0877f1cb1c8422b25..8f27a69dcb2ac9bed18ccc2cc2e5679fd287c1b5 100644 (file)
@@ -7,18 +7,18 @@
 return baseclass.extend({
        title: _('Processor'),
 
-       rrdargs: function(graph, host, plugin, plugin_instance, dtype) {
-               var p = [];
+       rrdargs(graph, host, plugin, plugin_instance, dtype) {
+               let p = [];
 
-               var title = "%H: Processor usage";
+               let title = "%H: Processor usage";
 
                if (plugin_instance != '')
                        title = "%H: Processor usage on core #%pi";
 
-               var show_idle = uci.get("luci_statistics", "collectd_cpu", "ShowIdle") == "1" ? true : false;
+               const show_idle = uci.get("luci_statistics", "collectd_cpu", "ShowIdle") == "1" ? true : false;
 
                if (uci.get("luci_statistics", "collectd_cpu", "ReportByState") == "1") {
-                       var cpu = {
+                       const cpu = {
                                title: title,
                                y_min: "0",
                                alt_autoscale_max: true,
@@ -74,7 +74,7 @@ return baseclass.extend({
                                }
                        };
 
-                       var percent = {
+                       const percent = {
                                title: title,
                                y_min: "0",
                                y_max: "2",
@@ -131,12 +131,12 @@ return baseclass.extend({
                                }
                        };
 
-                       var types = graph.dataTypes(host, plugin, plugin_instance);
+                       const types = graph.dataTypes(host, plugin, plugin_instance);
 
-                       for (var i = 0; i < types.length; i++)
-                               if (types[i] == 'cpu')
+                       for (let type of types)
+                               if (type == 'cpu')
                                        p.push(cpu);
-                               else if (types[i] == 'percent')
+                               else if (type == 'percent')
                                        p.push(percent);
                }
                else {
index a2cc1309e700f64f55e779180c6ebf0c4e701597..98ddf71a381e408f915bd861fb06d246525951eb 100644 (file)
@@ -7,8 +7,8 @@
 return baseclass.extend({
        title: _('CPU Frequency'),
 
-       rrdargs: function(graph, host, plugin, plugin_instance, dtype) {
-               var cpufreq = {
+       rrdargs(graph, host, plugin, plugin_instance, dtype) {
+               const cpufreq = {
                        title: "%H: Processor frequency - core %pi",
                        alt_autoscale: true,
                        vlabel: "Frequency (Hz)",
@@ -22,7 +22,7 @@ return baseclass.extend({
                };
 
            if (uci.get("luci_statistics", "collectd_cpufreq", "ExtraItems")) {
-                       var transitions = {
+                       const transitions = {
                                detail: true,
                                title: "%H: Frequency transitions - core %pi",
                                alt_autoscale: true,
@@ -38,7 +38,7 @@ return baseclass.extend({
                                }
                        };
 
-                       var percentage = {
+                       const percentage = {
                                detail: true,
                                title: "%H: Frequency distribution - core %pi",
                                alt_autoscale: true,
index 718aa7bbb6461f76a233983b550bc3ab31694e67..798912de08910e98a9bed025454af11cacd03054 100644 (file)
@@ -9,7 +9,7 @@
 return baseclass.extend({
        title: _('cUrl'),
 
-       rrdargs: function(graph, host, plugin, plugin_instance, dtype) {
+       rrdargs(graph, host, plugin, plugin_instance, dtype) {
                return {
                        title: "%H: cUrl Response Time for #%pi",
                        y_min: "0",
index 9790788b884753bdb3660b87143fefbaf8b66e39..2be92a70576538f41332fe62d68b677ce5043d40 100644 (file)
@@ -6,8 +6,8 @@
 return baseclass.extend({
        title: _('Disk Space Usage'),
 
-       rrdargs: function(graph, host, plugin, plugin_instance, dtype) {
-               var df_complex = {
+       rrdargs(graph, host, plugin, plugin_instance, dtype) {
+               const df_complex = {
                        title: "%H: Disk space usage on %pi",
                        vlabel: "Bytes",
                        number_format: "%5.1lf%sB",
@@ -39,7 +39,7 @@ return baseclass.extend({
                        }
                };
 
-               var percent_bytes = {
+               const percent_bytes = {
                        title: "%H: Disk space usage on %pi",
                        vlabel: "Percent",
                        number_format: "%5.2lf %%",
@@ -71,13 +71,13 @@ return baseclass.extend({
                        }
                };
 
-               var types = graph.dataTypes(host, plugin, plugin_instance);
-               var p = [];
+               const types = graph.dataTypes(host, plugin, plugin_instance);
+               const p = [];
 
-               for (var i = 0; i < types.length; i++)
-                       if (types[i] == 'percent_bytes')
+               for (let type of types)
+                       if (type == 'percent_bytes')
                                p.push(percent_bytes);
-                       else if (types[i] == 'df_complex')
+                       else if (type == 'df_complex')
                                p.push(df_complex);
 
                return p;
index b54a0af27e6b30e69b7c168214f4776f3cc050ef..54e6729b58aeb057179bffd48fe331b7794ba796 100644 (file)
@@ -6,7 +6,7 @@
 return baseclass.extend({
        title: _('DHCP Leases'),
 
-       rrdargs: function(graph, host, plugin, plugin_instance, dtype) {
+       rrdargs(graph, host, plugin, plugin_instance, dtype) {
                return {
                        title: "%H: DHCP leases",
                        alt_autoscale_max: true,
index 12ed9568f69b6cda1787cec7009e03cf3f57612a..e3724e543274a96ecacb6a298a932e13e948b155 100644 (file)
@@ -9,7 +9,7 @@
 return baseclass.extend({
        title: _('Disk Usage'),
 
-       rrdargs: function(graph, host, plugin, plugin_instance, dtype) {
+       rrdargs(graph, host, plugin, plugin_instance, dtype) {
                return [{
                        title: "%H: Disk I/O operations on %pi",
                        vlabel: "Operations/s",
index 347bd23317897faf232ed8f100faa077a69126b7..1cc98760b9edd67fe748fc7a4588ce7a40d9458d 100644 (file)
@@ -9,8 +9,8 @@
 return baseclass.extend({
        title: _('DNS'),
 
-       rrdargs: function(graph, host, plugin, plugin_instance, dtype) {
-               var traffic = {
+       rrdargs(graph, host, plugin, plugin_instance, dtype) {
+               const traffic = {
                        title: "%H: DNS traffic",
                        vlabel: "Bit/s",
 
@@ -35,7 +35,7 @@ return baseclass.extend({
                        }
                };
 
-               var opcode_query = {
+               const opcode_query = {
                        title: "%H: DNS Opcode Query",
                        vlabel: "Queries/s",
                        data: {
@@ -53,7 +53,7 @@ return baseclass.extend({
                        }
                };
 
-               var qtype = {
+               const qtype = {
                        title: "%H: DNS QType",
                        vlabel: "Queries/s",
                        data: {
index 23ae3a538037e8311132555d29a2fc08a95767ef..7f63683c04f2fe814607664fa4e57beb53ec2b29 100644 (file)
@@ -5,9 +5,9 @@
 return L.Class.extend({
        title: _("DSL"),
 
-       rrdargs: function(graph, host, plugin, plugin_instance, dtype) {
-               var g = [];
-               var dtypes = graph.dataTypes(host, plugin, plugin_instance);
+       rrdargs(graph, host, plugin, plugin_instance, dtype) {
+               const g = [];
+               const dtypes = graph.dataTypes(host, plugin, plugin_instance);
 
                const d_uptime = {
                        title: _("%H: Line uptime on %pi"),
@@ -416,23 +416,23 @@ return L.Class.extend({
                        g.push(d_bitrate);
                }
                if (dtypes.includes("errors")) {
-                       var dinsts = graph.dataInstances(host, plugin, plugin_instance, "errors");
-                       var e = 0,
-                               c = 0,
-                               r = 0;
-                       for (var i = 0; i < dinsts.length; i++) {
+                       const dinsts = graph.dataInstances(host, plugin, plugin_instance, "errors");
+                       let e = 0;
+                       let c = 0;
+                       let r = 0;
+                       for (let dinst of dinsts) {
                                if (
                                        !e &&
-                                       (dinsts[i].indexOf("es") > -1 ||
-                                               dinsts[i].indexOf("loss") > -1 ||
-                                               dinsts[i].indexOf("uas") > -1)
+                                       (dinst.indexOf("es") > -1 ||
+                                               dinst.indexOf("loss") > -1 ||
+                                               dinst.indexOf("uas") > -1)
                                ) {
                                        e = g.push(d_errors);
-                               } else if (!c && dinsts[i].indexOf("crc") > -1) {
+                               } else if (!c && dinst.indexOf("crc") > -1) {
                                        c = g.push(d_crc);
                                } else if (
                                        !r &&
-                                       (dinsts[i].indexOf("rx_") == 0 || dinsts[i].indexOf("tx_") == 0)
+                                       (dinst.indexOf("rx_") == 0 || dinst.indexOf("tx_") == 0)
                                ) {
                                        r = g.push(d_retx);
                                }
index b4f6f0594821ce8835da8577f02b6e2faf215d00..247047b74b1420076ab250d203b73297b6ca42e6 100644 (file)
@@ -9,7 +9,7 @@
 return baseclass.extend({
        title: _('Entropy'),
 
-       rrdargs: function(graph, host, plugin, plugin_instance, dtype) {
+       rrdargs(graph, host, plugin, plugin_instance, dtype) {
                return {
                        title: "%H: Available entropy",
                        vlabel: "bits",
index ccf1849243a255f649f75deaefd184bc88638f22..ebdefeccc92b161eda680a323b16b93c00c66002 100644 (file)
@@ -6,11 +6,11 @@
 return baseclass.extend({
        title: _('Interfaces'),
 
-       rrdargs: function(graph, host, plugin, plugin_instance, dtype) {
+       rrdargs(graph, host, plugin, plugin_instance, dtype) {
                /*
                 * traffic diagram
                 */
-               var traffic = {
+               const traffic = {
 
                        /* draw this diagram for each plugin instance */
                        per_instance: true,
@@ -45,7 +45,7 @@ return baseclass.extend({
                /*
                 * packet diagram
                 */
-               var packets = {
+               const packets = {
 
                        /* draw this diagram for each plugin instance */
                        per_instance: true,
index c956c198812b595bb9656586ebee0c3edd256001..56fe33bc32bdab859dd96e94d38ea3a8258a230f 100644 (file)
@@ -6,7 +6,7 @@
 return baseclass.extend({
        title: _('Firewall (IPv6)'),
 
-       rrdargs: function(graph, host, plugin, plugin_instance, dtype) {
+       rrdargs(graph, host, plugin, plugin_instance, dtype) {
                return [{
                        title: "%H: Firewall: Processed bytes in %pi",
                        vlabel: "Bytes/s",
index 73bd16af111754f693aa3d06f15b4ae6b4e9c40f..144060971e9b9b05b792815fd3c47ec601e2cd30 100644 (file)
@@ -6,9 +6,9 @@
 return baseclass.extend({
        title: _('IP-Statistics'),
 
-       rrdargs: function(graph, host, plugin, plugin_instance, dtype) {
+       rrdargs(graph, host, plugin, plugin_instance, dtype) {
 
-               var traffic = {
+               const traffic = {
                        title: "%H: IPv4 and IPv6 Comparison",
                        vlabel: "Bytes/s",
                        number_format: "%5.1lf%sB/s",
index 69a3a87eb78e3cd6db35052365b1d6fbdd3fef1a..6b146a1c43d9d4ea7e4ea32f79146ddf719d06bb 100644 (file)
@@ -6,7 +6,7 @@
 return baseclass.extend({
        title: _('Firewall'),
 
-       rrdargs: function(graph, host, plugin, plugin_instance, dtype) {
+       rrdargs(graph, host, plugin, plugin_instance, dtype) {
                return [{
                        title: "%H: Firewall: Processed bytes in %pi",
                        vlabel: "Bytes/s",
index 150bc497f3eacd9ed592a52d3d92a3f94e420af4..7d968a5d3875ab1cec983f32a1f0169f4cfbce41 100644 (file)
@@ -6,7 +6,7 @@
 return baseclass.extend({
        title: _('Interrupts'),
 
-       rrdargs: function(graph, host, plugin, plugin_instance, dtype) {
+       rrdargs(graph, host, plugin, plugin_instance, dtype) {
                return {
                        title: "%H: Interrupts",
                        vlabel: "Issues/s",
index 9656f12e11a869dc3befefc0a9dfedfbfdd8e195..ad94ba07450be3e15b0d6e131e1783ddec56b428 100644 (file)
@@ -6,11 +6,11 @@
 return baseclass.extend({
        title: _('Wireless'),
 
-       rrdargs: function(graph, host, plugin, plugin_instance, dtype) {
+       rrdargs(graph, host, plugin, plugin_instance, dtype) {
                /*
                 * signal/noise diagram
                 */
-               var snr = {
+               const snr = {
                        title: "%H: Signal and noise on %pi",
                        detail: true,
                        vlabel: "dBm",
@@ -35,7 +35,7 @@ return baseclass.extend({
                /*
                 * signal quality diagram
                 */
-               var quality = {
+               const quality = {
                        title: "%H: Signal quality on %pi",
                        vlabel: "Quality",
                        number_format: "%3.0lf",
@@ -54,7 +54,7 @@ return baseclass.extend({
                /*
                 * phy rate diagram
                 */
-               var bitrate = {
+               const bitrate = {
                        title: "%H: Average phy rate on %pi",
                        detail: true,
                        vlabel: "Mbit/s",
@@ -73,7 +73,7 @@ return baseclass.extend({
                /*
                 * associated stations
                 */
-               var stations = {
+               const stations = {
                        title: "%H: Associated stations on %pi",
                        detail: true,
                        vlabel: "Stations",
index f3af09895d750c821c1975356c909a212958e654..d59ff42ea4523b28a26ebdd56e5c7e2396e32e0c 100644 (file)
@@ -6,7 +6,7 @@
 return baseclass.extend({
        title: _('System Load'),
 
-       rrdargs: function(graph, host, plugin, plugin_instance, dtype) {
+       rrdargs(graph, host, plugin, plugin_instance, dtype) {
                return {
                        title: "%H: Load",
                        vlabel: "Load",
index 960d98c1086c62527533e987625b9670b6c80109..08621d152ebafb56d95a09de9fa9296e5a14cb39 100644 (file)
 return baseclass.extend({
        title: _('Memory'),
 
-       rrdargs: function(graph, host, plugin, plugin_instance, dtype) {
-               var p = [];
-               var hide_free = uci.get("luci_statistics", "collectd_memory", "HideFree") == "1" ? true : false;
+       rrdargs(graph, host, plugin, plugin_instance, dtype) {
+               const p = [];
+               const hide_free = uci.get("luci_statistics", "collectd_memory", "HideFree") == "1" ? true : false;
 
-               var memory = {
+               const memory = {
                        title: "%H: Memory usage",
                        vlabel: "MB",
                        number_format: "%5.1lf%s",
@@ -51,7 +51,7 @@ return baseclass.extend({
                        }
                };
 
-               var percent = {
+               const percent = {
                        title: "%H: Memory usage",
                        vlabel: "Percent",
                        number_format: "%5.1lf%%",
@@ -87,12 +87,12 @@ return baseclass.extend({
                        }
                };
 
-               var types = graph.dataTypes(host, plugin, plugin_instance);
+               const types = graph.dataTypes(host, plugin, plugin_instance);
 
-               for (var i = 0; i < types.length; i++)
-                       if (types[i] == 'percent')
+               for (let type of types)
+                       if (type == 'percent')
                                p.push(percent);
-                       else if (types[i] == 'memory')
+                       else if (type == 'memory')
                                p.push(memory);
 
                return p;
index 3bf3756b0465ab90632e3af87e323729f82cb320..a2cd39bdc293de0436fa83d1f0aef4e91bf811c1 100644 (file)
@@ -6,11 +6,11 @@
 return baseclass.extend({
        title: _('Netlink'),
 
-       rrdargs: function(graph, host, plugin, plugin_instance, dtype) {
+       rrdargs(graph, host, plugin, plugin_instance, dtype) {
                /*
                 * traffic diagram
                 */
-               var traffic = {
+               const traffic = {
                        title: "%H: Netlink - Transfer on %pi",
                        vlabel: "Bytes/s",
 
@@ -42,7 +42,7 @@ return baseclass.extend({
                /*
                 * packet diagram
                 */
-               var packets = {
+               const packets = {
                        title: "%H: Netlink - Packets on %pi",
                        vlabel: "Packets/s", detail: true,
 
@@ -123,7 +123,7 @@ return baseclass.extend({
                /*
                 * multicast diagram
                 */
-               var multicast = {
+               const multicast = {
                        title: "%H: Netlink - Multicast on %pi",
                        vlabel: "Packets/s", detail: true,
 
@@ -147,7 +147,7 @@ return baseclass.extend({
                /*
                 * collision diagram
                 */
-               var collisions = {
+               const collisions = {
                        title: "%H: Netlink - Collisions on %pi",
                        vlabel: "Collisions/s", detail: true,
 
@@ -171,7 +171,7 @@ return baseclass.extend({
                /*
                 * error diagram
                 */
-               var errors = {
+               const errors = {
                        title: "%H: Netlink - Errors on %pi",
                        vlabel: "Errors/s", detail: true,
 
index dbd25f6c0767c256ea4d2c36e1008fd4650e33d1..9c41766ade28cee105b16635e7b9acf4dff12a4d 100644 (file)
@@ -6,9 +6,9 @@
 return baseclass.extend({
        title: _('UPS'),
 
-       rrdargs: function(graph, host, plugin, plugin_instance, dtype) {
-               var definitions = [];
-               var instances;
+       rrdargs(graph, host, plugin, plugin_instance, dtype) {
+               const definitions = [];
+               let instances;
 
                function find_instances(dtype, wanted) {
                        var matching = graph.dataInstances(host, plugin, plugin_instance, dtype).filter(function(instance) {
index cafe2ac70ed5f31f02a05aa7a432f8dec94333e5..9149a5fdb1201426349328144811adf95318df98 100644 (file)
@@ -9,8 +9,8 @@
 return baseclass.extend({
        title: _('OLSRd'),
 
-       rrdargs: function(graph, host, plugin, plugin_instance, dtype) {
-               var g = [];
+       rrdargs(graph, host, plugin, plugin_instance, dtype) {
+               const g = [];
 
                if (plugin_instance == "routes") {
                        g.push({
@@ -75,15 +75,15 @@ return baseclass.extend({
                                }
                        });
 
-                       var instances = graph.dataInstances(host, plugin, plugin_instance, "signal_quality").sort();
+                       const instances = graph.dataInstances(host, plugin, plugin_instance, "signal_quality").sort();
 
                        /* define one diagram per host, containing the rx and lq values */
-                       for (var i = 0; i < instances.length; i += 2) {
-                               var dsn1 = "signal_quality_%s_value".format(instances[i].replace(/\W+/g, '_')),
-                                   dsn2 = "signal_quality_%s_value".format(instances[i+1].replace(/\W+/g, '_')),
-                                   host = instances[i].match(/^[^-]+-([^-]+)-.+$/),
-                                   host = host ? host[1] : 'avg',
-                                   opts = {};
+                       for (let i = 0; i < instances.length; i += 2) {
+                               const dsn1 = "signal_quality_%s_value".format(instances[i].replace(/\W+/g, '_'));
+                               const dsn2 = "signal_quality_%s_value".format(instances[i+1].replace(/\W+/g, '_'));
+                               let host = instances[i].match(/^[^-]+-([^-]+)-.+$/);
+                               host = host ? host[1] : 'avg';
+                               const opts = {};
 
                                opts[dsn1] = { color: "00ff00", title: "LQ (%s)".format(host) };
                                opts[dsn2] = { color: "0000ff", title: "NLQ (%s)".format(host), flip: true };
index fea570f8d3b6aad09a289148af05b46f92223009..94525e79b4bd7ce9b4ccdfbaa5feeb726b493b6b 100644 (file)
@@ -6,11 +6,10 @@
 return baseclass.extend({
        title: _('OpenVPN'),
 
-       rrdargs: function(graph, host, plugin, plugin_instance, dtype) {
-               var inst = plugin_instance.replace(/^openvpn\.(.+)\.status$/, '$1');
+       rrdargs(graph, host, plugin, plugin_instance, dtype) {
+               const inst = plugin_instance.replace(/^openvpn\.(.+)\.status$/, '$1');
                const types = graph.dataTypes(host, plugin, plugin_instance);
                const rv = [];
-               let instances;
                const typeinstances = graph.dataInstances(host, plugin, plugin_instance, "if_octets").sort();
 
                function find_instances(dtype, wanted) {
@@ -20,7 +19,7 @@ return baseclass.extend({
                        return matching.length ? { [dtype]: matching } : null;
                }
 
-               if ((instances = find_instances('if_octets', ['overhead', 'traffic'])) !== null) {
+               if (find_instances('if_octets', ['overhead', 'traffic']) !== null) {
                        rv.push({
                                title: "%%H: OpenVPN \"%s\" - Traffic".format(inst),
                                vlabel: "Bytes/s",
@@ -83,7 +82,7 @@ return baseclass.extend({
                                        }
                                });
                        } else {
-                               console.error('Source "value" not found in any user instances:', sources);
+                               console.error('Source "value" not found in any user instances.');
                        }
                }
 
index 335e976794d7bdb1c1cef99847ce611f7f730189..0a30f5bc622aac34a0c4312bdc8fb7684e163353 100644 (file)
@@ -6,8 +6,8 @@
 return baseclass.extend({
        title: _('Ping'),
 
-       rrdargs: function(graph, host, plugin, plugin_instance, dtype) {
-               var ping = {
+       rrdargs(graph, host, plugin, plugin_instance, dtype) {
+               const ping = {
                        title: "%H: ICMP Round Trip Time",
                        vlabel: "ms",
                        number_format: "%5.1lf ms",
@@ -25,7 +25,7 @@ return baseclass.extend({
                        }
                };
 
-               var droprate = {
+               const droprate = {
                        title: "%H: ICMP Drop Rate",
                        vlabel: "%",
                        y_min: "0",
@@ -44,7 +44,7 @@ return baseclass.extend({
                        }
                };
 
-               var stddev = {
+               const stddev = {
                        title: "%H: ICMP Standard Deviation",
                        vlabel: "ms",
                        y_min: "0",
index 9087b8e33cf05ea06b4b001b3d6c7565b750d944..9f5a7c4e8ac343dafc192a4f638dfd02ffca6f96 100644 (file)
@@ -6,7 +6,7 @@
 return baseclass.extend({
        title: _('Processes'),
 
-       rrdargs: function(graph, host, plugin, plugin_instance, dtype) {
+       rrdargs(graph, host, plugin, plugin_instance, dtype) {
                if (plugin_instance == "") {
                        return {
                                title: "%H: Processes",
index f612e39f6b9bc29a9ff111d5a557ff14ed295799..f4d9c484a5ca86e715bb58a8ea44178513569ecb 100644 (file)
@@ -6,9 +6,9 @@
 return baseclass.extend({
        title: _('Sensors'),
 
-       rrdargs: function(graph, host, plugin, plugin_instance, dtype) {
-               var rv = [];
-               var types = graph.dataTypes(host, plugin, plugin_instance);
+       rrdargs(graph, host, plugin, plugin_instance, dtype) {
+               const rv = [];
+               const types = graph.dataTypes(host, plugin, plugin_instance);
 
                if (types.indexOf('temperature') > -1) {
                        rv.push({
index 27e47d2ac0605e8db46fb65bb4772650622a54f5..1852863202600a318dc2e0b514841bf6a012b5bb 100644 (file)
@@ -6,9 +6,9 @@
 return baseclass.extend({
        title: _('SNMP6'),
 
-       rrdargs: function(graph, host, plugin, plugin_instance, dtype) {
+       rrdargs(graph, host, plugin, plugin_instance, dtype) {
 
-               var traffic = {
+               const traffic = {
                        title: "%H: IPv6 on %pi",
                        vlabel: "Bytes/s",
 
@@ -34,7 +34,7 @@ return baseclass.extend({
                        }
                };
 
-               var mcast_traffic = {
+               const mcast_traffic = {
                        title: "%H: IPv6 Multicast-Traffic on %pi",
                        vlabel: "Bytes/s",
 
@@ -61,7 +61,7 @@ return baseclass.extend({
                };
 
 
-               var bcast_traffic = {
+               const bcast_traffic = {
                        title: "%H: IPv6 Broadcast-Traffic on %pi",
                        vlabel: "Bytes/s",
 
index 33df893f865baf745b019868fa5113db515d8572..c032f1411aea4faa8d3d9f1013ea26dc84768cac 100644 (file)
@@ -9,7 +9,7 @@
 return baseclass.extend({
        title: _('Splash Leases'),
 
-       rrdargs: function(graph, host, plugin, plugin_instance, dtype) {
+       rrdargs(graph, host, plugin, plugin_instance, dtype) {
                return {
                        title: "%H: Splash Leases",
                        vlabel: "Active Clients",
index bde179602b8232d06d9214b71f67496f936bfd0e..d8de5e86c3701e4da12da68ab4148239abf33388 100644 (file)
@@ -6,8 +6,8 @@
 return baseclass.extend({
        title: _('SQM'),
 
-       rrdargs: function(graph, host, plugin, plugin_instance, dtype) {
-               var overview = {
+       rrdargs(graph, host, plugin, plugin_instance, dtype) {
+               const overview = {
                        per_instance: false,
                        title: "%H: SQM qdisc %pi Overview",
                        rrdopts: [ "--logarithmic" ],
index a45c43af445e7a1b7b03a405e6e6b70ab3171495..3a4e296e9388bc3310bde231c9ededf50c6d31d3 100644 (file)
@@ -6,8 +6,8 @@
 return baseclass.extend({
        title: _('SQM-Cake'),
 
-       rrdargs: function(graph, host, plugin, plugin_instance, dtype) {
-               var tindrops = {
+       rrdargs(graph, host, plugin, plugin_instance, dtype) {
+               const tindrops = {
                        per_instance: true,
                        title: "%H: CAKE %pi %di Drops/s & Backlog",
                        vlabel: "Bytes & Drops/s",
@@ -25,7 +25,7 @@ return baseclass.extend({
                        }
                };
 
-               var tinlatency = {
+               const tinlatency = {
                        per_instance: true,
                        title: "%H: CAKE %pi %di Latency",
                        vlabel: "ms",
@@ -42,7 +42,7 @@ return baseclass.extend({
                        }
                };
 
-               var tinflows = {
+               const tinflows = {
                        per_instance: true,
                        title: "%H: CAKE %pi %di Flow Counts",
                        vlabel: "Flows",
@@ -58,7 +58,7 @@ return baseclass.extend({
                        }
                };
 
-               var tinbytes = {
+               const tinbytes = {
                        per_instance: true,
                        title: "%H: CAKE %pi %di Traffic",
                        vlabel: "Kb/s",
index 626e2c64bcf2f51704c4cfc633b2f23c8107de33..d3634bb14bf6368edc36000bc4c937d84d19182b 100644 (file)
@@ -6,7 +6,7 @@
 return baseclass.extend({
        title: _('TCP Connections'),
 
-       rrdargs: function(graph, host, plugin, plugin_instance, dtype) {
+       rrdargs(graph, host, plugin, plugin_instance, dtype) {
                return {
                        title: "%H: TCP connections to port %pi",
                        vlabel: "Connections/s",
index a94c83bdf5628ae7c47f162770ea563c5554ceee..bf87da95d5f5c4cccecbdd454064632892ab497a 100644 (file)
@@ -6,7 +6,7 @@
 return baseclass.extend({
        title: _('Thermal'),
 
-       rrdargs: function(graph, host, plugin, plugin_instance, dtype) {
+       rrdargs(graph, host, plugin, plugin_instance, dtype) {
                return {
                        title: "%H: Temperature of %pi",
                        alt_autoscale: true,
index 7a8d4b250a25b094dc947ede4a58183020f547d9..801263372668b62f55919d2d24e41c4b26e8f3e2 100644 (file)
@@ -14,7 +14,7 @@ You may obtain a copy of the License at
 return baseclass.extend({
        title: _('Uptime'),
 
-       rrdargs: function(graph, host, plugin, plugin_instance, dtype) {
+       rrdargs(graph, host, plugin, plugin_instance, dtype) {
                return {
                        title: "%H: Uptime",
                        vlabel: "seconds",
index 06921a3f76bb537dd1b3608689b95838ecedfa9d..3a58356bc3447d673f90a399da03926dcf1e44fb 100644 (file)
@@ -6,7 +6,7 @@
 return baseclass.extend({
        title: _('Users'),
 
-       rrdargs: function(graph, host, plugin, plugin_instance, dtype) {
+       rrdargs(graph, host, plugin, plugin_instance, dtype) {
                return {
                        title: "%H: Users (console logins)",
                        vlabel: "count",
index dd045ebde5feed148e08d7af7ac87f62ece50af6..85dbbf4c249c515e70765167ca1d471c69744322 100644 (file)
@@ -7,18 +7,16 @@
 'require form';
 
 return view.extend({
-       load: function() {
+       load() {
                return Promise.all([
                        fs.list('/usr/lib/collectd'),
                        fs.list('/usr/share/luci/statistics/plugins'),
                        uci.load('luci_statistics')
-               ]).then(function(data) {
-                       var installed = data[0],
-                           plugins = data[1],
-                           tasks = [];
+               ]).then(function([installed, plugins]) {
+                       const tasks = [];
 
-                       for (var i = 0; i < plugins.length; i++) {
-                               tasks.push(fs.read_direct('/usr/share/luci/statistics/plugins/' + plugins[i].name, 'json').then(L.bind(function(name, spec) {
+                       for (let plugin of plugins) {
+                               tasks.push(fs.read_direct('/usr/share/luci/statistics/plugins/' + plugin.name, 'json').then(L.bind(function(name, spec) {
                                        return L.resolveDefault(L.require('view.statistics.plugins.' + name)).then(function(form) {
                                                if (!uci.get('luci_statistics', 'collectd_' + name))
                                                        uci.add('luci_statistics', 'statistics', 'collectd_' + name);
@@ -30,18 +28,18 @@ return view.extend({
                                                        installed: installed.filter(function(e) { return e.name == name + '.so' }).length > 0
                                                };
                                        });
-                               }, this, plugins[i].name.replace(/\.json$/, ''))));
+                               }, this, plugin.name.replace(/\.json$/, ''))));
                        }
 
                        return Promise.all(tasks);
                });
        },
 
-       render: function(plugins) {
-               var m, s, o, enabled;
+       render(plugins) {
+               let m, s, o, enabled;
 
-               for (var i = 0; i < plugins.length; i++)
-                       plugins[plugins[i].name] = plugins[i];
+               for (let plugin of plugins)
+                       plugins[plugin.name] = plugin;
 
                m = new form.Map('luci_statistics', _('Collectd Settings'));
                m.tabbed = true;
@@ -82,21 +80,21 @@ return view.extend({
                o.optional = true;
                o.depends('Hostname', '');
 
-               var groupNames = [
+               let groupNames = [
                        'general', _('General plugins'),
                        'network', _('Network plugins'),
                        'output', _('Output plugins')
                ];
 
-               for (var i = 0; i < groupNames.length; i += 2) {
+               for (let i = 0; i < groupNames.length; i += 2) {
                        s = m.section(form.GridSection, 'statistics_' + groupNames[i], groupNames[i + 1]);
 
                        s.cfgsections = L.bind(function(category) {
                                return this.map.data.sections('luci_statistics', 'statistics')
                                        .map(function(s) { return s['.name'] })
                                        .filter(function(section_id) {
-                                               var name = section_id.replace(/^collectd_/, ''),
-                                                   plugin = plugins[name];
+                                               const name = section_id.replace(/^collectd_/, '');
+                                               const plugin = plugins[name];
 
                                                return (section_id.indexOf('collectd_') == 0 && plugin != null &&
                                                        plugin.installed && plugin.spec.category == category);
@@ -104,8 +102,8 @@ return view.extend({
                        }, s, groupNames[i]);
 
                        s.sectiontitle = function(section_id) {
-                               var name = section_id.replace(/^collectd_/, ''),
-                                   plugin = plugins[name];
+                               const name = section_id.replace(/^collectd_/, '');
+                               const plugin = plugins[name];
 
                                return plugin ? plugin.spec.title : name
                        };
@@ -114,7 +112,7 @@ return view.extend({
                        enabled.editable = true;
                        enabled.modalonly = false;
                        enabled.renderWidget = function(section_id, option_index, cfgvalue) {
-                               var widget = form.Flag.prototype.renderWidget.apply(this, [section_id, option_index, cfgvalue]);
+                               const widget = form.Flag.prototype.renderWidget.apply(this, [section_id, option_index, cfgvalue]);
 
                                widget.querySelector('input[type="checkbox"]').addEventListener('click', L.bind(function(section_id, plugin, ev) {
                                        if (ev.target.checked && plugin && plugin.form.addFormOptions)
@@ -128,27 +126,27 @@ return view.extend({
                        o.width = '50%';
                        o.modalonly = false;
                        o.textvalue = function(section_id) {
-                               var name = section_id.replace(/^collectd_/, ''),
-                                   section = uci.get('luci_statistics', section_id),
-                                   plugin = plugins[name];
+                               const name = section_id.replace(/^collectd_/, '');
+                               const section = uci.get('luci_statistics', section_id);
+                               const plugin = plugins[name];
 
                                if (section.enable != '1')
                                        return E('em', {}, [_('Plugin is disabled')]);
 
-                               var summary = plugin ? plugin.form.configSummary(section) : null;
+                               const  summary = plugin ? plugin.form.configSummary(section) : null;
                                return summary || E('em', _('none'));
                        };
 
                        s.modaltitle = function(section_id) {
-                               var name = section_id.replace(/^collectd_/, ''),
-                                   plugin = plugins[name];
+                               const name = section_id.replace(/^collectd_/, '');
+                               const plugin = plugins[name];
 
                                return plugin ? plugin.form.title : null;
                        };
 
                        s.addModalOptions = function(s) {
-                               var name = s.section.replace(/^collectd_/, ''),
-                                   plugin = plugins[name];
+                               const name = s.section.replace(/^collectd_/, '');
+                               const plugin = plugins[name];
 
                                if (!plugin)
                                        return;
@@ -157,7 +155,7 @@ return view.extend({
 
                                plugin.form.addFormOptions(s);
 
-                               var opt = s.children.filter(function(o) { return o.option == 'enable' })[0];
+                               const opt = s.children.filter(function(o) { return o.option == 'enable' })[0];
                                if (opt)
                                        opt.cfgvalue = function(section_id, set_value) {
                                                if (arguments.length == 2)
@@ -168,10 +166,10 @@ return view.extend({
                        };
 
                        s.renderRowActions = function(section_id) {
-                               var name = section_id.replace(/^collectd_/, ''),
-                                   plugin = plugins[name];
+                               const name = section_id.replace(/^collectd_/, '');
+                               const plugin = plugins[name];
 
-                               var trEl = this.super('renderRowActions', [ section_id, _('Configure…') ]);
+                               const trEl = this.super('renderRowActions', [ section_id, _('Configure…') ]);
 
                                if (!plugin || !plugin.form.addFormOptions)
                                        dom.content(trEl, null);
index 479dcbcbbcbb3ed76bc567ecff960dda51a77397..e85ca69c9427528b08e2998ac4fe774ee7462c98 100644 (file)
@@ -11,11 +11,11 @@ var pollFn = null,
     activeInstance = null;
 
 return view.extend({
-       load: function() {
+       load() {
                return rrdtool.load();
        },
 
-       updatePluginTab: function(host, span, time, ev) {
+       updatePluginTab(host, span, time, ev) {
                var container = ev.target,
                    width = Math.max(200, container.offsetWidth - 100),
                    plugin = ev.detail.tab,
@@ -75,7 +75,7 @@ return view.extend({
                                        'data-plugin': plugin,
                                        'data-plugin-instance': plugin_instance,
                                        'data-is-index': i || render_instances.length == 1 ? null : true,
-                                       'cbi-tab-active': function(ev) { activeInstance = ev.target.getAttribute('data-plugin-instance') }
+                                       'cbi-tab-active'(ev) { activeInstance = ev.target.getAttribute('data-plugin-instance') }
                                }, blobs.map(function(blob) {
                                        return E('img', {
                                                'src': URL.createObjectURL(new Blob([blob], { type: 'image/png' }))
@@ -90,7 +90,7 @@ return view.extend({
                });
        },
 
-       updateGraphs: function(host, span, time, container, ev) {
+       updateGraphs(host, span, time, container, ev) {
                var plugin_names = rrdtool.pluginNames(host.value);
 
                container.querySelectorAll('img').forEach(function(img) {
@@ -122,7 +122,7 @@ return view.extend({
                ui.tabs.initTabGroup(container.childNodes);
        },
 
-       refreshGraphs: function(host, span, time, container) {
+       refreshGraphs(host, span, time, container) {
                var div = document.querySelector('[data-plugin="%s"][data-plugin-instance="%s"]'.format(activePlugin, activeInstance || '')),
                    width = Math.max(200, container.offsetWidth - 100),
                    render_instances = activeInstance.split(/\|/);
@@ -155,7 +155,7 @@ return view.extend({
                });
        },
 
-       togglePolling: function(host, span, time, container, ev) {
+       togglePolling(host, span, time, container, ev) {
                var btn = ev.currentTarget;
 
                if (pollFn) {
@@ -169,25 +169,25 @@ return view.extend({
                }
        },
 
-       render: function() {
+       render() {
                var hosts = rrdtool.hostInstances();
                return hosts.length ? this.renderGraphs() : this.renderNoData();
        },
 
-       renderNoData: function() {
+       renderNoData() {
                ui.showModal(_('No RRD data found'), [
                        E('p', {}, _('There is no RRD data available yet to render graphs.')),
                        E('p', {}, _('You need to configure <em>collectd</em> to gather data into <em>.rrd</em> files.')),
                        E('div', { 'class': 'right' }, [
                                E('button', {
                                        'class': 'cbi-button',
-                                       'click': function(ev) { location.href = 'collectd' }
+                                       'click'(ev) { location.href = 'collectd' }
                                }, [ _('Set up collectd') ])
                        ])
                ]);
        },
 
-       renderGraphs: function() {
+       renderGraphs() {
                var hostSel = E('select', { 'style': 'max-width:170px', 'data-name': 'host' }, rrdtool.hostInstances().map(function(host) {
                        return E('option', {
                                'selected': (rrdtool.opts.host == host) ? 'selected' : null
index 32f0cecdabebea20879ad524beee0c1847095c2b..cba4b9ee6892ac3c74cd12972ca252be3771a37c 100644 (file)
@@ -6,8 +6,8 @@ return baseclass.extend({
        title: _('APCUPS Plugin Configuration'),
        description: _('The APCUPS plugin collects statistics about the APC UPS.'),
 
-       addFormOptions: function(s) {
-               var o;
+       addFormOptions(s) {
+               let o;
 
                o = s.option(form.Flag, 'enable', _('Enable this plugin'));
 
@@ -22,7 +22,7 @@ return baseclass.extend({
                o.depends('enable', '1');
        },
 
-       configSummary: function(section) {
+       configSummary(section) {
                return _('Monitoring APC UPS at host %s, port %d').format(section.Host || 'localhost', section.Port || 3551);
        }
 });
index 7dc98f3389768b7e338a543943b227e69556d604..b3213441b15e3838321fd41f57bdc85087a403be 100644 (file)
@@ -6,8 +6,8 @@ return baseclass.extend({
        title: _('Chrony Plugin Configuration'),
        description: _('The chrony plugin will monitor chrony NTP server statistics'),
 
-       addFormOptions: function(s) {
-               var o;
+       addFormOptions(s) {
+               let o;
 
                o = s.option(form.Flag, 'enable', _('Enable this plugin'));
 
@@ -28,7 +28,7 @@ return baseclass.extend({
                o.depends('enable', '1');
        },
 
-       configSummary: function(section) {
+       configSummary(section) {
                return _('Chrony monitoring enabled');
        }
 });
index ac859c8553e0955f54c514e8b4c16741d088c92a..fe046872e1764efdeb80b4517cf6aee9a72650f2 100644 (file)
@@ -6,7 +6,7 @@ return baseclass.extend({
        title: _('Conntrack Plugin Configuration'),
        description: _('The conntrack plugin collects statistics about the number of tracked connections.'),
 
-       configSummary: function(section) {
+       configSummary(section) {
                return _('Conntrack monitoring enabled');
        }
 });
index d978a556c22ac8ce02a1174620d14ecfa8bafc84..4f16f204ed743d12f7701796a5c0e23faafecbcb 100644 (file)
@@ -6,7 +6,7 @@ return baseclass.extend({
        title: _('CPU Context Switches Plugin Configuration'),
        description: _('This plugin collects statistics about the processor context switches.'),
 
-       configSummary: function(section) {
+       configSummary(section) {
                return _('Context switch monitoring enabled');
        }
 });
index e013e80cd90784af6a83507a84a43be16a0faf5a..13bd7d991b3ce0b65b074f53a62d0f31dc71daf5 100644 (file)
@@ -6,8 +6,8 @@ return baseclass.extend({
        title: _('CPU Plugin Configuration'),
        description: _('The cpu plugin collects basic statistics about the processor usage.'),
 
-       addFormOptions: function(s) {
-               var o;
+       addFormOptions(s) {
+               let o;
 
                o = s.option(form.Flag, 'enable', _('Enable this plugin'));
 
@@ -36,7 +36,7 @@ return baseclass.extend({
                o.depends({ 'enable': '1', 'ReportByCpu': '1', 'ReportByState': '1' });
        },
 
-       configSummary: function(section) {
+       configSummary(section) {
                return _('CPU monitoring is enabled');
        }
 });
index 636ac8f7c7210d1a10929d15586b393d682f85fe..b8a91375e238d8c5b8dfcfbb0952032f38666e28 100644 (file)
@@ -6,8 +6,8 @@ return baseclass.extend({
        title: _('CPU Frequency Plugin Configuration'),
        description: _('This plugin collects statistics about the processor frequency scaling.'),
 
-       addFormOptions: function(s) {
-               var o;
+       addFormOptions(s) {
+               let o;
 
                o = s.option(form.Flag, 'enable', _('Enable this plugin'));
                o.default = '0';
@@ -17,7 +17,7 @@ return baseclass.extend({
                o.depends('enable', '1');
        },
 
-       configSummary: function(section) {
+       configSummary(section) {
                return (section.ExtraItems == '1')
                        ? _('Detailled CPU frequency monitoring enabled')
                        : _('Simple CPU frequency monitoring enabled');
index 87d8c9f6b7cdc7453813290894f4081f6de6c447..16c871e2c5541eee4136fecefcaf840d67a10d27 100644 (file)
@@ -6,8 +6,8 @@ return baseclass.extend({
        title: _('CSV Plugin Configuration'),
        description: _('The csv plugin stores collected data in csv file format for further processing by external programs.'),
 
-       addFormOptions: function(s) {
-               var o;
+       addFormOptions(s) {
+               let o;
 
                o = s.option(form.Flag, 'enable', _('Enable this plugin'));
 
@@ -19,7 +19,7 @@ return baseclass.extend({
                o.depends('enable', '1');
        },
 
-       configSummary: function(section) {
+       configSummary(section) {
                if (section.DataDir)
                        return _('Storing CSV data in %s').format(section.DataDir);
        }
index 60a167c24458244a657cc69d0b2ab2ad77f0631b..a2ecf65cc830a4c31b88b5d9d1eb8a2ae9fdd2cf 100644 (file)
@@ -5,8 +5,8 @@
 return baseclass.extend({
        title: _('cUrl Plugin Configuration'),
 
-       addFormOptions: function(s) {
-               var o, ss;
+       addFormOptions(s) {
+               let o, ss;
 
                o = s.option(form.Flag, 'enable', _('Enable this plugin'));
 
@@ -27,7 +27,7 @@ return baseclass.extend({
                o = ss.option(form.Value, 'url', _('URL'));
        },
 
-       configSummary: function(section) {
+       configSummary(section) {
                return _('cURL plugin enabled');
        }
 });
index 2a82f64d5aa8457113a463a2bbb9791aceefb215..81bf218e40f57a089f4b5a9a39d5b7ca7e6375a9 100644 (file)
@@ -7,8 +7,8 @@ return baseclass.extend({
        title: _('DF Plugin Configuration'),
        description: _('The df plugin collects statistics about the disk space usage on different devices, mount points or filesystem types.'),
 
-       addFormOptions: function(s) {
-               var o;
+       addFormOptions(s) {
+               let o;
 
                o = s.option(form.Flag, 'enable', _('Enable this plugin'));
 
@@ -17,18 +17,18 @@ return baseclass.extend({
                o.depends('enable', '1');
                o.load = function(section_id) {
                        return fs.lines('/proc/partitions').then(L.bind(function(lines) {
-                               var parts = [];
+                               const parts = [];
 
-                               for (var i = 0; i < lines.length; i++) {
-                                       var line = L.toArray(lines[i]);
+                               for (let l of lines) {
+                                       const line = L.toArray(l);
                                        if (!isNaN(line[0]))
                                                parts.push('/dev/' + line[3]);
                                }
 
                                parts.sort();
 
-                               for (var i = 0; i < parts.length; i++)
-                                       this.value(parts[i]);
+                               for (let p of parts)
+                                       this.value(p);
 
                                return this.super('load', [section_id]);
                        }, this));
@@ -40,17 +40,17 @@ return baseclass.extend({
                o.depends('enable', '1');
                o.load = function(section_id) {
                        return fs.lines('/proc/mounts').then(L.bind(function(lines) {
-                               var mounts = {};
+                               let mounts = {};
 
-                               for (var i = 0; i < lines.length; i++) {
-                                       var line = L.toArray(lines[i]);
+                               for (let l of lines) {
+                                       const line = L.toArray(l);
                                        mounts[line[1]] = true;
                                }
 
                                mounts = Object.keys(mounts).sort();
 
-                               for (var i = 0; i < mounts.length; i++)
-                                       this.value(mounts[i]);
+                               for (let m of mounts)
+                                       this.value(m);
 
                                return this.super('load', [section_id]);
                        }, this));
@@ -65,11 +65,11 @@ return baseclass.extend({
                                fs.lines('/etc/filesystems'),
                                fs.lines('/proc/filesystems')
                        ]).then(L.bind(function(lines) {
-                               var fslines = lines[0].concat(lines[1]),
-                                   fstypes = {};
+                               const fslines = lines[0].concat(lines[1]);
+                               let fstypes = {};
 
-                               for (var i = 0; i < fslines.length; i++) {
-                                       var line = L.toArray(fslines[i]);
+                               for (let fsl of fslines) {
+                                       var line = L.toArray(fsl);
 
                                        if (line.length == 2 && line[0] == 'nodev')
                                                continue;
@@ -79,8 +79,8 @@ return baseclass.extend({
 
                                fstypes = Object.keys(fstypes).sort();
 
-                               for (var i = 0; i < fstypes.length; i++)
-                                       this.value(fstypes[i]);
+                               for (let fst of fstypes)
+                                       this.value(fst);
 
                                return this.super('load', [section_id]);
                        }, this));
@@ -93,12 +93,12 @@ return baseclass.extend({
                o.depends('enable', '1');
        },
 
-       configSummary: function(section) {
-               var devs = L.toArray(section.Devices),
-                   mounts = L.toArray(section.MountPoints),
-                   fstypes = L.toArray(section.FSTypes),
-                   count = devs.length + mounts.length + fstypes.length,
-                   invert = section.IgnoreSelected == '1';
+       configSummary(section) {
+               const devs = L.toArray(section.Devices);
+               const mounts = L.toArray(section.MountPoints);
+               const fstypes = L.toArray(section.FSTypes);
+               const count = devs.length + mounts.length + fstypes.length;
+               const invert = section.IgnoreSelected == '1';
 
                if (count == 0)
                        return _('Monitoring all partitions');
index df185f7d8ccda40bc97ce66ecb76ded04f6d6589..5c64afedb3484fcac3e0f15e6c6d6a3d61b83ee4 100644 (file)
@@ -6,8 +6,8 @@ return baseclass.extend({
        title: _('DHCP Leases Plugin Configuration'),
        description: _('The dhcpleases plugin collects information about assigned DHCP leases.'),
 
-       addFormOptions: function(s) {
-               var o;
+       addFormOptions(s) {
+               let o;
 
                o = s.option(form.Flag, 'enable', _('Enable this plugin'));
 
@@ -15,7 +15,7 @@ return baseclass.extend({
                o.default = '/tmp/dhcp.leases';
        },
 
-       configSummary: function(section) {
+       configSummary(section) {
                return _('Monitoring DHCP leases enabled');
        }
 });
index c36df10258e16b2c11d52fb3c5e6791f5537a58c..a2e76cbec71d1762e45b9b1deaf712c160e34843 100644 (file)
@@ -7,8 +7,8 @@ return baseclass.extend({
        title: _('Disk Plugin Configuration'),
        description: _('The disk plugin collects detailed usage statistics for selected partitions or whole disks.'),
 
-       addFormOptions: function(s) {
-               var o;
+       addFormOptions(s) {
+               let o;
 
                o = s.option(form.Flag, 'enable', _('Enable this plugin'));
 
@@ -17,10 +17,10 @@ return baseclass.extend({
                o.depends('enable', '1');
                o.load = function(section_id) {
                        return fs.trimmed('/proc/partitions').then(L.bind(function(str) {
-                               var lines = (str || '').split(/\n/);
+                               const lines = (str || '').split(/\n/);
 
-                               for (var i = 0; i < lines.length; i++) {
-                                       var m = lines[i].match(/^ +[0-9]+ +[0-9]+ +[0-9]+ (\S+)$/);
+                               for (let line of lines) {
+                                       const m = line.match(/^ +[0-9]+ +[0-9]+ +[0-9]+ (\S+)$/);
                                        if (m)
                                                this.value(m[1]);
                                }
@@ -33,9 +33,9 @@ return baseclass.extend({
                o.depends('enable', '1');
        },
 
-       configSummary: function(section) {
-               var disks = L.toArray(section.Disks),
-                   invert = section.IgnoreSelected == '1';
+       configSummary(section) {
+               const disks = L.toArray(section.Disks);
+               const invert = section.IgnoreSelected == '1';
 
                if (disks.length == 0)
                        return _('Monitoring all disks');
index 1e130e0236897dbca1d30569c633716881fcfd7b..8dc86ab2b57ba6be0bdf35cd0105f948d2413a23 100644 (file)
@@ -7,8 +7,8 @@ return baseclass.extend({
        title: _('DNS Plugin Configuration'),
        description: _('The dns plugin collects detailed statistics about dns related traffic on selected interfaces.'),
 
-       addFormOptions: function(s) {
-               var o;
+       addFormOptions(s) {
+               let o;
 
                o = s.option(form.Flag, 'enable', _('Enable this plugin'));
 
@@ -25,8 +25,8 @@ return baseclass.extend({
                o.depends('enable', '1');
        },
 
-       configSummary: function(section) {
-               var ifaces = L.toArray(section.Interfaces);
+       configSummary(section) {
+               const ifaces = L.toArray(section.Interfaces);
 
                if (ifaces.length == 0)
                        return _('Monitoring DNS queries on all interfaces');
index 1ab44f31ccda4f25bcee8c3462d9194eebdec4dc..3d260ede37a275fbea22eea1a8cf01ff918d2e35 100644 (file)
@@ -7,8 +7,8 @@ return baseclass.extend({
        title: _('E-Mail Plugin Configuration'),
        description: _('The email plugin creates a unix socket which can be used to transmit email-statistics to a running collectd daemon. This plugin is primarily intended to be used in conjunction with Mail::SpamAssasin::Plugin::Collectd but can be used in other ways as well.'),
 
-       addFormOptions: function(s) {
-               var o;
+       addFormOptions(s) {
+               let o;
 
                o = s.option(form.Flag, 'enable', _('Enable this plugin'));
 
@@ -42,7 +42,7 @@ return baseclass.extend({
                o.depends('enable', '1');
        },
 
-       configSummary: function(section) {
+       configSummary(section) {
                if (section.SocketFile)
                        return _('Awaiting email input at %s').format(section.SocketFile);
        }
index ffe679194aa96e7f1e8d3979a3754d9ae96b049c..39a0d9e18f13b98b968d68ee01f10790c1cef8d2 100644 (file)
@@ -6,7 +6,7 @@ return baseclass.extend({
        title: _('Entropy Plugin Configuration'),
        description: _('The entropy plugin collects statistics about the available entropy.'),
 
-       configSummary: function(section) {
+       configSummary(section) {
                return _('Entropy monitoring enabled');
        }
 });
index d19714427166970b4a085940beb51120c93629e7..07620d1f2448250f81c5c7211c72bd2307f07f4b 100644 (file)
@@ -7,8 +7,8 @@ return baseclass.extend({
        title: _('Exec Plugin Configuration'),
        description: _('The exec plugin starts external commands to read values from or to notify external processes when certain threshold values have been reached.'),
 
-       addFormOptions: function(s) {
-               var o, ss;
+       addFormOptions(s) {
+               let o, ss;
 
                o = s.option(form.Flag, 'enable', _('Enable this plugin'));
 
@@ -53,7 +53,7 @@ return baseclass.extend({
                o.optional = true;
        },
 
-       configSummary: function(section) {
+       configSummary(section) {
                return _('Command monitoring enabled');
        }
 });
index 6ea79a6275599e38d8375e6245614e8fc5ee0cb6..38dab725e322f2b8978b8294998c30f39f00e42b 100644 (file)
@@ -7,8 +7,8 @@ return baseclass.extend({
        title: _('Interface Plugin Configuration'),
        description: _('The interface plugin collects traffic statistics on selected interfaces.'),
 
-       addFormOptions: function(s) {
-               var o;
+       addFormOptions(s) {
+               let o;
 
                o = s.option(form.Flag, 'enable', _('Enable this plugin'));
 
@@ -22,9 +22,9 @@ return baseclass.extend({
                o.depends('enable', '1');
        },
 
-       configSummary: function(section) {
-               var ifaces = L.toArray(section.Interfaces),
-                   invert = section.IgnoreSelected == '1';
+       configSummary(section) {
+               const ifaces = L.toArray(section.Interfaces);
+               const invert = section.IgnoreSelected == '1';
 
                if (ifaces.length == 0)
                        return _('Monitoring all interfaces');
index 1a41a284f3c091f68b864e95ce9fce2939a4b445..ed72bb058f8921f24e6530ccd9c4ee6519048877 100644 (file)
@@ -7,7 +7,7 @@ return baseclass.extend({
        title: _('IP-Statistics Plugin Configuration'),
        description: _('The ipstatistics plugin collects IPv4 and IPv6 statistics to compare them.'),
 
-       configSummary: function(section) {
+       configSummary(section) {
                return _('IPv4/IPv6 Statistics monitoring enabled');
        }
 });
index 6dcaf26de640f8f23a799dec098189f1fbba5cc1..81616bfb38c030ef5aef6cb849779110a0c5831e 100644 (file)
@@ -8,13 +8,13 @@ return baseclass.extend({
        title: _('Iptables Plugin Configuration'),
        description: _('The iptables plugin will monitor selected firewall rules and collect information about processed bytes and packets per rule.'),
 
-       addFormOptions: function(s) {
-               var o, ss;
+       addFormOptions(s) {
+               let o, ss;
 
                o = s.option(form.Flag, 'enable', _('Enable this plugin'));
 
-               for (var family = 4; family <= 6; family += 2) {
-                       var suffix = (family == 4 ? '' : '6');
+               for (let family = 4; family <= 6; family += 2) {
+                       const suffix = (family == 4 ? '' : '6');
 
                        o = s.option(form.SectionValue, '__match' + suffix, form.TableSection, 'collectd_iptables_match' + suffix,
                                suffix ? _('Match IPv6 iptables rules') : _('Match IPv4 iptables rules'),
@@ -23,17 +23,18 @@ return baseclass.extend({
                        o.depends('enable', '1');
                        o.load = L.bind(function(suffix, section_id) {
                                return L.resolveDefault(fs.exec_direct('/usr/sbin/ip' + suffix + 'tables-save', []), '').then(L.bind(function(res) {
-                                       var lines = res.split(/\n/),
-                                           table, chain, count, iptables = {};
+                                       const lines = res.split(/\n/);
+                                       let table, count;
+                                       const iptables = {};
 
-                                       for (var i = 0; i < lines.length; i++) {
-                                               var m;
+                                       for (let line of lines) {
+                                               let m;
 
-                                               if ((m = lines[i].match(/^\*(\S+)$/)) != null) {
+                                               if ((m = line.match(/^\*(\S+)$/)) != null) {
                                                        table = m[1];
                                                        count = {};
                                                }
-                                               else if ((m = lines[i].match(/^-A (.+?) ([!-].+)$/)) != null) {
+                                               else if ((m = line.match(/^-A (.+?) ([!-].+)$/)) != null) {
                                                        count[m[1]] = (count[m[1]] || 0) + 1;
 
                                                        iptables[table] = iptables[table] || {};
@@ -50,7 +51,7 @@ return baseclass.extend({
                                                         * collectd currently does not support comments with spaces:
                                                         * https://github.com/collectd/collectd/issues/2766
                                                         */
-                                                       var c = m[2].match(/-m comment --comment "(.+)" -/);
+                                                       const c = m[2].match(/-m comment --comment "(.+)" -/);
                                                        if (c && c[1] != '!fw3' && !c[1].match(/[ \t\n]/))
                                                                iptables[table][m[1]][c[1]] = E('span', {}, [ c[1] ]);
                                                }
@@ -70,8 +71,8 @@ return baseclass.extend({
                        o = ss.option(form.Value, 'name', _('Instance name'));
                        o.datatype = 'maxlength(63)';
                        o.validate = function(section_id, v) {
-                               var table_opt = this.section.children.filter(function(o) { return o.option == 'table' })[0],
-                                   table_elem = table_opt.getUIElement(section_id);
+                               const table_opt = this.section.children.filter(function(o) { return o.option == 'table' })[0];
+                               const table_elem = table_opt.getUIElement(section_id);
 
                                table_elem.clearChoices();
                                table_elem.addChoices(Object.keys(this.section.iptables).sort());
@@ -87,8 +88,8 @@ return baseclass.extend({
                        o.optional = 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],
-                                   chain_elem = chain_opt.getUIElement(section_id);
+                               const chain_opt = this.section.children.filter(function(o) { return o.option == 'chain' })[0];
+                               const chain_elem = chain_opt.getUIElement(section_id);
 
                                chain_elem.clearChoices();
                                chain_elem.addChoices(Object.keys(this.section.iptables[table]).sort());
@@ -100,17 +101,17 @@ return baseclass.extend({
                        o.optional = 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],
-                                   rule_opt = this.section.children.filter(function(o) { return o.option == 'rule' })[0],
-                                   rule_elem = rule_opt.getUIElement(section_id),
-                                   table = table_opt.formvalue(section_id);
+                               const table_opt = this.section.children.filter(function(o) { return o.option == 'table' })[0];
+                               const rule_opt = this.section.children.filter(function(o) { return o.option == 'rule' })[0];
+                               const rule_elem = rule_opt.getUIElement(section_id);
+                               const table = table_opt.formvalue(section_id);
 
                                rule_elem.clearChoices();
 
                                if (this.section.iptables[table][chain]) {
-                                       var keys = Object.keys(this.section.iptables[table][chain]).sort(function(a, b) {
-                                               var x = a.match(/^(\d+)/),
-                                                   y = b.match(/^(\d+)/);
+                                       const keys = Object.keys(this.section.iptables[table][chain]).sort(function(a, b) {
+                                               const x = a.match(/^(\d+)/);
+                                               const y = b.match(/^(\d+)/);
 
                                                if (x && y)
                                                        return +x[1] > +y[1];
@@ -120,10 +121,10 @@ return baseclass.extend({
                                                        return a > b;
                                        });
 
-                                       var labels = {};
+                                       const labels = {};
 
-                                       for (var i = 0; i < keys.length; i++)
-                                               labels[keys[i]] = this.section.iptables[table][chain][keys[i]].cloneNode(true);
+                                       for (let key of keys)
+                                               labels[key] = this.section.iptables[table][chain][key].cloneNode(true);
 
                                        rule_elem.addChoices(keys, labels);
                                }
@@ -138,10 +139,10 @@ return baseclass.extend({
                        o.optional = true;
                        o.transformChoices = function() { return this.super('transformChoices', []) || {} };
                        o.load = function(section_id) {
-                               var table = uci.get('luci_statistics', section_id, 'table'),
-                                   chain = uci.get('luci_statistics', section_id, 'chain'),
-                                   rule = uci.get('luci_statistics', section_id, 'rule'),
-                                   ipt = this.section.iptables;
+                               const table = uci.get('luci_statistics', section_id, 'table');
+                               const chain = uci.get('luci_statistics', section_id, 'chain');
+                               const rule = uci.get('luci_statistics', section_id, 'rule');
+                               const ipt = this.section.iptables;
 
                                if (ipt[table] && ipt[table][chain] && ipt[table][chain][rule])
                                        this.value(rule, ipt[table][chain][rule].cloneNode(true));
@@ -157,7 +158,7 @@ return baseclass.extend({
                }
        },
 
-       configSummary: function(section) {
+       configSummary(section) {
                return _('Rule monitoring enabled');
        }
 });
index 4271a8f819391368151037c8d6274190b77c49ba..ac4b6d7a46c42e37d9bfe28acdf44dcdb93382ee 100644 (file)
@@ -7,8 +7,8 @@ return baseclass.extend({
        title: _('IRQ Plugin Configuration'),
        description: _('The irq plugin will monitor the rate of issues per second for each selected interrupt. If no interrupt is selected then all interrupts are monitored.'),
 
-       addFormOptions: function(s) {
-               var o;
+       addFormOptions(s) {
+               let o;
 
                o = s.option(form.Flag, 'enable', _('Enable this plugin'));
 
@@ -18,19 +18,18 @@ return baseclass.extend({
                o.depends('enable', '1');
                o.load = function(section_id) {
                        return fs.trimmed('/proc/interrupts').then(L.bind(function(str) {
-                               var lines = str.split(/\n/),
-                                   cpus = L.toArray(lines[0]);
+                               const lines = str.split(/\n/);
+                               const cpus = L.toArray(lines[0]);
 
-                               for (var i = 1; i < lines.length; i++) {
-                                       var line = lines[i],
-                                           m = lines[i].match(/^\s*([^\s:]+):/);
+                               for (let line of lines) {
+                                       const m = line.match(/^\s*([^\s:]+):/);
 
                                        if (!m)
                                                continue;
 
                                        line = line.replace(/^[^:]+:\s+/, '');
 
-                                       for (var j = 0; j < cpus.length; j++)
+                                       for (let j = 0; j < cpus.length; j++)
                                                line = line.replace(/^\d+\s*/, '');
 
                                        var desc = line.split(/ {2,}/).join(', ');
@@ -46,9 +45,9 @@ return baseclass.extend({
                o.depends('enable', '1');
        },
 
-       configSummary: function(section) {
-               var irqs = L.toArray(section.Irqs),
-                   invert = section.IgnoreSelected == '1';
+       configSummary(section) {
+               const irqs = L.toArray(section.Irqs);
+               const invert = section.IgnoreSelected == '1';
 
                if (irqs.length == 0)
                        return _('Monitoring all interrupts');
index 868c1f3035517448dd11e34d423cf759739e6179..c4ec7ca6dee009d9a939d3476d8c5afb8ba7db9c 100644 (file)
@@ -7,8 +7,8 @@ return baseclass.extend({
        title: _('Wireless iwinfo Plugin Configuration'),
        description: _('The iwinfo plugin collects statistics about wireless signal strength, noise and quality.'),
 
-       addFormOptions: function(s) {
-               var o;
+       addFormOptions(s) {
+               let o;
 
                o = s.option(form.Flag, 'enable', _('Enable this plugin'));
 
@@ -18,7 +18,7 @@ return baseclass.extend({
                o.noinactive = true;
                o.depends('enable', '1');
                o.filter = function(section_id, name) {
-                       var dev = this.devices.filter(function(dev) { return dev.getName() == name })[0];
+                       const dev = this.devices.filter(function(dev) { return dev.getName() == name })[0];
                        return (dev && dev.getType() == 'wifi');
                };
 
@@ -26,9 +26,9 @@ return baseclass.extend({
                o.depends('enable', '1');
        },
 
-       configSummary: function(section) {
-               var ifaces = L.toArray(section.Interfaces),
-                   invert = section.IgnoreSelected == '1';
+       configSummary(section) {
+               const ifaces = L.toArray(section.Interfaces);
+               const invert = section.IgnoreSelected == '1';
 
                if (ifaces.length == 0)
                        return _('Monitoring all interfaces');
index 25755637c803beb1eef0097feff9b99d78270b18..e1cc0d7d3e2cbee7d2afc14a606e8e0977d41dac 100644 (file)
@@ -6,7 +6,7 @@ return baseclass.extend({
        title: _('Load Plugin Configuration'),
        description: _('The load plugin collects statistics about the general system load.'),
 
-       configSummary: function(section) {
+       configSummary(section) {
                return _('Load monitoring enabled');
        }
 });
index 864857faa37fbbb66eb2bf557a88f4f4530f6df1..f2456de64250627e1bbfab31e737ace438a8f051 100644 (file)
@@ -6,8 +6,8 @@ return baseclass.extend({
        title: _('Memory Plugin Configuration'),
        description: _('The memory plugin collects statistics about the memory usage.'),
 
-       addFormOptions: function(s) {
-               var o;
+       addFormOptions(s) {
+               let o;
 
                o = s.option(form.Flag, 'enable', _('Enable this plugin'));
 
@@ -24,7 +24,7 @@ return baseclass.extend({
                o.depends('enable', '1');
        },
 
-       configSummary: function(section) {
+       configSummary(section) {
                return _('Memory monitoring enabled');
        }
 });
index 73de2f5cf686a355cdbf3203f76f6ffb851ea081..dbd95c9a6ce1f1218832efd4c53f235ada136879 100644 (file)
@@ -5,7 +5,7 @@
 return baseclass.extend({
     title: _('Mqtt Plugin Configuration'),
 
-    addFormOptions: function(s) {
+    addFormOptions(s) {
         let o, ss;
 
         o = s.option(form.Flag, 'enable', _('Sends or receives data via mqtt'));
@@ -95,7 +95,7 @@ return baseclass.extend({
         o.modalonly = true;
     },
 
-    configSummary: function(section) {
+    configSummary(section) {
         return _('Mqtt plugin enabled');
     }
 });
index 8910206929515836f1c62ae117f8775018d721ab..2f4c51b7befaa1f29d8b09a1de53797e1088b450 100644 (file)
@@ -7,8 +7,8 @@ return baseclass.extend({
        title: _('Netlink Plugin Configuration'),
        description: _('The netlink plugin collects extended information like qdisc-, class- and filter-statistics for selected interfaces.'),
 
-       addFormOptions: function(s) {
-               var o;
+       addFormOptions(s) {
+               let o;
 
                o = s.option(form.Flag, 'enable', _('Enable this plugin'));
                o.default = '0';
@@ -42,11 +42,11 @@ return baseclass.extend({
                o.depends('enable', '1');
        },
 
-       configSummary: function(section) {
-               var basic = L.toArray(section.Interfaces),
-                   verbose = L.toArray(section.VerboseInterfaces),
-                   count = basic.length + verbose.length,
-                   invert = section.IgnoreSelected == '1';
+       configSummary(section) {
+               const basic = L.toArray(section.Interfaces);
+               const verbose = L.toArray(section.VerboseInterfaces);
+               const count = basic.length + verbose.length;
+               const invert = section.IgnoreSelected == '1';
 
                if (invert && count == 0)
                        return _('Monitoring all interfaces');
index b184335f18eacfffa351ff6963c8c29be97f9663..ba5551ed979f3f406acdf4240d3afe16493554e7 100644 (file)
@@ -6,8 +6,8 @@ return baseclass.extend({
        title: _('Network Plugin Configuration'),
        description: _('The network plugin provides network based communication between different collectd instances. Collectd can operate both in client and server mode. In client mode locally collected data is transferred to a collectd server instance, in server mode the local instance receives data from other hosts.'),
 
-       addFormOptions: function(s) {
-               var o, ss;
+       addFormOptions(s) {
+               let o, ss;
 
                o = s.option(form.Flag, 'enable', _('Enable this plugin'));
                o.default = '0';
@@ -65,7 +65,7 @@ return baseclass.extend({
                //o.optional = true;
        },
 
-       configSummary: function(section) {
+       configSummary(section) {
                return _('Network communication enabled');
        }
 });
index ca20e11721b2be3c252d2f6c75dbcd859b327382..2b28571f7321b7062c9dc9e26095ed069767c917 100644 (file)
@@ -6,16 +6,14 @@ return baseclass.extend({
        title: _('UPS Plugin Configuration'),
        description: _('The NUT plugin reads information about Uninterruptible Power Supplies.'),
 
-       addFormOptions: function(s) {
-               var o;
+       addFormOptions(s) {
+               s.option(form.Flag, 'enable', _('Enable this plugin'));
 
-               o = s.option(form.Flag, 'enable', _('Enable this plugin'));
-
-               o = s.option(form.Value, 'UPS', _('UPS'), _('UPS name in NUT ups@host format'));
+               s.option(form.Value, 'UPS', _('UPS'), _('UPS name in NUT ups@host format'));
        },
 
-       configSummary: function(section) {
-               var ups = L.toArray(section.UPS);
+       configSummary(section) {
+               const ups = L.toArray(section.UPS);
 
                if (ups.length)
                        return N_(ups.length, 'Monitoring one UPS', 'Monitoring %d UPSes').format(ups.length);
index 4e6eca23441dd11f3f13ce467e754898cc67eba9..1225ed45d6276ab95c35688f8db394227a75c708 100644 (file)
@@ -6,8 +6,8 @@ return baseclass.extend({
        title: _('OLSRd Plugin Configuration'),
        description: _('The OLSRd plugin reads information about meshed networks from the txtinfo plugin of OLSRd.'),
 
-       addFormOptions: function(s) {
-               var o;
+       addFormOptions(s) {
+               let o;
 
                o = s.option(form.Flag, 'enable', _('Enable this plugin'));
 
@@ -40,7 +40,7 @@ return baseclass.extend({
                o.value('Detail');
        },
 
-       configSummary: function(section) {
+       configSummary(section) {
                return _('Monitoring OLSRd status at %s:%d').format(
                        section.Host || 'localhost',
                        section.Port || 2006
index b48ed93a323648fad3cca1d93de2ab42ecbae592..1905f620bbe7d730d95ecfaedb0587af685e4741 100644 (file)
@@ -7,8 +7,8 @@ return baseclass.extend({
        title: _('OpenVPN Plugin Configuration'),
        description: _('The OpenVPN plugin gathers information about the current vpn connection status.'),
 
-       addFormOptions: function(s) {
-               var o;
+       addFormOptions(s) {
+               let o;
 
                o = s.option(form.Flag, 'enable', _('Enable this plugin'));
 
@@ -28,17 +28,17 @@ return baseclass.extend({
                o.depends('enable', '1');
                o.load = function(section_id) {
                        return L.resolveDefault(fs.list('/var/run'), []).then(L.bind(function(entries) {
-                               for (var i = 0; i < entries.length; i++)
-                                       if (entries[i].type == 'file' && entries[i].name.match(/^openvpn\..+\.status$/))
-                                               this.value('/var/run/' + entries[i].name);
+                               for (let entry of entries)
+                                       if (entry.type == 'file' && entry.name.match(/^openvpn\..+\.status$/))
+                                               this.value('/var/run/' + entry.name);
 
                                return this.super('load', [section_id]);
                        }, this));
                };
        },
 
-       configSummary: function(section) {
-               var stats = L.toArray(section.StatusFile);
+       configSummary(section) {
+               const stats = L.toArray(section.StatusFile);
 
                if (stats.length)
                        return N_(stats.length, 'Monitoring one OpenVPN instance', 'Monitoring %d OpenVPN instances').format(stats.length);
index 0c827e8a0b5a22af5360b72bedf7157ec2496e35..518012db19e7212ae9fec56e770829a2b85080f9 100644 (file)
@@ -6,8 +6,8 @@ return baseclass.extend({
        title: _('Ping Plugin Configuration'),
        description: _('The ping plugin will send icmp echo replies to selected hosts and measure the roundtrip time for each host.'),
 
-       addFormOptions: function(s) {
-               var o;
+       addFormOptions(s) {
+               let o;
 
                o = s.option(form.Flag, 'enable', _('Enable this plugin'));
 
@@ -41,8 +41,8 @@ return baseclass.extend({
                o.depends('enable', '1');
        },
 
-       configSummary: function(section) {
-               var hosts = L.toArray(section.Hosts);
+       configSummary(section) {
+               const hosts = L.toArray(section.Hosts);
 
                if (hosts.length)
                        return N_(hosts.length, 'Monitoring one host', 'Monitoring %d hosts').format(hosts.length);
index d29ac8763051dd24716fa26570d4ceb03e8168c4..d72330d1ba6bc5061bc3c30916cbd10c024827a2 100644 (file)
@@ -6,8 +6,8 @@ return baseclass.extend({
        title: _('Processes Plugin Configuration'),
        description: _('The processes plugin collects information like cpu time, page faults and memory usage of selected processes.'),
 
-       addFormOptions: function(s) {
-               var o;
+       addFormOptions(s) {
+               let o;
 
                o = s.option(form.Flag, 'enable', _('Enable this plugin'));
 
@@ -16,8 +16,8 @@ return baseclass.extend({
                o.depends('enable', '1');
        },
 
-       configSummary: function(section) {
-               var processes = L.toArray(section.Processes);
+       configSummary(section) {
+               const processes = L.toArray(section.Processes);
 
                if (processes.length)
                        return N_(processes.length, 'Monitoring one process', 'Monitoring %d processes').format(processes.length);
index 7e2704a2c380237db0a66d8c33f9307a8e9e223e..e59d1d029adfe0e5eccd6d78fd23bc31f58b7556 100644 (file)
@@ -6,8 +6,8 @@ return baseclass.extend({
        title: _('RRDTool Plugin Configuration'),
        description: _('The rrdtool plugin stores the collected data in rrd database files, the foundation of the diagrams.<br /><br /><strong>Warning: Setting the wrong values will result in a very high memory consumption in the temporary directory. This can render the device unusable!</strong>'),
 
-       addFormOptions: function(s) {
-               var o;
+       addFormOptions(s) {
+               let o;
 
                o = s.option(form.Flag, 'enable', _('Enable this plugin'));
 
@@ -77,7 +77,7 @@ return baseclass.extend({
                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');
+                       const flushinp = this.map.findElement('id', 'widget.cbid.luci_statistics.collectd_rrdtool.CacheFlush');
 
                        if (value != '' && !isNaN(value) && +value > 0) {
                                flushinp.placeholder = 10 * +value;
@@ -97,7 +97,7 @@ return baseclass.extend({
                o.datatype = 'uinteger';
        },
 
-       configSummary: function(section) {
+       configSummary(section) {
                if (section.DataDir)
                        return _('Writing *.rrd files to %s').format(section.DataDir);
        }
index a55be1f4f4d168d1c93854301da83da9cac6a6e1..149e82af074d8a5f4838b5fd696628b2019566fe 100644 (file)
@@ -17,8 +17,8 @@ return baseclass.extend({
        title: _('Sensors Plugin Configuration'),
        description: _('The sensors plugin uses the Linux Sensors framework to gather environmental statistics.'),
 
-       addFormOptions: function(s) {
-               var o;
+       addFormOptions(s) {
+               let o;
 
                o = s.option(form.Flag, 'enable', _('Enable this plugin'));
 
@@ -28,12 +28,12 @@ return baseclass.extend({
                o.depends('enable', '1');
                o.load = function(section_id) {
                        return fs.exec_direct('/usr/sbin/sensors', ['-j'], 'json').then(L.bind(function(output) {
-                               for (var bus in output) {
-                                       for (var sensor in output[bus]) {
+                               for (let bus in output) {
+                                       for (let sensor in output[bus]) {
                                                if (!L.isObject(output[bus][sensor]))
                                                        continue;
 
-                                               for (var j = 0; j < sensorTypes.length; j += 2) {
+                                               for (let j = 0; j < sensorTypes.length; j += 2) {
                                                        if (sensor.match(sensorTypes[j])) {
                                                                this.value('%s/%s-%s'.format(bus, sensorTypes[j + 1], sensor));
                                                                break;
@@ -50,9 +50,9 @@ return baseclass.extend({
                o.depends('enable', '1');
        },
 
-       configSummary: function(section) {
-               var sensors = L.toArray(section.Sensor),
-                   invert = section.IgnoreSelected == '1';
+       configSummary(section) {
+               const sensors = L.toArray(section.Sensor);
+               const invert = section.IgnoreSelected == '1';
 
                if (invert && sensors.length)
                        return N_(sensors.length, 'Monitoring all but one sensor', 'Monitoring all but %d sensors').format(sensors.length);
index 91f95376a1e4b0e98941acf26002862b7474eca3..bd86a6ecab62e66b85a524314cb4bf48f3863c60 100644 (file)
@@ -7,8 +7,8 @@ return baseclass.extend({
        title: _('SNMP6 Plugin Configuration'),
        description: _('The snmp6 plugin collects IPv6 statistics for selected interfaces.'),
 
-       addFormOptions: function(s) {
-               var o;
+       addFormOptions(s) {
+               let o;
 
                o = s.option(form.Flag, 'enable', _('Enable this plugin'));
                o.default = '0';
@@ -22,10 +22,10 @@ return baseclass.extend({
                o.depends('enable', '1');
        },
 
-       configSummary: function(section) {
-               var basic = L.toArray(section.Interfaces),
-                   count = basic.length,
-                   invert = section.IgnoreSelected == '1';
+       configSummary(section) {
+               const basic = L.toArray(section.Interfaces);
+               const count = basic.length;
+               const invert = section.IgnoreSelected == '1';
 
                if (invert && count == 0)
                        return _('Monitoring all interfaces');
index 34d0ca9b49f115261302d9e7537eeb428c96d805..5c3986f93d55496179fc8a0fe2b48a9e2e27ed75 100644 (file)
@@ -6,7 +6,7 @@ return baseclass.extend({
        title: _('Splash Leases Plugin Configuration'),
        description: _('The splash leases plugin uses libuci to collect statistics about splash leases.'),
 
-       configSummary: function(section) {
+       configSummary(section) {
                return _('Monitoring splash leases');
        }
 });
index 7a58a16f55557b52fe40ea5eb0c7c59a135b8e39..f2ce2fb959f8b381fb45cf2625b4c26117677b4e 100644 (file)
@@ -6,8 +6,8 @@ return baseclass.extend({
    title: _('Syslog Plugin Configuration'),
    description: _('The SysLog plugin receives log messages from the daemon and dispatches them to syslog.'),
 
-   addFormOptions: function(s) {
-       var o;
+   addFormOptions(s) {
+       let o;
 
        o = s.option(form.Flag, 'enable', _('Enable this plugin'));
 
@@ -28,7 +28,7 @@ return baseclass.extend({
        o.default = 'WARNING';
    },
 
-   configSummary: function(section) {
+   configSummary(section) {
        return _('Syslog enabled');
    }
 });
index 526b10f3c3cec89564939b1538cbd243dfd4e61c..d5f821b3c1f0eb0e433279e6d7d893e9723076a3 100644 (file)
@@ -6,8 +6,8 @@ return baseclass.extend({
        title: _('TCPConns Plugin Configuration'),
        description: _('The tcpconns plugin collects information about open tcp connections on selected ports.'),
 
-       addFormOptions: function(s) {
-               var o;
+       addFormOptions(s) {
+               let o;
 
                o = s.option(form.Flag, 'enable', _('Enable this plugin'));
 
@@ -32,11 +32,11 @@ return baseclass.extend({
                o.depends('enable', '1');
        },
 
-       configSummary: function(section) {
-               var lports = L.toArray(section.LocalPorts),
-                   rports = L.toArray(section.RemotePorts),
-                   listen = section.ListeningPorts == '1',
-                   summary = section.AllPortsSummary == '1';
+       configSummary(section) {
+               let lports = L.toArray(section.LocalPorts);
+               const rports = L.toArray(section.RemotePorts);
+               const listen = section.ListeningPorts == '1';
+               const summary = section.AllPortsSummary == '1';
 
                return _('Monitoring %s and %s, %s %s').format(
                        N_(lports.length, 'one local', '%d local').format(lports.length),
index 650e54747a9645aef1d5148d8280d5fefefd2021..9fbb64dc5922e08ba90db8148b671aacab57aed5 100644 (file)
@@ -7,8 +7,8 @@ return baseclass.extend({
        title: _('Thermal Plugin Configuration'),
        description: _('The thermal plugin will monitor temperature of the system. Data is typically read from /sys/class/thermal/*/temp ( \'*\' denotes the thermal device to be read, e.g. thermal_zone1 )'),
 
-       addFormOptions: function(s) {
-               var o;
+       addFormOptions(s) {
+               let o;
 
                o = s.option(form.Flag, 'enable', _('Enable this plugin'));
 
@@ -17,12 +17,12 @@ return baseclass.extend({
                        return Promise.all([
                                L.resolveDefault(fs.list('/sys/class/thermal'), []),
                                L.resolveDefault(fs.list('/proc/acpi/thermal_zone'), [])
-                       ]).then(L.bind(function(res) {
-                               var entries = res[0].concat(res[1]);
+                       ]).then(L.bind(function([therm, therm_zone]) {
+                               const entries = therm.concat(therm_zone);
 
-                               for (var i = 0; i < entries.length; i++)
-                                       if (entries[i].type == 'directory' && !entries[i].name.match(/^cooling_device/))
-                                               o.value(entries[i].name);
+                               for (let e of entries)
+                                       if (e.type == 'directory' && !e.name.match(/^cooling_device/))
+                                               o.value(e.name);
 
                                return this.super('load', [ section_id ]);
                        }, this));
@@ -37,9 +37,9 @@ return baseclass.extend({
                o.depends('enable', '1');
        },
 
-       configSummary: function(section) {
-               var zones = L.toArray(section.Device),
-                   invert = section.IgnoreSelected == '1';
+       configSummary(section) {
+               const zones = L.toArray(section.Device);
+               const invert = section.IgnoreSelected == '1';
 
                if (zones.length)
                        return (invert
index 88b0b2648572f59d1cbfe6b25f757ccd34a1d0c7..409294382dddaba95ce232a35fa654450a005c36 100644 (file)
@@ -7,8 +7,8 @@ return baseclass.extend({
        title: _('Unixsock Plugin Configuration'),
        description: _('The unixsock plugin creates a unix socket which can be used to read collected data from a running collectd instance.'),
 
-       addFormOptions: function(s) {
-               var o;
+       addFormOptions(s) {
+               let o;
 
                o = s.option(form.Flag, 'enable', _('Enable this plugin'));
 
@@ -29,7 +29,7 @@ return baseclass.extend({
                o.depends('enable', '1');
        },
 
-       configSummary: function(section) {
+       configSummary(section) {
                if (section.SocketFile)
                        return _('Socket %s active').format(section.SocketFile);
        }
index 2c42708ef63bcf168bd5c232c967b6377da51863..ccc89d1589ee309b156ba14ab332544e56816c39 100644 (file)
@@ -6,7 +6,7 @@ return baseclass.extend({
        title: _('Uptime Plugin Configuration'),
        description: _('The uptime plugin collects statistics about the uptime of the system.'),
 
-       configSummary: function(section) {
+       configSummary(section) {
                return _('Uptime monitoring enabled');
        }
 });
index 05b5eb88492307e87e0f219f1bf5d26589c5b650..aea40869cfedc8aeb456e5a72e12d97c15ed79c6 100644 (file)
@@ -6,11 +6,11 @@ return baseclass.extend({
        title: _('Users Plugin Configuration'),
        description: _('The users plugin collects statistics about users logged in locally via shell. NOTE: Local shell (wtmp) tracking is NOT enabled in default builds. Additional setup is required to get non-zero counts.'),
 
-       addFormOptions: function(s) {
-               var o = s.option(form.Flag, 'enable', _('Enable this plugin'));
+       addFormOptions(s) {
+               let o = s.option(form.Flag, 'enable', _('Enable this plugin'));
        },
 
-       configSummary: function(section) {
+       configSummary(section) {
                return _('Monitoring shell users count');
        }
 });
git clone https://git.99rst.org/PROJECT