generate.html 2.2 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071
  1. <!doctype html>
  2. <html>
  3. <head>
  4. <link rel= "stylesheet" type= "text/css" href= "{{ url_for('static',filename='styles/main.css') }}">
  5. </head>
  6. <title>ArduPilot Custom Firmware Builder</title>
  7. <h2>ArduPilot Custom Firmware Builder</h2>
  8. {% if error %}
  9. <p>{{ error }} {{ex}}</p>
  10. {% else %}
  11. <body onload="javascript: reload()">
  12. <div id="main">
  13. <a href="https://custom.ardupilot.org/">
  14. <div id="logo">
  15. </div>
  16. </a>
  17. <div id="menu">
  18. <p>Build in progress...</p>
  19. <form action="/builds/{{token}}" target="_blank">
  20. <input type="submit" value="Go to build directory" />
  21. </form>
  22. <form action="/builds" target="_blank">
  23. <input type="submit" value="See all builds" />
  24. </form>
  25. <form action="/">
  26. <input type="submit" value="Queue another build">
  27. </form>
  28. </div>
  29. <p>Build ID: {{ token }}</p>
  30. <p>Build progress:</p>
  31. <textarea
  32. id="build_output" rows="30" cols="100" readonly>
  33. </textarea>
  34. <br><input type="checkbox" id="AutoScroll" checked>AutoScroll<script>
  35. function reload() {
  36. var output = document.getElementById('build_output');
  37. var xhr = new XMLHttpRequest();
  38. xhr.open('GET', "/builds/{{token}}/build.log");
  39. // disable cache, thanks to: https://stackoverflow.com/questions/22356025/force-cache-control-no-cache-in-chrome-via-xmlhttprequest-on-f5-reload
  40. xhr.setRequestHeader("Cache-Control", "no-cache, no-store, max-age=0");
  41. xhr.setRequestHeader("Expires", "Tue, 01 Jan 1980 1:00:00 GMT");
  42. xhr.setRequestHeader("Pragma", "no-cache");
  43. xhr.onload = function() {
  44. if (xhr.status == 200) {
  45. output.textContent = xhr.responseText;
  46. var scrollcheck = document.getElementById('AutoScroll');
  47. if (scrollcheck.checked) {
  48. output.scrollTop = output.scrollHeight;
  49. }
  50. if (xhr.responseText.includes("BUILD_FINISHED")) {
  51. return;
  52. }
  53. }
  54. setTimeout(reload,3000)
  55. }
  56. xhr.send();
  57. }
  58. </script>
  59. </body>
  60. {% endif %}
  61. </html>