diff options
author | Jo-Philipp Wich <jo@mein.io> | 2021-03-01 19:01:39 +0100 |
---|---|---|
committer | Jo-Philipp Wich <jo@mein.io> | 2021-03-01 19:01:54 +0100 |
commit | d3ba6ae3bd8b1f44f0743ffeb09d3e9497537c63 (patch) | |
tree | 1bf5a96690dbcc1b1f02502d0f2cb314f50d0b58 /modules/luci-mod-status/htdocs/luci-static/resources/view | |
parent | 52caa1dc96ed6fde5c4b84f4f7f2a7429694f69c (diff) |
Revert "luci-mod-status: allow displaying raw iptables counter values"
This reverts commit 52caa1dc96ed6fde5c4b84f4f7f2a7429694f69c since it
contained unrelated changes.
Signed-off-by: Jo-Philipp Wich <jo@mein.io>
Diffstat (limited to 'modules/luci-mod-status/htdocs/luci-static/resources/view')
-rw-r--r-- | modules/luci-mod-status/htdocs/luci-static/resources/view/status/iptables.js | 48 |
1 files changed, 7 insertions, 41 deletions
diff --git a/modules/luci-mod-status/htdocs/luci-static/resources/view/status/iptables.js b/modules/luci-mod-status/htdocs/luci-static/resources/view/status/iptables.js index dd58670694..2ce744c60e 100644 --- a/modules/luci-mod-status/htdocs/luci-static/resources/view/status/iptables.js +++ b/modules/luci-mod-status/htdocs/luci-static/resources/view/status/iptables.js @@ -4,8 +4,7 @@ 'require fs'; 'require ui'; -var table_names = [ 'Filter', 'NAT', 'Mangle', 'Raw' ], - raw_style = 'font-family:monospace;font-size:smaller;text-align:right'; +var table_names = [ 'Filter', 'NAT', 'Mangle', 'Raw' ]; return view.extend({ load: function() { @@ -61,8 +60,8 @@ return view.extend({ E('h4', { 'id': 'rule_%s-%s_%s'.format(is_ipv6 ? 'ipv6' : 'ipv4', table.toLowerCase(), chain) }, title), E('table', { 'class': 'table' }, [ E('tr', { 'class': 'tr table-titles' }, [ - E('th', { 'class': 'th' }, _('Pkts.')), - E('th', { 'class': 'th' }, _('Traffic')), + E('th', { 'class': 'th center' }, _('Pkts.')), + E('th', { 'class': 'th center' }, _('Traffic')), E('th', { 'class': 'th' }, _('Target')), E('th', { 'class': 'th' }, _('Prot.')), E('th', { 'class': 'th' }, _('In')), @@ -106,7 +105,6 @@ return view.extend({ var chain_refs = {}; var re = /([^\n]*)\n/g; var m, m2; - var raw = document.querySelector('[data-raw-counters="true"]'); while ((m = re.exec(s)) != null) { if (m[1].match(/^Chain (.+) \(policy (\w+) (\d+) packets, (\d+) bytes\)$/)) { @@ -154,22 +152,12 @@ return view.extend({ }) || '-'; current_rules.push([ - E('div', { - 'class': 'nowrap', - 'style': raw ? raw_style : null, - 'data-format': '%.2m', - 'data-value': pkts - }, (raw ? '%d' : '%.2m').format(pkts)), - E('div', { - 'class': 'nowrap', - 'style': raw ? raw_style : null, - 'data-format': '%.2mB', - 'data-value': bytes - }, (raw ? '%d' : '%.2mB').format(bytes)), + '%.2m'.format(pkts).nobr(), + '%.2mB'.format(bytes).nobr(), target ? '<span class="target">%s</span>'.format(target) : '-', proto, - (indev !== '*') ? '<span class="ifacebadge nowrap">%s</span>'.format(indev) : '*', - (outdev !== '*') ? '<span class="ifacebadge nowrap">%s</span>'.format(outdev) : '*', + (indev !== '*') ? '<span class="ifacebadge">%s</span>'.format(indev) : '*', + (outdev !== '*') ? '<span class="ifacebadge">%s</span>'.format(outdev) : '*', srcnet, dstnet, options, @@ -268,23 +256,6 @@ return view.extend({ } }, - handleRawCounters: function(ev) { - var btn = ev.currentTarget, - raw = (btn.getAttribute('data-raw-counters') === 'false'); - - btn.setAttribute('data-raw-counters', raw); - btn.firstChild.data = raw ? _('Human-readable counters') : _('Show raw counters'); - btn.blur(); - - document.querySelectorAll('[data-value]') - .forEach(function(div) { - var fmt = raw ? '%d' : div.getAttribute('data-format'); - - div.style = raw ? raw_style : ''; - div.innerText = fmt.format(div.getAttribute('data-value')); - }); - }, - handleHideEmpty: function(ev) { var btn = ev.currentTarget, hide = (btn.getAttribute('data-hide-empty') === 'false'); @@ -332,11 +303,6 @@ return view.extend({ }, [ _('Hide empty chains') ]), ' ', E('button', { - 'data-raw-counters': false, - 'click': ui.createHandlerFn(this, 'handleRawCounters') - }, [ _('Show raw counters') ]), - ' ', - E('button', { 'class': 'cbi-button', 'click': ui.createHandlerFn(this, 'handleCounterReset', has_ip6tables) }, [ _('Reset Counters') ]), |