ocserv_status.htm 1.6 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566
  1. <script>
  2. function ocserv_disconnect(idx) {
  3. (new XHR()).post('<%=url('admin/vpn/ocserv/disconnect')%>/' + idx, { token: '<%=token%>' },
  4. function(x)
  5. {
  6. var tb = document.getElementById('ocserv_status_table');
  7. if (tb && (idx + 1 < tb.childNodes.length))
  8. tb.removeChild(tb.childNodes[idx + 1]);
  9. }
  10. );
  11. }
  12. XHR.poll(-1, '<%=url('admin/vpn/ocserv/status')%>', null,
  13. function(x, st)
  14. {
  15. var tb = document.getElementById('ocserv_status_table');
  16. if (st && tb)
  17. {
  18. var rows = [];
  19. for (var i = 0; i < st.length; i++)
  20. {
  21. rows.push([
  22. st[i].user,
  23. st[i].group,
  24. st[i].vpn_ip,
  25. st[i].ip,
  26. st[i].device,
  27. st[i].time,
  28. st[i].cipher,
  29. st[i].status,
  30. E('input', {
  31. type: 'button',
  32. class: 'cbi-button cbi-button-remove',
  33. onclick: 'ocserv_disconnect(%d)'.format(st[i].id)
  34. })
  35. ]);
  36. }
  37. cbi_update_table(tb, rows, '<em><%:There are no active users.%></em>');
  38. }
  39. }
  40. );
  41. </script>
  42. <fieldset class="cbi-section">
  43. <legend><%:Active OpenConnect Users%></legend>
  44. <div class="table" id="ocserv_status_table">
  45. <div class="tr table-titles">
  46. <div class="th"><%:User%></div>
  47. <div class="th"><%:Group%></div>
  48. <div class="th"><%:IP Address%></div>
  49. <div class="th"><%:VPN IP Address%></div>
  50. <div class="th"><%:Device%></div>
  51. <div class="th"><%:Time%></div>
  52. <div class="th"><%:Cipher%></div>
  53. <div class="th"><%:Status%></div>
  54. <div class="th">&#160;</div>
  55. </div>
  56. <div class="tr placeholder">
  57. <div class="td"><em><%:Collecting data...%></em></div>
  58. </div>
  59. </div>
  60. </fieldset>