diff options
Diffstat (limited to 'modules/luci-mod-status/htdocs/luci-static')
-rw-r--r-- | modules/luci-mod-status/htdocs/luci-static/resources/view/status/channel_analysis.js | 47 | ||||
-rw-r--r-- | modules/luci-mod-status/htdocs/luci-static/resources/view/status/nftables.js | 11 |
2 files changed, 39 insertions, 19 deletions
diff --git a/modules/luci-mod-status/htdocs/luci-static/resources/view/status/channel_analysis.js b/modules/luci-mod-status/htdocs/luci-static/resources/view/status/channel_analysis.js index 0c8cff8c0e..9f266ebef3 100644 --- a/modules/luci-mod-status/htdocs/luci-static/resources/view/status/channel_analysis.js +++ b/modules/luci-mod-status/htdocs/luci-static/resources/view/status/channel_analysis.js @@ -163,6 +163,8 @@ return view.extend({ chan_analysis.tab.addEventListener('cbi-tab-active', L.bind(function(ev) { this.active_tab = ev.detail.tab; + if (!this.radios[this.active_tab].loadedOnce) + poll.start(); }, this)); }, @@ -170,17 +172,17 @@ return view.extend({ if (!this.active_tab) return; - var radioDev = this.radios[this.active_tab].dev, - table = this.radios[this.active_tab].table, - chan_analysis = this.radios[this.active_tab].graph, - scanCache = this.radios[this.active_tab].scanCache; + var radio = this.radios[this.active_tab]; return Promise.all([ - radioDev.getScanList(), - this.callInfo(radioDev.getName()) + radio.dev.getScanList(), + this.callInfo(radio.dev.getName()) ]).then(L.bind(function(data) { var results = data[0], - local_wifi = data[1]; + local_wifi = data[1], + table = radio.table, + chan_analysis = radio.graph, + scanCache = radio.scanCache; var rows = []; @@ -228,9 +230,7 @@ return view.extend({ results.push(scanCache[k].data); results.sort(function(a, b) { - var diff = (b.quality - a.quality) || (a.channel - b.channel); - - if (diff) + if (a.channel - b.channel) return diff; if (a.ssid < b.ssid) @@ -306,6 +306,11 @@ return view.extend({ } cbi_update_table(table, rows); + + if (!radio.loadedOnce) { + radio.loadedOnce = true; + poll.stop(); + } }, this)) }, @@ -347,7 +352,16 @@ return view.extend({ var svg = data[0], wifiDevs = data[1]; - var v = E('div', {}, E('div')); + var h2 = E('div', {'class' : 'cbi-title-section'}, [ + E('h2', {'class': 'cbi-title-field'}, [ _('Channel Analysis') ]), + E('div', {'class': 'cbi-title-buttons' }, [ + E('button', { + 'class': 'cbi-button cbi-button-edit', + 'click': ui.createHandlerFn(this, 'handleScanRefresh') + }, [ _('Refresh Channels') ])]) + ]); + + var tabs = E('div', {}, E('div')); for (var ifname in wifiDevs) { var freq_tbl = { @@ -392,25 +406,24 @@ return view.extend({ dev: wifiDevs[ifname].dev, graph: graph_data, table: table, - scanCache: {} + scanCache: {}, + loadedOnce: false, }; cbi_update_table(table, [], E('em', { class: 'spinning' }, _('Starting wireless scan...'))); - v.firstElementChild.appendChild(tab) + tabs.firstElementChild.appendChild(tab) requestAnimationFrame(L.bind(this.create_channel_graph, this, graph_data, freq_tbl[freq], freq)); } } - ui.tabs.initTabGroup(v.firstElementChild.childNodes); + ui.tabs.initTabGroup(tabs.firstElementChild.childNodes); this.pollFn = L.bind(this.handleScanRefresh, this); - poll.add(this.pollFn); - poll.start(); - return v; + return E('div', {}, [h2, tabs]); }, handleSaveApply: null, diff --git a/modules/luci-mod-status/htdocs/luci-static/resources/view/status/nftables.js b/modules/luci-mod-status/htdocs/luci-static/resources/view/status/nftables.js index 82660c1595..de2f3d4daa 100644 --- a/modules/luci-mod-status/htdocs/luci-static/resources/view/status/nftables.js +++ b/modules/luci-mod-status/htdocs/luci-static/resources/view/status/nftables.js @@ -25,6 +25,7 @@ var expr_translations = { 'meta.mark': _('Packet mark', 'nft meta mark'), + 'meta.time': _('Packet receive time', 'nft meta time'), 'meta.hour': _('Current time', 'nft meta hour'), 'meta.day': _('Current weekday', 'nft meta day'), @@ -95,6 +96,7 @@ var action_translations = { 'accept': _('Accept packet', 'nft accept action'), 'drop': _('Drop packet', 'nft drop action'), 'jump': _('Continue in <strong><a href="#%q.%q">%h</a></strong>', 'nft jump action'), + 'log': _('Log event "<strong>%h</strong>…"', 'nft log action'), 'reject.tcp reset': _('Reject packet with <strong>TCP reset</strong>', 'nft reject with tcp reset'), 'reject.icmp': _('Reject IPv4 packet with <strong>ICMP type %h</strong>', 'nft reject with icmp type'), @@ -154,6 +156,7 @@ return view.extend({ case 'masquerade': case 'return': case 'flow': + case 'log': return true; } } @@ -355,8 +358,7 @@ return view.extend({ var k = 'reject.%s'.format(spec.type); return E('span', { - 'class': 'ifacebadge', - 'data-tooltip': JSON.stringify(spec) + 'class': 'ifacebadge' }, (action_translations[k] || k).format(this.exprToString(spec.expr))); case 'accept': @@ -445,6 +447,11 @@ return view.extend({ 'class': 'ifacebadge' }, action_translations.flow.format(spec.flowtable.replace(/^@/, ''))); + case 'log': + return E('span', { + 'class': 'ifacebadge' + }, action_translations.log.format(spec.prefix)); + default: return E('span', { 'class': 'ifacebadge', |