mrb_section.html 6.8 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211
  1. {% load static %}
  2. {% load humanize %}
  3. {% load project_url_tag %}
  4. <script src="{% static 'js/mrbsection.js' %}"></script>
  5. {% if mru %}
  6. {% if mrb_type == 'project' %}
  7. <h2>
  8. Latest project builds
  9. {% if project.is_default %}
  10. <span class="glyphicon glyphicon-question-sign get-help heading-help" data-original-title="Builds in this project cannot be started from Toaster: they are started from the command line"></span>
  11. {% endif %}
  12. </h2>
  13. {% else %}
  14. <div class="page-header">
  15. <h1>Latest builds</h1>
  16. </div>
  17. {% endif %}
  18. <div id="latest-builds">
  19. {% for build in mru %}
  20. <div data-latest-build-result="{{build.id}}" class="alert build-result {% if build.outcome == build.SUCCEEDED %}alert-success{% elif build.outcome == build.FAILED %}alert-danger{% else %}alert-info{% endif %}">
  21. <!-- project title -->
  22. {% if mrb_type != 'project' %}
  23. <div class="row project-name">
  24. <div class="col-md-12">
  25. <small>
  26. <a class="alert-link text-uppercase" href={% project_url build.project %}>{{build.project.name}}</a>
  27. </small>
  28. </div>
  29. </div>
  30. {% endif %}
  31. <div class="row" data-role="build-status-container">
  32. <div class="col-md-12">
  33. Loading...
  34. </div>
  35. </div>
  36. </div>
  37. {% endfor %}
  38. </div>
  39. {% endif %}
  40. <!-- build main template -->
  41. <script id="build-template" type="text/x-jsrender">
  42. <div class="col-md-3">
  43. <!-- only show link for completed builds -->
  44. <%if state == 'Succeeded' || state == 'Failed'%>
  45. <a class="alert-link" href="<%:dashboard_url%>">
  46. <span data-toggle="tooltip" data-role="targets-text" title="Recipes: <%:targets%>">
  47. <%:targets_abbreviated%>
  48. </span>
  49. </a>
  50. <%else%>
  51. <span data-toggle="tooltip" data-role="targets-text" title="Recipes: <%:targets%>">
  52. <%:targets_abbreviated%>
  53. </span>
  54. <%/if%>
  55. </div>
  56. <%if state == 'Queued'%>
  57. <%include tmpl='#queued-build-template'/%>
  58. <%else state == 'Succeeded' || state == 'Failed'%>
  59. <%include tmpl='#succeeded-or-failed-build-template'/%>
  60. <%else state == 'Cancelling'%>
  61. <%include tmpl='#cancelling-build-template'/%>
  62. <%else state == 'In Progress'%>
  63. <%include tmpl='#in-progress-build-template'/%>
  64. <%else state == 'Cancelled'%>
  65. <%include tmpl='#cancelled-build-template'/%>
  66. <%/if%>
  67. </script>
  68. <!-- queued build -->
  69. <script id="queued-build-template" type="text/x-jsrender">
  70. <div class="col-md-5">
  71. Build queued
  72. </div>
  73. <div class="col-md-4">
  74. <%if is_default_project_build%>
  75. <!-- no cancel icon -->
  76. <span class="glyphicon glyphicon-question-sign get-help get-help-blue pull-right" title="Builds in this project cannot be cancelled from Toaster: they can only be cancelled from the command line"></span>
  77. <%else%>
  78. <!-- cancel button -->
  79. <span class="cancel-build-btn pull-right alert-link"
  80. data-buildrequest-id="<%:id%>" data-request-url="<%:cancel_url%>">
  81. <span class="glyphicon glyphicon-remove-circle"></span>
  82. Cancel
  83. </span>
  84. <%/if%>
  85. </div>
  86. </script>
  87. <!-- in progress build -->
  88. <script id="in-progress-build-template" type="text/x-jsrender">
  89. <!-- progress bar and task completion percentage -->
  90. <div data-role="build-status" class="col-md-4 col-md-offset-1 progress-info">
  91. <!-- progress bar -->
  92. <div class="progress" id="build-pc-done-title-<%:id%>">
  93. <div id="build-pc-done-bar-<%:id%>"
  94. style="width: <%:tasks_complete_percentage%>%;"
  95. class="progress-bar">
  96. </div>
  97. </div>
  98. </div>
  99. <div class="col-md-4 progress-info">
  100. <!-- task completion percentage -->
  101. <span id="build-pc-done-<%:id%>"><%:tasks_complete_percentage%></span>% of
  102. tasks complete
  103. <%if is_default_project_build%>
  104. <!-- no cancel icon -->
  105. <span class="glyphicon glyphicon-question-sign get-help get-help-blue pull-right" title="Builds in this project cannot be cancelled from Toaster: they can only be cancelled from the command line"></span>
  106. <%else%>
  107. <!-- cancel button -->
  108. <span class="cancel-build-btn pull-right alert-link"
  109. data-buildrequest-id="<%:id%>" data-request-url="<%:cancel_url%>">
  110. <span class="glyphicon glyphicon-remove-circle"></span>
  111. Cancel
  112. </span>
  113. <%/if%>
  114. </div>
  115. </script>
  116. <!-- cancelling build -->
  117. <script id="cancelling-build-template" type="text/x-jsrender">
  118. <div class="col-md-9">
  119. Cancelling the build ...
  120. </div>
  121. </script>
  122. <!-- succeeded or failed build -->
  123. <script id="succeeded-or-failed-build-template" type="text/x-jsrender">
  124. <!-- completed_on -->
  125. <div class="col-md-2">
  126. <%:completed_on%>
  127. </div>
  128. <!-- errors -->
  129. <div class="col-md-2">
  130. <%if errors%>
  131. <span class="glyphicon glyphicon-minus-sign"></span>
  132. <a href="<%:dashboard_errors_url%>" class="alert-link">
  133. <%:errors%> error<%:errors_pluralize%>
  134. </a>
  135. <%/if%>
  136. </div>
  137. <!-- warnings -->
  138. <div class="col-md-2">
  139. <%if warnings%>
  140. <span class="glyphicon glyphicon-minus-sign"></span>
  141. <a href="<%:dashboard_warnings_url%>" class="alert-link">
  142. <%:warnings%> warning<%:warnings_pluralize%>
  143. </a>
  144. <%/if%>
  145. </div>
  146. <!-- build time -->
  147. <div class="col-md-3">
  148. Build time: <a class="alert-link" href="<%:buildtime_url%>"><%:buildtime%></a>
  149. <%if is_default_project_build%>
  150. <!-- info icon -->
  151. <span class="pull-right glyphicon glyphicon-question-sign get-help <%if state == 'Success'%>get-help-green<%else state == 'Failed'%>get-help-red<%else%>get-help-blue<%/if%>"
  152. title="Builds in this project cannot be started from Toaster: they are started from the command line">
  153. </span>
  154. <%else%>
  155. <!-- rebuild button -->
  156. <span class="rebuild-btn alert-link <%if state == 'Success'%>success<%else state == 'Failed'%>danger<%else%>info<%/if%> pull-right"
  157. data-request-url="<%:rebuild_url%>" data-target='<%:build_targets_json%>'>
  158. <span class="glyphicon glyphicon-repeat"></span>
  159. Rebuild
  160. </span>
  161. <%/if%>
  162. </div>
  163. </script>
  164. <!-- cancelled build -->
  165. <script id="cancelled-build-template" type="text/x-jsrender">
  166. <!-- build cancelled message -->
  167. <div class="col-md-6">
  168. Build cancelled
  169. </div>
  170. <!-- rebuild button -->
  171. <div class="col-md-3">
  172. <span class="info pull-right rebuild-btn alert-link"
  173. data-request-url="<%:rebuild_url%>" data-target='<%:build_targets_json%>'>
  174. <span class="glyphicon glyphicon-repeat"></span>
  175. Rebuild
  176. </span>
  177. </div>
  178. </script>
  179. <script>
  180. $(document).ready(function () {
  181. var ctx = {
  182. mrbType : "{{mrb_type}}",
  183. }
  184. try {
  185. mrbSectionInit(ctx);
  186. } catch (e) {
  187. document.write("Sorry, An error has occurred loading this page");
  188. console.warn(e);
  189. }
  190. });
  191. </script>