applications/olsr: Remove macs from olsr neighbors page; show '?' for SNR when no...
authorManuel Munz <freifunk@somakoma.de>
Thu, 1 Aug 2013 21:53:58 +0000 (21:53 +0000)
committerManuel Munz <freifunk@somakoma.de>
Thu, 1 Aug 2013 21:53:58 +0000 (21:53 +0000)
applications/luci-olsr/luasrc/controller/olsr.lua
applications/luci-olsr/luasrc/view/status-olsr/neighbors.htm

index 19e549d..94240da 100644 (file)
@@ -163,9 +163,9 @@ function action_neigh(json)
 
        for k, v in ipairs(data) do
                local interface
 
        for k, v in ipairs(data) do
                local interface
-               local snr = 1
-               local signal = 1
-               local noise = 1
+               local snr = 0
+               local signal = 0
+               local noise = 0
                local arptable = sys.net.arptable()
                local mac = ""
                local rmac = ""
                local arptable = sys.net.arptable()
                local mac = ""
                local rmac = ""
index 176457d..daa5283 100644 (file)
@@ -32,10 +32,8 @@ if luci.http.formvalue("status") == "1" then
 
                rv[#rv+1] = {
                        rip = link.remoteIP,
 
                rv[#rv+1] = {
                        rip = link.remoteIP,
-                       rmac = link.remoteMAC,
                        hn = link.hostname,
                        lip = link.localIP,
                        hn = link.hostname,
                        lip = link.localIP,
-                       lmac = link.localMAC,
                        ifn = link.interface,
                        lq = string.format("%.3f", link.linkQuality),
                        nlq = string.format("%.3f",link.neighborLinkQuality),
                        ifn = link.interface,
                        lq = string.format("%.3f", link.linkQuality),
                        nlq = string.format("%.3f",link.neighborLinkQuality),
@@ -74,14 +72,14 @@ end
                                        if (neigh.proto == '6') {
                                                s += String.format(
                                                        '<tr class="cbi-section-table-row cbi-rowstyle-'+(1 + (idx % 2))+' proto-%s">' +
                                        if (neigh.proto == '6') {
                                                s += String.format(
                                                        '<tr class="cbi-section-table-row cbi-rowstyle-'+(1 + (idx % 2))+' proto-%s">' +
-                                                       '<td class="cbi-section-table-titles" style="background-color:%s"><a href="http://[%s]/cgi-bin-status.html">%s/%s</a></td>',
-                                                       neigh.proto, neigh.dfgcolor, neigh.rip, neigh.rip, neigh.rmac
+                                                       '<td class="cbi-section-table-titles" style="background-color:%s"><a href="http://[%s]/cgi-bin-status.html">%s</a></td>',
+                                                       neigh.proto, neigh.dfgcolor, neigh.rip, neigh.rip
                                                );
                                        } else {
                                                s += String.format(
                                                        '<tr class="cbi-section-table-row cbi-rowstyle-'+(1 + (idx % 2))+' proto-%s">' +
                                                );
                                        } else {
                                                s += String.format(
                                                        '<tr class="cbi-section-table-row cbi-rowstyle-'+(1 + (idx % 2))+' proto-%s">' +
-                                                       '<td class="cbi-section-table-titles" style="background-color:%s"><a href="http://%s/cgi-bin-status.html">%s/%s</a></td>',
-                                                       neigh.proto, neigh.dfgcolor, neigh.rip, neigh.rip, neigh.rmac
+                                                       '<td class="cbi-section-table-titles" style="background-color:%s"><a href="http://%s/cgi-bin-status.html">%s</a></td>',
+                                                       neigh.proto, neigh.dfgcolor, neigh.rip, neigh.rip
                                                );
                                        }
                                        if (neigh.hn) {
                                                );
                                        }
                                        if (neigh.hn) {
@@ -96,13 +94,14 @@ end
                                                );
                                        }
                                        s += String.format(
                                                );
                                        }
                                        s += String.format(
-                                               '<td class="cbi-section-table-titles" style="background-color:%s">%s/%s/%s</td>' +
+                                               '<td class="cbi-section-table-titles" style="background-color:%s">%s</td>' +
+                                               '<td class="cbi-section-table-titles" style="background-color:%s">%s</td>' +
                                                '<td class="cbi-section-table-titles" style="background-color:%s">%s</td>' +
                                                '<td class="cbi-section-table-titles" style="background-color:%s">%s</td>' +
                                                '<td class="cbi-section-table-titles" style="background-color:%s">%s</td>' +
                                                '<td class="cbi-section-table-titles" style="background-color:%s" title="Signal: %s Noise: %s">%s</td>' +
                                                '</tr>',
                                                '<td class="cbi-section-table-titles" style="background-color:%s">%s</td>' +
                                                '<td class="cbi-section-table-titles" style="background-color:%s">%s</td>' +
                                                '<td class="cbi-section-table-titles" style="background-color:%s">%s</td>' +
                                                '<td class="cbi-section-table-titles" style="background-color:%s" title="Signal: %s Noise: %s">%s</td>' +
                                                '</tr>',
-                                               neigh.dfgcolor, neigh.ifn, neigh.lip, neigh.lmac, neigh.dfgcolor, neigh.lq, neigh.dfgcolor, neigh.nlq, neigh.color, neigh.cost, neigh.snr_color, neigh.signal, neigh.noise, neigh.snr || '?'
+                                               neigh.dfgcolor, neigh.ifn, neigh.dfgcolor, neigh.lip, neigh.dfgcolor, neigh.lq, neigh.dfgcolor, neigh.nlq, neigh.color, neigh.cost, neigh.snr_color, neigh.signal, neigh.noise, neigh.snr || '?'
                                        );
                                }
 
                                        );
                                }
 
