generate.html 2.2 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172
  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
  35. <script>
  36. function reload() {
  37. var output = document.getElementById('build_output');
  38. var xhr = new XMLHttpRequest();
  39. xhr.open('GET', "/builds/{{token}}/build.log");
  40. // disable cache, thanks to: https://stackoverflow.com/questions/22356025/force-cache-control-no-cache-in-chrome-via-xmlhttprequest-on-f5-reload
  41. xhr.setRequestHeader("Cache-Control", "no-cache, no-store, max-age=0");
  42. xhr.setRequestHeader("Expires", "Tue, 01 Jan 1980 1:00:00 GMT");
  43. xhr.setRequestHeader("Pragma", "no-cache");
  44. xhr.onload = function () {
  45. if (xhr.status == 200) {
  46. output.textContent = xhr.responseText;
  47. var scrollcheck = document.getElementById('AutoScroll');
  48. if (scrollcheck.checked) {
  49. output.scrollTop = output.scrollHeight;
  50. }
  51. if (xhr.responseText.includes("BUILD_FINISHED")) {
  52. return;
  53. }
  54. }
  55. setTimeout(reload, 3000)
  56. }
  57. xhr.send();
  58. }
  59. </script>
  60. </body>
  61. {% endif %}
  62. </html>