generate.html 2.3 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071
  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. {% if error %}
  9. <h2>ArduPilot Custom Firmware Builder</h2>
  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. <h2>ArduPilot Custom Firmware Builder</h2>
  20. <p>Build in progress...</p>
  21. <form action="/builds/{{token}}" target="_blank">
  22. <input type="submit" value="Go to build directory"/>
  23. </form>
  24. <form action="/builds" target="_blank">
  25. <input type="submit" value="See all builds"/>
  26. </form>
  27. <form action="/">
  28. <input type="submit" value="Queue another build">
  29. </form>
  30. </div>
  31. <p>Build ID: {{ token }}</p>
  32. <p>Build progress:</p>
  33. <textarea id="build_output" rows="30" cols="100" readonly>
  34. </textarea>
  35. <br><input type="checkbox" id="AutoScroll" checked>AutoScroll
  36. <script>
  37. function reload() {
  38. var output = document.getElementById('build_output');
  39. var xhr = new XMLHttpRequest();
  40. xhr.open('GET', "/builds/{{token}}/build.log");
  41. // disable cache, thanks to: https://stackoverflow.com/questions/22356025/force-cache-control-no-cache-in-chrome-via-xmlhttprequest-on-f5-reload
  42. xhr.setRequestHeader("Cache-Control", "no-cache, no-store, max-age=0");
  43. xhr.setRequestHeader("Expires", "Tue, 01 Jan 1980 1:00:00 GMT");
  44. xhr.setRequestHeader("Pragma", "no-cache");
  45. xhr.onload = function () {
  46. if (xhr.status === 200) {
  47. output.textContent = xhr.responseText;
  48. var scrollcheck = document.getElementById('AutoScroll');
  49. if (scrollcheck.checked) {
  50. output.scrollTop = output.scrollHeight;
  51. }
  52. if (xhr.responseText.includes("BUILD_FINISHED")) {
  53. return;
  54. }
  55. }
  56. setTimeout(reload, 3000)
  57. }
  58. xhr.send();
  59. }
  60. </script>
  61. </div>
  62. </body>
  63. {% endif %}
  64. </html>