luci-mod-dashboard: Minor repairs
authorPaul Donald <newtwen+github@gmail.com>
Mon, 7 Oct 2024 15:10:57 +0000 (17:10 +0200)
committerPaul Donald <newtwen+github@gmail.com>
Mon, 7 Oct 2024 15:10:57 +0000 (17:10 +0200)
Strength gauge is now displayed. Appended dBm measurement also.

Corrected some labels.

Closes #6147

Signed-off-by: Paul Donald <newtwen+github@gmail.com>
modules/luci-mod-dashboard/htdocs/luci-static/resources/view/dashboard/include/30_wifi.js

index 318c3abf877e248d773b240444ef7db6ed391ba3..e2742dd0201fa9d1ea3d83edd22dc204836906f1 100644 (file)
@@ -60,7 +60,7 @@ return baseclass.extend({
                                        continue;
                                }
 
-                               if ('actived' === idx) {
+                               if ('isactive' === idx) {
                                        classname = radio[idx].value ? 'label label-success' : 'label label-danger';
                                        radio[idx].value = radio[idx].value ? _('yes') : _('no');
                                }
@@ -81,9 +81,9 @@ return baseclass.extend({
                var container_devices = E('table', { 'class': 'table assoclist devices-info' }, [
                        E('tr', { 'class': 'tr table-titles  dashboard-bg' }, [
                                E('th', { 'class': 'th nowrap' }, _('Hostname')),
-                               E('th', { 'class': 'th' }, _('Wireless')),
-                               E('th', { 'class': 'th' }, _('Signal')),
-                               E('th', { 'class': 'th' }, '%s / %s'.format( _('Up.'), _('Down.')))
+                               E('th', { 'class': 'th' }, _('SSID')),
+                               E('th', { 'class': 'th', 'width': '45%' }, _('Signal Strength')),
+                               E('th', { 'class': 'th' }, 'Transferred %s / %s'.format( _('Up.'), _('Down.')))
                        ])
                ]);
 
@@ -104,11 +104,11 @@ return baseclass.extend({
 
                                if ('progress' == idx) {
                                        container_content = E('div', { 'class' : 'td device-info' }, [
-                                               E('div', { 'class': 'progress' }, [
-                                                       E('div', { 'class': 'progress-bar ' + device[idx].value.style, role: 'progressbar', style: 'width:'+device[idx].value.qualite+'%', 'aria-valuenow': device[idx].value.qualite, 'aria-valuemin': 0, 'aria-valuemax': 100 }),
+                                               E('div', { 'class': 'cbi-progressbar', 'title': 'RSSI: ' + parseInt(device[idx].value.qualite) + '% (' + device[idx].value.rssi + 'dBm)'  }, [
+                                                       E('div', { 'style': 'width: '+device[idx].value.qualite+'%'}),
                                                ])
                                        ]);
-                               } else if ('rate' == idx) {
+                               } else if ('transferred' == idx) {
                                        container_content = E('td', { 'class': 'td device-info'  }, [
                                                E('p', {}, [
                                                        E('span', { 'class': ''}, [ device[idx].value.rx ]),
@@ -159,7 +159,7 @@ return baseclass.extend({
                                                        value: net.getActiveSSID() || '?'
                                                },
 
-                                               actived : {
+                                               isactive : {
                                                        title: _('Active'),
                                                        visible: true,
                                                        value: !net.isDisabled()
@@ -205,7 +205,8 @@ return baseclass.extend({
                                        name = hosthints.getHostnameByMACAddr(bss.mac);
 
                                var progress_style;
-                               var q = Math.min((bss.signal + 110) / 70 * 100, 100);
+                               // var q = Math.min((bss.signal + 110) / 70 * 100, 100);
+                               var q = 100 * ((bss.signal - bss.noise) / (-30 - bss.noise));
 
                                if (q == 0 || q < 25)
                                        progress_style = 'bg-danger';
@@ -231,16 +232,17 @@ return baseclass.extend({
                                                },
 
                                                progress : {
-                                                       title: _('Channel'),
+                                                       title: _('Strength'),
                                                        visible: true,
                                                        value: {
                                                                qualite: q,
+                                                               rssi: bss.signal,
                                                                style: progress_style
                                                        }
                                                },
 
-                                               rate : {
-                                                       title: _('Bitrate'),
+                                               transferred : {
+                                                       title: _('Transferred'),
                                                        visible: true,
                                                        value: {
                                                                rx: '%s'.format('%.2mB'.format(bss.rx.bytes)),