diff options
author | Jo-Philipp Wich <jo@mein.io> | 2020-02-17 09:49:34 +0100 |
---|---|---|
committer | Jo-Philipp Wich <jo@mein.io> | 2020-02-17 09:50:36 +0100 |
commit | 2cad20e7ea90c962020bb2f2463fb660271b84ea (patch) | |
tree | cce40ba6ff8cc7603fb650aa94ba70257759d1b9 /modules/luci-mod-network | |
parent | 2fa9885e17fd75b39c38501f34f087b1373a7b74 (diff) |
luci-mod-network, luci-mod-status: harmonize wifi signal indicators
Fixes: #3636
Signed-off-by: Jo-Philipp Wich <jo@mein.io>
Diffstat (limited to 'modules/luci-mod-network')
-rw-r--r-- | modules/luci-mod-network/htdocs/luci-static/resources/view/network/wireless.js | 20 |
1 files changed, 13 insertions, 7 deletions
diff --git a/modules/luci-mod-network/htdocs/luci-static/resources/view/network/wireless.js b/modules/luci-mod-network/htdocs/luci-static/resources/view/network/wireless.js index e3d2aa411..4c75a2f0c 100644 --- a/modules/luci-mod-network/htdocs/luci-static/resources/view/network/wireless.js +++ b/modules/luci-mod-network/htdocs/luci-static/resources/view/network/wireless.js @@ -30,7 +30,7 @@ function render_radio_badge(radioDev) { } function render_signal_badge(signalPercent, signalValue, noiseValue, wrap) { - var icon, title; + var icon, title, value; if (signalPercent < 0) icon = L.resource('icons/signal-none.png'); @@ -45,18 +45,24 @@ function render_signal_badge(signalPercent, signalValue, noiseValue, wrap) { else icon = L.resource('icons/signal-75-100.png'); - if (signalValue != null && signalValue != 0) { - title = '%s %d %s'.format(_('Signal'), signalValue, _('dBm')); - - if (noiseValue != null && noiseValue != 0) - title += ' / %s: %d %s'.format(_('Noise'), noiseValue, _('dBm')); + if (signalValue != null && signalValue != 0 && noiseValue != null && noiseValue != 0) { + value = '%d / %d %s'.format(signalValue, noiseValue, _('dBm')); + title = '%s: %d %s / %s: %d %s / %s %d'.format( + _('Signal'), signalValue, _('dBm'), + _('Noise'), noiseValue, _('dBm'), + _('SNR'), signalValue - noiseValue); + } + else if (signalValue != null && signalValue != 0) { + value = '%d %s'.format(signalValue, _('dBm')); + title = '%s: %d %s'.format(_('Signal'), signalValue, _('dBm')); } else { + value = E('em', {}, E('small', {}, [ _('disabled') ])); title = _('No signal'); } return E('div', { 'class': wrap ? 'center' : 'ifacebadge', 'title': title }, - [ E('img', { 'src': icon }), wrap ? E('br') : ' ', '%d%%'.format(Math.max(signalPercent, 0)) ]); + [ E('img', { 'src': icon }), wrap ? E('br') : ' ', value ]); } function render_network_badge(radioNet) { |