diff options
author | Hannu Nyman <hannu.nyman@iki.fi> | 2023-05-30 19:27:47 +0300 |
---|---|---|
committer | Hannu Nyman <hannu.nyman@iki.fi> | 2023-05-31 18:11:49 +0300 |
commit | c9c395920e424cd188a663a6c3f4acfdf8d65012 (patch) | |
tree | e0bb46f0651cac243ed2996ebb4b8e0630a4c3b2 /applications/luci-app-statistics/htdocs/luci-static/resources/view/statistics | |
parent | 9b12a48c3f14beafae09eca99cca5e323ae72893 (diff) |
luci-app-statistics: enhance tcpconns plugin
Modernize tcpconns plugin to match the features in collectd:
* Support summary of all ports
* 'All listening ports' can be concurrent to specified ports,
not just alternative
Signed-off-by: Hannu Nyman <hannu.nyman@iki.fi>
Diffstat (limited to 'applications/luci-app-statistics/htdocs/luci-static/resources/view/statistics')
-rw-r--r-- | applications/luci-app-statistics/htdocs/luci-static/resources/view/statistics/plugins/tcpconns.js | 29 |
1 files changed, 17 insertions, 12 deletions
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 84471ebb87..526b10f3c3 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 @@ -19,25 +19,30 @@ return baseclass.extend({ 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.default = '22'; + o.depends('enable', '1'); o = s.option(form.DynamicList, 'RemotePorts', _('Monitor remote ports')); o.optional = true; o.datatype = 'port'; - o.depends({ enable: '1', ListeningPorts: '0' }); + o.depends('enable', '1'); + + o = s.option(form.Flag, 'AllPortsSummary', _('Summary of all ports')); + o.rmempty = false; + o.depends('enable', '1'); }, configSummary: function(section) { var lports = L.toArray(section.LocalPorts), - rports = L.toArray(section.RemotePorts); - - if (section.ListeningPorts == '1') - return _('Monitoring local listen ports'); - else - return _('Monitoring %s and %s').format( - N_(lports.length, 'one local port', '%d local ports').format(lports.length), - N_(rports.length, 'one remote port', '%d remote ports').format(rports.length) - ); + rports = L.toArray(section.RemotePorts), + listen = section.ListeningPorts == '1', + summary = section.AllPortsSummary == '1'; + + return _('Monitoring %s and %s, %s %s').format( + N_(lports.length, 'one local', '%d local').format(lports.length), + N_(rports.length, 'one remote port', '%d remote ports').format(rports.length), + listen ? _('all local listening ports,') : '', + summary ? _('summary of all ports') : _('no summary') + ); } }); |