luci-mod-network, luci-mod-status: allow assoclist wrapping

Signed-off-by: Jo-Philipp Wich <jo@mein.io>
(cherry picked from commit a600ebb5fe14b13cb53669eb73b86f66cc699e94)
(cherry picked from commit 04c73f1613)
This commit is contained in:
Jo-Philipp Wich 2020-03-24 22:13:01 +01:00
parent dfd0da39e2
commit 5f5f46961e
2 changed files with 23 additions and 20 deletions

View file

@ -46,7 +46,7 @@ function render_signal_badge(signalPercent, signalValue, noiseValue, wrap) {
icon = L.resource('icons/signal-75-100.png');
if (signalValue != null && signalValue != 0 && noiseValue != null && noiseValue != 0) {
value = '%d / %d %s'.format(signalValue, noiseValue, _('dBm'));
value = '%d/%d\xa0%s'.format(signalValue, noiseValue, _('dBm'));
title = '%s: %d %s / %s: %d %s / %s %d'.format(
_('Signal'), signalValue, _('dBm'),
_('Noise'), noiseValue, _('dBm'),
@ -165,13 +165,16 @@ function render_modal_status(node, radioNet) {
}
function format_wifirate(rate) {
var s = '%.1f Mbit/s, %dMHz'.format(rate.rate / 1000, rate.mhz);
var s = '%.1f\xa0%s, %d\xa0%s'.format(rate.rate / 1000, _('Mbit/s'), rate.mhz, _('MHz')),
ht = rate.ht, vht = rate.vht,
mhz = rate.mhz, nss = rate.nss,
mcs = rate.mcs, sgi = rate.short_gi;
if (rate.ht || rate.vht) {
if (rate.vht) s += ', VHT-MCS %d'.format(rate.mcs);
if (rate.nss) s += ', VHT-NSS %d'.format(rate.nss);
if (rate.ht) s += ', MCS %s'.format(rate.mcs);
if (rate.short_gi) s += ', Short GI';
if (ht || vht) {
if (vht) s += ', VHT-MCS\xa0%d'.format(mcs);
if (nss) s += ', VHT-NSS\xa0%d'.format(nss);
if (ht) s += ', MCS\xa0%s'.format(mcs);
if (sgi) s += ', ' + _('Short GI').replace(/ /g, '\xa0');
}
return s;
@ -611,7 +614,7 @@ return L.view.extend({
if (bss.network.isClientDisconnectSupported()) {
if (table.firstElementChild.childNodes.length < 6)
table.firstElementChild.appendChild(E('div', { 'class': 'th nowrap right'}, [ _('Disconnect') ]));
table.firstElementChild.appendChild(E('div', { 'class': 'th cbi-section-actions'}));
row.push(E('button', {
'class': 'cbi-button cbi-button-remove',
@ -1997,8 +2000,8 @@ return L.view.extend({
E('div', { 'class': 'th nowrap' }, _('Network')),
E('div', { 'class': 'th hide-xs' }, _('MAC-Address')),
E('div', { 'class': 'th' }, _('Host')),
E('div', { 'class': 'th nowrap' }, _('Signal / Noise')),
E('div', { 'class': 'th nowrap' }, _('RX Rate / TX Rate'))
E('div', { 'class': 'th' }, _('Signal / Noise')),
E('div', { 'class': 'th' }, _('RX Rate / TX Rate'))
])
]);

View file

@ -58,16 +58,16 @@ function renderbox(radio, networks) {
}
function wifirate(rt) {
var s = '%.1f %s, %d%s'.format(rt.rate / 1000, _('Mbit/s'), rt.mhz, _('MHz')),
var s = '%.1f\xa0%s, %d\xa0%s'.format(rt.rate / 1000, _('Mbit/s'), rt.mhz, _('MHz')),
ht = rt.ht, vht = rt.vht,
mhz = rt.mhz, nss = rt.nss,
mcs = rt.mcs, sgi = rt.short_gi;
if (ht || vht) {
if (vht) s += ', VHT-MCS %d'.format(mcs);
if (nss) s += ', VHT-NSS %d'.format(nss);
if (ht) s += ', MCS %s'.format(mcs);
if (sgi) s += ', ' + _('Short GI');
if (vht) s += ', VHT-MCS\xa0%d'.format(mcs);
if (nss) s += ', VHT-NSS\xa0%d'.format(nss);
if (ht) s += ', MCS\xa0%s'.format(mcs);
if (sgi) s += ', ' + _('Short GI').replace(/ /g, '\xa0');
}
return s;
@ -124,8 +124,8 @@ return L.Class.extend({
E('div', { 'class': 'th nowrap' }, _('Network')),
E('div', { 'class': 'th hide-xs' }, _('MAC-Address')),
E('div', { 'class': 'th' }, _('Host')),
E('div', { 'class': 'th nowrap' }, '%s / %s'.format(_('Signal'), _('Noise'))),
E('div', { 'class': 'th nowrap' }, '%s / %s'.format(_('RX Rate'), _('TX Rate')))
E('div', { 'class': 'th' }, '%s / %s'.format(_('Signal'), _('Noise'))),
E('div', { 'class': 'th' }, '%s / %s'.format(_('RX Rate'), _('TX Rate')))
])
]);
@ -154,14 +154,14 @@ return L.Class.extend({
var sig_title, sig_value;
if (bss.noise) {
sig_value = '%d / %d %s'.format(bss.signal, bss.noise, _('dBm'));
sig_value = '%d/%d\xa0%s'.format(bss.signal, bss.noise, _('dBm'));
sig_title = '%s: %d %s / %s: %d %s / %s %d'.format(
_('Signal'), bss.signal, _('dBm'),
_('Noise'), bss.noise, _('dBm'),
_('SNR'), bss.signal - bss.noise);
}
else {
sig_value = '%d %s'.format(bss.signal, _('dBm'));
sig_value = '%d\xa0%s'.format(bss.signal, _('dBm'));
sig_title = '%s: %d %s'.format(_('Signal'), bss.signal, _('dBm'));
}
@ -195,7 +195,7 @@ return L.Class.extend({
if (networks[i].isClientDisconnectSupported()) {
if (assoclist.firstElementChild.childNodes.length < 6)
assoclist.firstElementChild.appendChild(E('div', { 'class': 'th nowrap right' }, [ _('Disconnect') ]));
assoclist.firstElementChild.appendChild(E('div', { 'class': 'th cbi-section-actions' }));
row.push(E('button', {
'class': 'cbi-button cbi-button-remove',