<%# 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. You may obtain a copy of the License at http://www.apache.org/licenses/LICENSE-2.0 -%> <% 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 %> <%+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%> LQ NLQ ETX SNR
<%=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%>

<%+status-olsr/legend%>
<%+status-olsr/common_js%> <%+footer%>