generate.html 2.0 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667
  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 }}!</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" method="post">
  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 autocomplete="off">
  33. </textarea>
  34. <script>
  35. function reload() {
  36. var output = document.getElementById('build_output');
  37. output.scrollTop = output.scrollHeight;
  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. if (xhr.responseText.includes("BUILD_FINISHED")) {
  48. return;
  49. }
  50. }
  51. setTimeout(reload,3000)
  52. }
  53. xhr.send();
  54. }
  55. </script>
  56. </body>
  57. {% endif %}
  58. </html>