luci-mod-admin-full: differentiate between disabled and not associated wireless
authorJo-Philipp Wich <jo@mein.io>
Fri, 13 Jul 2018 12:08:17 +0000 (14:08 +0200)
committerJo-Philipp Wich <jo@mein.io>
Fri, 13 Jul 2018 12:08:38 +0000 (14:08 +0200)
Signed-off-by: Jo-Philipp Wich <jo@mein.io>
modules/luci-mod-admin-full/luasrc/view/admin_network/wifi_status.htm
modules/luci-mod-admin-full/luasrc/view/admin_status/index.htm

index ad20ea38fe54cfcf1c075a3a267712105fffa4fd..bfad3d0804784947712d2a6976e13912eb861fed 100644 (file)
@@ -8,7 +8,7 @@
                        {
                                var is_assoc = (iw.bssid && iw.bssid != '00:00:00:00:00:00' && iw.channel && !iw.disabled);
                                var p = iw.quality;
-                               var q = is_assoc ? p : -1;
+                               var q = iw.disabled ? -1 : p;
 
                                var icon;
                                if (q < 0)
                                        info.innerHTML = String.format(
                                                '<strong><%:SSID%>:</strong> %h | ' +
                                                '<strong><%:Mode%>:</strong> %s<br />' +
-                                               '<em><%:Wireless is disabled or not associated%></em>',
-                                                       iw.ssid || '?', iw.mode
+                                               '<em>%s</em>',
+                                                       iw.ssid || '?', iw.mode,
+                                                       iw.disabled ? '<em><%:Wireless is disabled%></em>'
+                                                                   : '<em><%:Wireless is not associated%></em>'
                                        );
                        }
                }
index 03155dbb62247d26272024fb9f66c3ddd1a63f1a..db8535086f867d62c27556ebdfdce35de6a1368a 100644 (file)
                                                var is_assoc = (net.bssid != '00:00:00:00:00:00' && net.channel && !net.disabled);
 
                                                var icon;
-                                               if (!is_assoc)
+                                               if (net.disabled)
                                                        icon = "<%=resource%>/icons/signal-none.png";
-                                               else if (net.quality == 0)
+                                               else if (net.quality <= 0)
                                                        icon = "<%=resource%>/icons/signal-0.png";
                                                else if (net.quality < 25)
                                                        icon = "<%=resource%>/icons/signal-0-25.png";
                                                        '<%:BSSID%>', is_assoc ? (net.bssid || '-') : null,
                                                        '<%:Encryption%>', is_assoc ? net.encryption : null,
                                                        '<%:Associations%>', is_assoc ? (net.num_assoc || '-') : null,
-                                                       null, is_assoc ? null : E('em', '<%:Wireless is disabled or not associated%>')));
+                                                       null, is_assoc ? null : E('em', net.disabled ? '<%:Wireless is disabled%>' : '<%:Wireless is not associated%>')));
                                        }
 
                                        ws.appendChild(renderBox(