luci-mod-network: properly handle "no signal" and "disabled" in signal badges
authorJo-Philipp Wich <jo@mein.io>
Sun, 1 Mar 2020 19:58:51 +0000 (20:58 +0100)
committerJo-Philipp Wich <jo@mein.io>
Sun, 1 Mar 2020 19:58:51 +0000 (20:58 +0100)
Signed-off-by: Jo-Philipp Wich <jo@mein.io>
modules/luci-mod-network/htdocs/luci-static/resources/view/network/wireless.js

index be8358d0fb128afe1760048be76ee9ed2e13ae42..eaa08135483d8c551cf272b6da66d0e15bf49be9 100644 (file)
@@ -56,9 +56,13 @@ function render_signal_badge(signalPercent, signalValue, noiseValue, wrap) {
                value = '%d %s'.format(signalValue, _('dBm'));
                title = '%s: %d %s'.format(_('Signal'), signalValue, _('dBm'));
        }
+       else if (signalPercent > -1) {
+               value = '\xa0---\xa0';
+               title = _('No signal');
+       }
        else {
                value = E('em', {}, E('small', {}, [ _('disabled') ]));
-               title = _('No signal');
+               title = _('Interface is disabled');
        }
 
        return E('div', { 'class': wrap ? 'center' : 'ifacebadge', 'title': title },