X-Git-Url: http://git.archive.openwrt.org/?a=blobdiff_plain;ds=sidebyside;f=applications%2Fluci-olsr%2Fluasrc%2Fview%2Fstatus-olsr%2Fneighbors.htm;h=daa52831f6c7cfe82eaff2360efd2d05d3f53f50;hb=9edd0e46c3f880727738ce8ca6ff1c8b85f99ef4;hp=60afdc37ddab6fd2960905ecd27943e2cc837d10;hpb=210d77543369ab3f44e5aa4894ed82134019c1b5;p=project%2Fluci.git diff --git a/applications/luci-olsr/luasrc/view/status-olsr/neighbors.htm b/applications/luci-olsr/luasrc/view/status-olsr/neighbors.htm index 60afdc37d..daa52831f 100644 --- a/applications/luci-olsr/luasrc/view/status-olsr/neighbors.htm +++ b/applications/luci-olsr/luasrc/view/status-olsr/neighbors.htm @@ -2,6 +2,7 @@ LuCI - Lua Configuration Interface Copyright 2008 Steven Barth Copyright 2008 Jo-Philipp Wich +Copyright 2011 Manuel Munz Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. @@ -9,53 +10,172 @@ You may obtain a copy of the License at http://www.apache.org/licenses/LICENSE-2.0 -$Id: index.htm 6619 2010-12-05 15:02:44Z soma $ - -%> -<%+header%> -

<%:OLSR connections%>

-

<%:Overview of currently established OLSR connections%>

-
- - - - - - - - - - -<% for k, link in ipairs(links) do - local color = "#bb3333" - - link.Cost = tonumber(link.Cost) or 0 - if link.Cost == 0 then - color = "#bb3333" - elseif link.Cost < 4 then - color = "#00cc00" - elseif link.Cost < 10 then - color = "#ffcb05" - elseif link.Cost < 100 then - color = "#ff6600" + +<% +local olsrtools = require "luci.tools.olsr" +local i = 1 + +if luci.http.formvalue("status") == "1" then + local rv = {} + for k, link in ipairs(links) do + link.linkCost = tonumber(link.linkCost)/1024 or 0 + if link.linkCost == 4096 then + link.linkCost = 0 + end + local color = olsrtools.etx_color(link.linkCost) + local snr_color = olsrtools.snr_color(link.snr) + defaultgw_color = "" + if link.defaultgw == 1 then + defaultgw_color = "#ffff99" + end + + rv[#rv+1] = { + rip = link.remoteIP, + hn = link.hostname, + lip = link.localIP, + ifn = link.interface, + lq = string.format("%.3f", link.linkQuality), + nlq = string.format("%.3f",link.neighborLinkQuality), + cost = string.format("%.3f", link.linkCost), + snr = link.snr, + signal = link.signal, + noise = link.noise, + color = color, + snr_color = snr_color, + dfgcolor = defaultgw_color, + proto = link.proto + } end + luci.http.prepare_content("application/json") + luci.http.write_json(rv) + return +end %> - - - - - - - - - -<% end %> -
<%:Neighbour IP%><%:Hostname%><%:Local interface IP%><%:Device%>LQNLQETX
/cgi-bin-status.html"><%=link["Remote IP"]%>/cgi-bin-status.html"><%=link["Hostname"]%><%=link["Local IP"]%><%=link["Local Device"]%><%=link.LQ%><%=link.NLQ%><%=string.format("%.3f", link.Cost)%>
+ +<%+header%> + + + + + +

<%:OLSR connections%>

+ +
+ +
+ <%:Overview of currently established OLSR connections%> + + + + + + + + + + + + + + + + + <% local i = 1 + for k, link in ipairs(links) do + link.linkCost = tonumber(link.linkCost)/1024 or 0 + if link.linkCost == 4096 then + link.linkCost = 0 + end + + 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" + end + %> + + + <% if link.proto == "6" then %> + + <% else %> + + <% end %> + + + + + + + + + <% + i = ((i % 2) + 1) + end %> + +
<%:Neighbour IP%><%:Hostname%><%:Interface%><%:Local interface IP%>LQNLQETXSNR
<%=link.remoteIP%><%=link.remoteIP%><%=link.hostname%><%=link.interface%><%=link.localIP%><%=string.format("%.3f", link.linkQuality)%><%=string.format("%.3f", link.neighborLinkQuality)%><%=string.format("%.3f", link.linkCost)%><%=link.snr%>

-

<%:Legend%>:

-
    -
  • LQ: <%:Success rate of packages received from the neighbour%>
  • -
  • NLQ: <%:Success rate of packages sent to the neighbour%>
  • -
  • ETX: <%:Expected retransmission count%>
  • -
+ +<%+status-olsr/legend%> +
+<%+status-olsr/common_js%> <%+footer%>