459c63c1d7111a10b157e15cf3facea5d821e87a
[project/luci.git] / applications / luci-app-upnp / luasrc / view / upnp_status.htm
1 <script type="text/javascript">//<![CDATA[
2 function upnp_delete_fwd(idx) {
3 (new XHR()).post('<%=url('admin/services/upnp/delete')%>/' + idx, { token: '<%=token%>' },
4 function(x)
5 {
6 var tb = document.getElementById('upnp_status_table');
7 if (tb && (idx + 1 < tb.childNodes.length))
8 tb.removeChild(tb.childNodes[idx + 1]);
9 }
10 );
11 }
12
13 XHR.poll(5, '<%=url('admin/services/upnp/status')%>', null,
14 function(x, st)
15 {
16 var tb = document.getElementById('upnp_status_table');
17 if (st && tb)
18 {
19 var rows = [];
20
21 for (var i = 0; i < st.length; i++)
22 rows.push([
23 st[i].proto,
24 st[i].extport,
25 st[i].intaddr,
26 st[i].intport,
27 st[i].descr,
28 E('<input class="cbi-button cbi-button-remove" type="button" value="<%:Delete%>" onclick="upnp_delete_fwd(%d)" />'.format(st[i].num))
29 ]);
30
31 cbi_update_table(tb, rows, '<em><%:There are no active redirects.%></em>');
32 }
33 }
34 );
35 //]]></script>
36
37 <div class="cbi-section">
38 <legend><%:Active UPnP Redirects%></legend>
39 <div class="cbi-section-node">
40 <div class="table" id="upnp_status_table">
41 <div class="tr table-titles">
42 <div class="th"><%:Protocol%></div>
43 <div class="th"><%:External Port%></div>
44 <div class="th"><%:Client Address%></div>
45 <div class="th"><%:Client Port%></div>
46 <div class="th"><%:Description%></div>
47 <div class="th cbi-section-actions">&#160;</div>
48 </div>
49 <div class="tr">
50 <div class="td" colspan="5"><em><%:Collecting data...%></em></div>
51 </div>
52 </div>
53 </div>
54 </div>