Merge pull request #766 from feckert/config_diag_url
[project/luci.git] / modules / luci-mod-admin-full / luasrc / view / admin_network / wifi_overview.htm
index 4632673..9c351d3 100644 (file)
                return s.replace(/ /g, ' ');
        }
 
+       function wifirate(bss, rx) {
+               var p = rx ? 'rx_' : 'tx_',
+                   s = '%.1f <%:Mbit/s%>, %d<%:MHz%>'
+                                       .format(bss[p+'rate'] / 1000, bss[p+'mhz']),
+                   ht = bss[p+'ht'], vht = bss[p+'vht'],
+                       mhz = bss[p+'mhz'], nss = bss[p+'nss'],
+                       mcs = bss[p+'mcs'], sgi = bss[p+'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%>';
+               }
+
+               return s;
+       }
+
        function wifi_shutdown(id, toggle) {
                var reconnect = (toggle.getAttribute('active') == 'false');
 
                                                                assoclist[j].signal, assoclist[j].noise
                                                        );
 
-                                                       tr.insertCell(-1).innerHTML = nowrap((assoclist[j].rx_mcs > -1)
-                                                               ? String.format('%.1f <%:Mbit/s%>, MCS %d, %d<%:MHz%>', assoclist[j].rx_rate / 1000, assoclist[j].rx_mcs, assoclist[j].rx_40mhz ? 40 : 20)
-                                                               : String.format('%.1f <%:Mbit/s%>', assoclist[j].rx_rate / 1000)
-                                                       ) + '<br />' + nowrap((assoclist[j].tx_mcs > -1)
-                                                               ? String.format('%.1f <%:Mbit/s%>, MCS %d, %d<%:MHz%>', assoclist[j].tx_rate / 1000, assoclist[j].tx_mcs, assoclist[j].tx_40mhz ? 40 : 20)
-                                                               : String.format('%.1f <%:Mbit/s%>', assoclist[j].tx_rate / 1000)
-                                                       );
+                                                       tr.insertCell(-1).innerHTML = nowrap(wifirate(assoclist[j], true)) + '<br />' + nowrap(wifirate(assoclist[j], false));
 
                                                        rowstyle = (rowstyle == 1) ? 2 : 1;
                                                }
                                        <td class="cbi-value-field" style="width:310px;text-align:right">
                                                <input id="<%=net:id()%>-iw-toggle" type="button" class="cbi-button cbi-button-reload" style="width:100px" onclick="wifi_shutdown('<%=net:id()%>', this)" title="<%:Delete this network%>" value="<%:Enable%>" />
                                                <input type="button" class="cbi-button cbi-button-edit" style="width:100px" onclick="location.href='<%=net:adminlink()%>'" title="<%:Edit this network%>" value="<%:Edit%>" />
-                                               <input type="button" class="cbi-button cbi-button-remove" style="width:100px" onclick="wifi_delete('<%=net:ifname()%>')" title="<%:Delete this network%>" value="<%:Remove%>" />
+                                               <input type="button" class="cbi-button cbi-button-remove" style="width:100px" onclick="wifi_delete('<%=net:id()%>')" title="<%:Delete this network%>" value="<%:Remove%>" />
                                        </td>
                                </tr>
                                <% end %>