generate.html 2.3 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172
  1. <!doctype html>
  2. <html lang="en">
  3. <head>
  4. <meta charset="utf-8">
  5. <title>ArduPilot Custom Firmware Builder</title>
  6. <link rel="stylesheet" type="text/css" href="{{ url_for('static',filename='styles/main.css') }}">
  7. </head>
  8. <h2>ArduPilot Custom Firmware Builder</h2>
  9. {% if error %}
  10. <p>{{ error }} {{ex}}</p>
  11. {% else %}
  12. <body onload="javascript: reload()">
  13. <div id="main">
  14. <a href="https://custom.ardupilot.org/">
  15. <div id="logo">
  16. </div>
  17. </a>
  18. <div id="menu">
  19. <p>Build in progress...</p>
  20. <form action="/builds/{{token}}" target="_blank">
  21. <input type="submit" value="Go to build directory"/>
  22. </form>
  23. <form action="/builds" target="_blank">
  24. <input type="submit" value="See all builds"/>
  25. </form>
  26. <form action="/">
  27. <input type="submit" value="Queue another build">
  28. </form>
  29. </div>
  30. <p>Build ID: {{ token }}</p>
  31. <p>Build progress:</p>
  32. <textarea 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. </div>
  61. </body>
  62. {% endif %}
  63. </html>