From f7e5b56649c8b7599e27db09652e9cb3083d2108 Mon Sep 17 00:00:00 2001 From: Hannu Nyman Date: Sun, 13 Dec 2020 11:09:33 +0200 Subject: [PATCH] luci-app-statistics: Adjust UI defaults to match config file Adjust the defaults shown in the LuCI user interface to match the real default values in the default config file. (If a plugin is disabled and config values get deleted from the config file, user has been offered incorrect default values from UI defaults when the plugin is later re-enabled.) * dns: set br-lan as the interface * email: socket in /var/run/collectd/ dir * interface: set br-lan as the interface * ping: TTL 127, interval 30 * rrdtool: 1hour as shortest period, 144 RRArows * tcpconns: Do not monitor all, only 22 80 * unixsock: socket in /var/run/collectd/ dir Signed-off-by: Hannu Nyman --- .../luci-static/resources/view/statistics/plugins/dns.js | 1 + .../luci-static/resources/view/statistics/plugins/email.js | 2 +- .../resources/view/statistics/plugins/interface.js | 1 + .../luci-static/resources/view/statistics/plugins/ping.js | 4 ++-- .../luci-static/resources/view/statistics/plugins/rrdtool.js | 4 ++-- .../luci-static/resources/view/statistics/plugins/tcpconns.js | 3 ++- .../luci-static/resources/view/statistics/plugins/unixsock.js | 2 +- 7 files changed, 10 insertions(+), 7 deletions(-) diff --git a/applications/luci-app-statistics/htdocs/luci-static/resources/view/statistics/plugins/dns.js b/applications/luci-app-statistics/htdocs/luci-static/resources/view/statistics/plugins/dns.js index 8ff7052980..1e130e0236 100644 --- a/applications/luci-app-statistics/htdocs/luci-static/resources/view/statistics/plugins/dns.js +++ b/applications/luci-app-statistics/htdocs/luci-static/resources/view/statistics/plugins/dns.js @@ -16,6 +16,7 @@ return baseclass.extend({ _('When none selected, all interfaces will be monitored.')); o.multiple = true; o.noaliases = true; + o.default = 'br-lan'; o.depends('enable', '1'); o = s.option(form.DynamicList, 'IgnoreSources', _('Ignore source addresses')); diff --git a/applications/luci-app-statistics/htdocs/luci-static/resources/view/statistics/plugins/email.js b/applications/luci-app-statistics/htdocs/luci-static/resources/view/statistics/plugins/email.js index 51f8284e48..1ab44f31cc 100644 --- a/applications/luci-app-statistics/htdocs/luci-static/resources/view/statistics/plugins/email.js +++ b/applications/luci-app-statistics/htdocs/luci-static/resources/view/statistics/plugins/email.js @@ -13,7 +13,7 @@ return baseclass.extend({ o = s.option(form.Flag, 'enable', _('Enable this plugin')); o = s.option(form.Value, 'SocketFile', _('Socket file')); - o.default = '/var/run/collect-email.sock'; + o.default = '/var/run/collectd/email.sock'; o.depends('enable', '1'); o = s.option(widgets.GroupSelect, 'SocketGroup', _('Socket group')); diff --git a/applications/luci-app-statistics/htdocs/luci-static/resources/view/statistics/plugins/interface.js b/applications/luci-app-statistics/htdocs/luci-static/resources/view/statistics/plugins/interface.js index cb4d680b21..6ea79a6275 100644 --- a/applications/luci-app-statistics/htdocs/luci-static/resources/view/statistics/plugins/interface.js +++ b/applications/luci-app-statistics/htdocs/luci-static/resources/view/statistics/plugins/interface.js @@ -15,6 +15,7 @@ return baseclass.extend({ o = s.option(widgets.DeviceSelect, 'Interfaces', _('Monitor interfaces')); o.multiple = true; o.noaliases = true; + o.default = 'br-lan'; o.depends('enable', '1'); o = s.option(form.Flag, 'IgnoreSelected', _('Monitor all except specified')); diff --git a/applications/luci-app-statistics/htdocs/luci-static/resources/view/statistics/plugins/ping.js b/applications/luci-app-statistics/htdocs/luci-static/resources/view/statistics/plugins/ping.js index 33ef8e2b41..47ce7fff52 100644 --- a/applications/luci-app-statistics/htdocs/luci-static/resources/view/statistics/plugins/ping.js +++ b/applications/luci-app-statistics/htdocs/luci-static/resources/view/statistics/plugins/ping.js @@ -24,12 +24,12 @@ return baseclass.extend({ o.value('ipv6'); o = s.option(form.Value, 'TTL', _('TTL for ping packets')); - o.default = '128'; + o.default = '127'; o.datatype = 'range(0, 255)'; o.depends('enable', '1'); o = s.option(form.Value, 'Interval', _('Interval for pings'), _('Seconds')); - o.default = '1.0'; + o.default = '30'; o.datatype = 'ufloat'; o.depends('enable', '1'); }, diff --git a/applications/luci-app-statistics/htdocs/luci-static/resources/view/statistics/plugins/rrdtool.js b/applications/luci-app-statistics/htdocs/luci-static/resources/view/statistics/plugins/rrdtool.js index 4d0520471c..d25c0f8139 100644 --- a/applications/luci-app-statistics/htdocs/luci-static/resources/view/statistics/plugins/rrdtool.js +++ b/applications/luci-app-statistics/htdocs/luci-static/resources/view/statistics/plugins/rrdtool.js @@ -36,7 +36,7 @@ return baseclass.extend({ o.depends('RRASingle', '0'); o = s.option(form.DynamicList, 'RRATimespans', _('Stored timespans')); - o.default = '10min 1day 1week 1month 1year'; + o.default = '1hour 1day 1week 1month 1year'; o.depends('enable', '1'); o.validate = function(section_id, value) { if (value == '') @@ -49,7 +49,7 @@ return baseclass.extend({ }; o = s.option(form.Value, 'RRARows', _('Rows per RRA')); - o.placeholder = '1200'; + o.default = '144'; o.datatype = 'min(1)'; o.depends('enable', '1'); diff --git a/applications/luci-app-statistics/htdocs/luci-static/resources/view/statistics/plugins/tcpconns.js b/applications/luci-app-statistics/htdocs/luci-static/resources/view/statistics/plugins/tcpconns.js index 3bab72776b..84471ebb87 100644 --- a/applications/luci-app-statistics/htdocs/luci-static/resources/view/statistics/plugins/tcpconns.js +++ b/applications/luci-app-statistics/htdocs/luci-static/resources/view/statistics/plugins/tcpconns.js @@ -14,11 +14,12 @@ return baseclass.extend({ o = s.option(form.Flag, 'ListeningPorts', _('Monitor all local listen ports')); o.depends('enable', '1'); o.rmempty = false; - o.default = '1'; + o.default = '0'; o = s.option(form.DynamicList, 'LocalPorts', _('Monitor local ports')); o.optional = true; o.datatype = 'port'; + o.default = '22 80'; o.depends({ enable: '1', ListeningPorts: '0' }); o = s.option(form.DynamicList, 'RemotePorts', _('Monitor remote ports')); diff --git a/applications/luci-app-statistics/htdocs/luci-static/resources/view/statistics/plugins/unixsock.js b/applications/luci-app-statistics/htdocs/luci-static/resources/view/statistics/plugins/unixsock.js index 996cfda45c..88b0b26485 100644 --- a/applications/luci-app-statistics/htdocs/luci-static/resources/view/statistics/plugins/unixsock.js +++ b/applications/luci-app-statistics/htdocs/luci-static/resources/view/statistics/plugins/unixsock.js @@ -13,7 +13,7 @@ return baseclass.extend({ o = s.option(form.Flag, 'enable', _('Enable this plugin')); o = s.option(form.Value, 'SocketFile', _('Socket path')); - o.default = '/var/run/collect-query.socket'; + o.default = '/var/run/collectd/query.sock'; o.depends('enable', '1'); o = s.option(widgets.GroupSelect, 'SocketGroup', _('Socket group'), _('Change the ownership of the socket file to the specified group.')); -- 2.30.2