86447123129a3ede87a377bc9b14816ad8c3d153
[project/luci.git] / modules / niu / luasrc / view / niu / network.htm
1 <%
2 local dsp = require "luci.dispatcher"
3 local utl = require "luci.util"
4 local uci = require "luci.model.uci"
5
6 local nws = {}
7 uci.inst_state:foreach("network", "interface", function(s)
8         nws[#nws+1] = s
9 end)
10
11 if uci.inst_state:get("network", "lan", "_ipchanged") and
12 uci.inst_state:revert("network", "lan", "_ipchanged") then
13         include("niu/network/warn_ip_change")
14 end
15 %>
16
17 <div>Status:</div>
18 <table>
19 <% 
20 for _, v in ipairs(nws) do if v[".name"] ~= "loopback" then
21 %>
22 <tr><td><%=v[".name"]%></td><td><%=v.ipaddr%></td></tr>
23 <% end end %>
24 </table>
25 <br />
26 <ul>
27 <%
28 local nodes = dsp.node("niu", "network").nodes
29 local function cmp(a, b)
30         return (nodes[a].order or 100) < (nodes[b].order or 100)
31 end
32 for k, v in utl.spairs(nodes, cmp) do
33 %>
34 <li><a href="<%=dsp.build_url("niu", "network", k)%>"><%=v.title%></a></li>
35 <%
36 end
37 %>
38 </ul>