@@ -125,6 +124,7 @@ end
                        <tr class="cbi-section-table-titles">
                                <th class="cbi-section-table-cell"><%:Neighbour IP%></th>
                                <th class="cbi-section-table-cell"><%:Hostname%></th>
                        <tr class="cbi-section-table-titles">
                                <th class="cbi-section-table-cell"><%:Neighbour IP%></th>
                                <th class="cbi-section-table-cell"><%:Hostname%></th>
+                               <th class="cbi-section-table-cell"><%:Interface%></th>
                                <th class="cbi-section-table-cell"><%:Local interface IP%></th>
                                <th class="cbi-section-table-cell">LQ</th>
                                <th class="cbi-section-table-cell">NLQ</th>
                                <th class="cbi-section-table-cell"><%:Local interface IP%></th>
                                <th class="cbi-section-table-cell">LQ</th>
                                <th class="cbi-section-table-cell">NLQ</th>
@@ -144,6 +144,10 @@ end
                        color = olsrtools.etx_color(link.linkCost)
                        snr_color = olsrtools.snr_color(link.snr)
 
                        color = olsrtools.etx_color(link.linkCost)
                        snr_color = olsrtools.snr_color(link.snr)
 
+                       if link.snr == 0 then
+                               link.snr = '?'
+                       end
+
                        defaultgw_color = ""
                        if link.defaultgw == 1 then
                                defaultgw_color = "#ffff99"
                        defaultgw_color = ""
                        if link.defaultgw == 1 then
                                defaultgw_color = "#ffff99"
@@ -152,12 +156,13 @@ end
 
                <tr class="cbi-section-table-row cbi-rowstyle-<%=i%> proto-<%=link.proto%>">
                        <% if link.proto == "6" then %>
 
                <tr class="cbi-section-table-row cbi-rowstyle-<%=i%> proto-<%=link.proto%>">
                        <% if link.proto == "6" then %>
-                       <td class="cbi-section-table-titles" style="background-color:<%=defaultgw_color%>"><a href="http://[<%=link.remoteIP%>]/cgi-bin-status.html"><%=link.remoteIP%>/<%=link.remoteMAC%></a></td>
+                       <td class="cbi-section-table-titles" style="background-color:<%=defaultgw_color%>"><a href="http://[<%=link.remoteIP%>]/cgi-bin-status.html"><%=link.remoteIP%></a></td>
                        <% else %>
                        <% else %>
-                       <td class="cbi-section-table-titles" style="background-color:<%=defaultgw_color%>"><a href="http://<%=link.remoteIP%>/cgi-bin-status.html"><%=link.remoteIP%>/<%=link.remoteMAC%></a></td>
+                       <td class="cbi-section-table-titles" style="background-color:<%=defaultgw_color%>"><a href="http://<%=link.remoteIP%>/cgi-bin-status.html"><%=link.remoteIP%></a></td>
                        <% end %>
                        <td class="cbi-section-table-titles" style="background-color:<%=defaultgw_color%>"><a href="http://<%=link.hostname%>/cgi-bin-status.html"><%=link.hostname%></a></td>
                        <% end %>
                        <td class="cbi-section-table-titles" style="background-color:<%=defaultgw_color%>"><a href="http://<%=link.hostname%>/cgi-bin-status.html"><%=link.hostname%></a></td>
-                       <td class="cbi-section-table-titles" style="background-color:<%=defaultgw_color%>"><%=link.interface%>/<%=link.localIP%>/<%=link.localMAC%></td>
+                       <td class="cbi-section-table-titles" style="background-color:<%=defaultgw_color%>"><%=link.interface%></td>
+                       <td class="cbi-section-table-titles" style="background-color:<%=defaultgw_color%>"><%=link.localIP%></td>
                        <td class="cbi-section-table-titles" style="background-color:<%=defaultgw_color%>"><%=string.format("%.3f", link.linkQuality)%></td>
                        <td class="cbi-section-table-titles" style="background-color:<%=defaultgw_color%>"><%=string.format("%.3f", link.neighborLinkQuality)%></td>
                        <td class="cbi-section-table-titles" style="background-color:<%=color%>"><%=string.format("%.3f", link.linkCost)%></td>
                        <td class="cbi-section-table-titles" style="background-color:<%=defaultgw_color%>"><%=string.format("%.3f", link.linkQuality)%></td>
                        <td class="cbi-section-table-titles" style="background-color:<%=defaultgw_color%>"><%=string.format("%.3f", link.neighborLinkQuality)%></td>
                        <td class="cbi-section-table-titles" style="background-color:<%=color%>"><%=string.format("%.3f", link.linkCost)%></td>