ahcp_status.htm 1.6 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253
  1. <script type="text/javascript">//<![CDATA[
  2. XHR.poll(5, '<%=luci.dispatcher.build_url("admin", "network", "ahcpd", "status")%>', null,
  3. function(x, st)
  4. {
  5. var tb = document.getElementById('ahcpd_status_table');
  6. var tx = document.getElementById('ahcpd_status_text');
  7. if (st && tb && tx)
  8. {
  9. /* clear all rows */
  10. while( tb.rows.length > 1 )
  11. tb.deleteRow(1);
  12. for( var i = 0; i < st.leases.length; i++ )
  13. {
  14. var tr = tb.insertRow(-1);
  15. tr.className = 'cbi-section-table-row cbi-rowstyle-' + ((i % 2) + 1);
  16. tr.insertCell(-1).innerHTML = st.leases[i].addr;
  17. tr.insertCell(-1).innerHTML = String.format('%t', st.leases[i].age);
  18. }
  19. if( tb.rows.length == 1 )
  20. {
  21. var tr = tb.insertRow(-1);
  22. tr.className = 'cbi-section-table-row';
  23. var td = tr.insertCell(-1);
  24. td.colSpan = 2;
  25. td.innerHTML = '<em><br /><%:There are no active leases.%></em>';
  26. }
  27. if( st.uid == '00:00:00:00:00:00:00:00' )
  28. tx.innerHTML = '<%:The AHCP Service is not running.%>';
  29. else
  30. tx.innerHTML = String.format('<%:The AHCP Service is running with ID %s.%>', st.uid);
  31. }
  32. }
  33. );
  34. //]]></script>
  35. <fieldset class="cbi-section">
  36. <legend><%:Active AHCP Leases%></legend>
  37. <p id="ahcpd_status_text"></p>
  38. <table class="cbi-section-table" id="ahcpd_status_table">
  39. <tr class="cbi-section-table-titles">
  40. <th class="cbi-section-table-cell"><%:Address%></th>
  41. <th class="cbi-section-table-cell"><%:Age%></th>
  42. </tr>
  43. <tr class="cbi-section-table-row">
  44. <td colspan="5"><em><br /><%:Collecting data...%></em></td>
  45. </tr>
  46. </table>
  47. </fieldset>