index.html 4.5 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121
  1. <!doctype html>
  2. <head>
  3. <link rel="stylesheet" type="text/css" href="{{ url_for('static',filename='styles/main.css') }}">
  4. <script type="text/javascript" src="{{ url_for('static', filename='js/CollapsibleLists.js')}}"></script>
  5. <title>ArduPilot Custom Firmware Builder</title>
  6. </head>
  7. <body onload="javascript: reload()">
  8. <div id="main">
  9. <a href="https://custom.ardupilot.org/">
  10. <div id="logo">
  11. </div>
  12. </a>
  13. <div id="menu">
  14. <h2>ArduPilot Custom Firmware Builder</h2>
  15. <br><b>This site is EXPERIMENTAL</b>
  16. <p>Please select the required options for the custom firmware build.</p>
  17. <textarea style="float:right" readonly>hello</textarea>
  18. <form action="/generate" method="post">
  19. <label for="vehicle">Choose a vehicle:
  20. <select name="vehicle">
  21. {% for vehicle in get_vehicles()[0] %}
  22. {% if vehicle == get_vehicles()[1] %}
  23. <option value="{{vehicle}}" selected>{{vehicle}}</option>
  24. {% else %}
  25. <option value="{{vehicle}}">{{vehicle}}</option>
  26. {% endif %}
  27. {% endfor %}
  28. </select>
  29. </label>
  30. <p></p>
  31. <label for="board">Choose a board:
  32. <select name="board">
  33. {% for board in get_boards()[0] %}
  34. {% if board == get_boards()[1] %}
  35. <option value="{{board}}" selected>{{board}}</option>
  36. {% else %}
  37. <option value="{{board}}">{{board}}</option>
  38. {% endif %}
  39. {% endfor %}
  40. </select>
  41. </label>
  42. <p></p>
  43. <label for="board">Select Features:
  44. <ul class="collapsibleList">
  45. {% for c in get_build_categories() %}
  46. <li>{{c}}
  47. <ul>
  48. {% for f in get_build_options(c) %}
  49. <li>
  50. {% if f.default == 1 %}
  51. <input onclick='dependencies(this, "{{f.label}}", "{{f.dependency}}");' type="checkbox"
  52. name="{{f.label}}" id="{{f.label}}" value="1" checked>
  53. {% else %}
  54. <input onclick='dependencies(this, "{{f.label}}", "{{f.dependency}}");' type="checkbox"
  55. name="{{f.label}}" id="{{f.label}}" value="1">
  56. {% endif %}
  57. {{f.description}}
  58. </li>
  59. {% endfor %}
  60. </ul>
  61. </li>
  62. {% endfor %}
  63. </ul>
  64. </label>
  65. <br>
  66. <input type="submit" value="Generate">
  67. </form>
  68. </div>
  69. <hr>
  70. <div id="build_status"></div>
  71. <br/>
  72. <script>
  73. CollapsibleLists.apply();
  74. function reload() {
  75. var output = document.getElementById('build_status');
  76. var xhr = new XMLHttpRequest();
  77. xhr.open('GET', "/builds/status.html");
  78. // disable cache, thanks to: https://stackoverflow.com/questions/22356025/force-cache-control-no-cache-in-chrome-via-xmlhttprequest-on-f5-reload
  79. xhr.setRequestHeader("Cache-Control", "no-cache, no-store, max-age=0");
  80. xhr.setRequestHeader("Expires", "Tue, 01 Jan 1980 1:00:00 GMT");
  81. xhr.setRequestHeader("Pragma", "no-cache");
  82. xhr.onload = function () {
  83. if (xhr.status === 200) {
  84. output.innerHTML = xhr.responseText;
  85. }
  86. setTimeout(reload, 5000)
  87. }
  88. xhr.send();
  89. }
  90. function dependencies(cb, f_label, f_dependency1) {
  91. switch (cb.name) {
  92. case f_label:
  93. const f_dependency = f_dependency1.split(",")
  94. var arrayLength = f_dependency.length;
  95. for (var i = 0; i < arrayLength; i++) {
  96. if (document.getElementById(f_dependency[i]).checked == false) {
  97. document.getElementById(f_dependency[i]).checked = cb.checked;
  98. }
  99. }
  100. break;
  101. }
  102. }
  103. </script>
  104. </div>
  105. </body>
  106. <hr>
  107. <footer>Created by Will Piper, <a href=https://github.com/ArduPilot/CustomBuild>Source Code</a>.</footer>
  108. </html>