modules/admin-full: reimplement conntrack page as template
[project/luci.git] / modules / admin-full / luasrc / view / admin_status / conntrack.htm
1 <%#
2 LuCI - Lua Configuration Interface
3 Copyright 2008-2009 Steven Barth <steven@midlink.org>
4 Copyright 2008-2009 Jo-Philipp Wich <xm@subsignal.org>
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
16 <%-
17         require "bit"
18         require "luci.fs"
19         require "luci.sys"
20         require "luci.tools.webadmin"
21
22         local style = true
23 -%>
24
25 <%+header%>
26
27 <div class="cbi-map" id="cbi-conntrack">
28         <h2><a id="content" name="content"><%:a_n_conntrack%></a></h2>
29         <div class="cbi-map-descr"><%:a_n_conntrack_desc%></div>
30
31         <fieldset class="cbi-section" id="cbi-table-table">
32                 <legend>ARP</legend>
33                 <div class="cbi-section-node">
34                         <table class="cbi-section-table">
35                                 <tr class="cbi-section-table-titles">
36                                         <th class="cbi-section-table-cell"><%:ipaddress%></th>
37                                         <th class="cbi-section-table-cell"><%:macaddress%></th>
38                                         <th class="cbi-section-table-cell"><%:interface%></th>
39                                 </tr>
40
41                                 <% luci.sys.net.arptable(function(e) %>
42                                 <tr class="cbi-section-table-row cbi-rowstyle-<%=(style and 1 or 2)%>">
43                                         <td class="cbi-value-field"><%=e["IP address"]%></td>
44                                         <td class="cbi-value-field"><%=e["HW address"]%></td>
45                                         <td class="cbi-value-field"><%=e["Device"]%></td>
46                                 </tr>
47                                 <% style = not style; end) %>
48                         </table>
49                 </div>
50         </fieldset>
51         <br />
52
53         <fieldset class="cbi-section" id="cbi-table-table">
54                 <legend><%:a_n_conntrack%></legend>
55                 <div class="cbi-section-node">
56                         <table class="cbi-section-table">
57                                 <tr class="cbi-section-table-titles">
58                                         <th class="cbi-section-table-cell"><%:network%></th>
59                                         <th class="cbi-section-table-cell"><%:protocol%></th>
60                                         <th class="cbi-section-table-cell"><%:source%></th>
61                                         <th class="cbi-section-table-cell"><%:destination%></th>
62                                 </tr>
63
64                                 <% style = true; luci.sys.net.conntrack(function(c) %>
65                                 <tr class="cbi-section-table-row cbi-rowstyle-<%=(style and 1 or 2)%>">
66                                         <td class="cbi-value-field"><%=c.layer3:upper()%></td>
67                                         <td class="cbi-value-field"><%=c.layer4:upper()%></td>
68                                         <td class="cbi-value-field"><%=c.src%></td>
69                                         <td class="cbi-value-field"><%=c.dst%></td>
70                                 </tr>
71                                 <% style = not style; end) %>
72                         </table>
73                 </div>
74         </fieldset>
75         <br />
76 </div>
77         
78 <%+footer%>
79