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