Merge pull request #1933 from Ansuel/hostname_upnp
[oweals/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].host_hint || "<%:Unknown%>",
27                                                 st[i].intport,
28                                                 st[i].descr,
29                                                 E('<div><input class="cbi-button cbi-button-remove" type="button" value="<%:Delete%>" onclick="upnp_delete_fwd(%d)" /></div>'.format(st[i].num))
30                                         ]);
31
32                                 cbi_update_table(tb, rows, '<em><%:There are no active redirects.%></em>');
33                         }
34                 }
35         );
36 //]]></script>
37
38 <div class="cbi-section">
39         <h3><%:Active UPnP Redirects%></h3>
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"><%:Host%></div>
46                         <div class="th"><%:Client Port%></div>
47                         <div class="th"><%:Description%></div>
48                         <div class="th cbi-section-actions">&#160;</div>
49                 </div>
50                 <div class="tr placeholder">
51                         <div class="td"><em><%:Collecting data...%></em></div>
52                 </div>
53         </div>
54 </div>