d302577685233f14a0225ab3dbcc8bbe069e5207
[project/luci.git] / applications / luci-app-olsr / luasrc / view / status-olsr / topology.htm
1 <%#
2  Copyright 2008 Steven Barth <steven@midlink.org>
3  Copyright 2008 Jo-Philipp Wich <xm@leipzig.freifunk.net>
4  Copyright 2011 Manuel Munz <freifunk at somakoma dot de>
5  Licensed to the public under the Apache License 2.0.
6 -%>
7
8 <%
9 local i = 1
10 local olsrtools = require "luci.tools.olsr"
11 %>
12
13 <%+header%>
14 <h2><a id="content" name="content"><%:Active OLSR nodes%></a></h2>
15
16 <div id="togglebuttons"></div>
17
18 <fieldset class="cbi-section">
19         <legend><%:Overview of currently known OLSR nodes%></legend>
20         <table class="cbi-section-table">
21                 <tr class="cbi-section-table-titles">
22                         <th class="cbi-section-table-cell"><%:OLSR node%></th>
23                         <th class="cbi-section-table-cell"><%:Last hop%></th>
24                         <th class="cbi-section-table-cell"><%:LQ%></th>
25                         <th class="cbi-section-table-cell"><%:NLQ%></th>
26                         <th class="cbi-section-table-cell"><%:ETX%></th>
27                 </tr>
28
29                 <% for k, route in ipairs(routes) do 
30                         local cost = string.format("%.3f", tonumber(route.tcEdgeCost/1024) or 0)
31                         local color = olsrtools.etx_color(tonumber(cost))
32                         local lq = string.format("%.3f", tonumber(route.linkQuality) or 0)
33                         local nlq = string.format("%.3f", tonumber(route.neighborLinkQuality) or 0)
34                 %>
35
36                 <tr class="cbi-section-table-row cbi-rowstyle-<%=i%> proto-<%=route.proto%>">
37
38                         <% if route.proto == "6" then %>
39
40                         <td class="cbi-section-table-cell"><a href="http://[<%=route.destinationIP%>]/cgi-bin-status.html"><%=route.destinationIP%></a></td>
41                         <td class="cbi-section-table-cell"><a href="http://[<%=route.lastHopIP%>]/cgi-bin-status.html"><%=route.lastHopIP%></a></td>
42
43                         <% else %>
44
45                         <td class="cbi-section-table-cell"><a href="http://<%=route.destinationIP%>/cgi-bin-status.html"><%=route.destinationIP%></a></td>
46                         <td class="cbi-section-table-cell"><a href="http://<%=route.lastHopIP%>/cgi-bin-status.html"><%=route.lastHopIP%></a></td>
47
48                         <%end%>
49
50                         <td class="cbi-section-table-cell"><%=lq%></td>
51                         <td class="cbi-section-table-cell"><%=nlq%></td>
52                         <td class="cbi-section-table-cell" style="background-color:<%=color%>"><%=cost%></td>
53                 </tr>
54
55                 <%      i = ((i % 2) + 1)
56                 end %>
57         </table>
58 <%+status-olsr/legend%>
59 </fieldset>
60
61 <%+status-olsr/common_js%>
62 <%+footer%>