* luci-0.8: backport luci-app-olsr improvements
[project/luci.git] / applications / luci-olsr / luasrc / view / status-olsr / routes.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
6 Licensed under the Apache License, Version 2.0 (the "License");
7 you may not use this file except in compliance with the License.
8 You may obtain a copy of the License at
9
10 http://www.apache.org/licenses/LICENSE-2.0
11
12 $Id$
13
14 -%>
15 <%+header%>
16 <h1><%:olsr_routes%></h1>
17 <br />
18 <table class="smalltext" cellspacing="0" cellpadding="6">
19 <tr>
20 <th><%:destination%></th>
21 <th><%:gateway%></th>
22 <th><%:interface%></th>
23 <th><%:metric%></th>
24 <th>ETX</th>
25 </tr>
26 <% for k, route in ipairs(routes) do
27 local color = "#bb3333"
28
29 route.ETX = tonumber(route.ETX)
30 if route.ETX == 0 then
31 color = "#bb3333"
32 elseif route.ETX < 4 then
33 color = "#00cc00"
34 elseif route.ETX < 10 then
35 color = "#ffcb05"
36 elseif route.ETX < 100 then
37 color = "#ff6600"
38 end
39 %>
40 <tr>
41 <td><%=route.Destination%></td>
42 <td><%=route["Gateway IP"]%></td>
43 <td><%=route.Interface%></td>
44 <td><%=route.Metric%></td>
45 <td style="background-color:<%=color%>"><%=string.format("%.3f", tonumber(route.ETX) or 0)%></td>
46 </tr>
47 <% end %>
48 </table>
49 <br />
50 <%+footer%>