/hudson-core/src/main/resources/lib/hudson/executors.jelly

http://github.com/hudson/hudson · Unknown · 171 lines · 163 code · 8 blank · 0 comment · 0 complexity · 88d1639619ed7e5fdc9c3d32084b0074 MD5 · raw file

  1. <!--
  2. The MIT License
  3. Copyright (c) 2004-2010, Sun Microsystems, Inc., Kohsuke Kawaguchi,
  4. Stephen Connolly, id:cactusman, Yahoo! Inc., Alan Harder
  5. Permission is hereby granted, free of charge, to any person obtaining a copy
  6. of this software and associated documentation files (the "Software"), to deal
  7. in the Software without restriction, including without limitation the rights
  8. to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
  9. copies of the Software, and to permit persons to whom the Software is
  10. furnished to do so, subject to the following conditions:
  11. The above copyright notice and this permission notice shall be included in
  12. all copies or substantial portions of the Software.
  13. THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
  14. IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
  15. FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
  16. AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
  17. LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
  18. OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
  19. THE SOFTWARE.
  20. -->
  21. <?jelly escape-by-default='true'?>
  22. <j:jelly xmlns:j="jelly:core" xmlns:st="jelly:stapler" xmlns:d="jelly:define" xmlns:l="/lib/layout" xmlns:t="/lib/hudson" xmlns:f="/lib/form" xmlns:local="local">
  23. <st:documentation>
  24. Displays the status of executors.
  25. <st:attribute name="computers">
  26. If specified, this is the list of computers whose executors are rendered. If omitted, all the computers
  27. in the system will be rendered.
  28. </st:attribute>
  29. </st:documentation>
  30. <d:taglib uri="local">
  31. <d:tag name="computerCaption">
  32. <a href="${rootURL}/${c.url}" title="${c.node!=null? c.node.nodeDescription : ''}">${title}</a><st:nbsp/>
  33. <j:choose>
  34. <j:when test="${c.offline}">
  35. ${%offline}
  36. </j:when>
  37. <j:when test="${!c.acceptingTasks}">
  38. ${%suspended}
  39. </j:when>
  40. <j:when test="${c.oneOffExecutorsCount != 0}">
  41. ${c.busyCount}/${c.executorsCount}+${c.oneOffExecutorsCount}
  42. </j:when>
  43. <j:otherwise>
  44. ${c.busyCount}/${c.executorsCount}
  45. </j:otherwise>
  46. </j:choose>
  47. </d:tag>
  48. <d:tag name="executor">
  49. <j:if test="${!e.idle}">
  50. <tr>
  51. <j:choose>
  52. <j:when test="${!e.alive}">
  53. <td class="pane">
  54. <a href="${rootURL}/${c.url}${url}/causeOfDeath">
  55. <div class="error">${%Dead} (!)</div>
  56. </a>
  57. </td>
  58. <td class="pane"/>
  59. </j:when>
  60. <j:otherwise>
  61. <!-- not actually optional, but it helps with backward compatibility -->
  62. <j:set var="executor" value="${e}"/>
  63. <st:include it="${e.currentExecutable}" page="executorCell.jelly" optional="true">
  64. <td class="pane">
  65. <div style="white-space: normal">${%Building}
  66. <j:set var="exe" value="${e.currentExecutable}" />
  67. <j:invokeStatic var="exeparent"
  68. className="hudson.model.queue.Executables" method="getParentOf">
  69. <j:arg type="hudson.model.Queue$Executable" value="${exe}" />
  70. </j:invokeStatic>
  71. <j:choose>
  72. <j:when test="${h.hasPermission(exeparent,exeparent.READ)}">
  73. <a href="${rootURL}/${exeparent.url}">${exeparent.fullDisplayName}</a>&#160;<a href="${rootURL}/${exe.url}">#${exe.number}</a>
  74. <t:buildProgressBar build="${exe}" executor="${executor}"/>
  75. </j:when>
  76. <j:otherwise>
  77. <span>${%Unknown Task}</span>
  78. </j:otherwise>
  79. </j:choose>
  80. </div>
  81. </td>
  82. </st:include>
  83. <td class="pane" width="16" align="center" valign="middle">
  84. <j:if test="${e.hasStopPermission()}">
  85. <a href="${rootURL}/${c.url}${url}/stop">
  86. <img src="${imagesURL}/16x16/stop.gif" alt="${%terminate this build}"/>
  87. </a>
  88. </j:if>
  89. </td>
  90. </j:otherwise>
  91. </j:choose>
  92. </tr>
  93. </j:if>
  94. </d:tag>
  95. </d:taglib>
  96. <j:set var="computers" value="${attrs.computers?:app.computers}"/>
  97. <l:pane width="2" id="executors" title="&lt;a href='${rootURL}/computer/'>${%Build Executor Status}&lt;/a>">
  98. <colgroup>
  99. <col width="200*"/>
  100. <col width="24"/>
  101. </colgroup>
  102. <j:forEach var="c" items="${computers}">
  103. <tr>
  104. <j:choose>
  105. <j:when test="${c.node==app or computers.size()==1}">
  106. <th class="pane" colspan="2">
  107. <j:choose>
  108. <j:when test="${empty(app.slaves) or computers.size()==1}">
  109. <local:computerCaption title="Status"/>
  110. </j:when>
  111. <j:otherwise>
  112. <local:computerCaption title="Master"/>
  113. </j:otherwise>
  114. </j:choose>
  115. </th>
  116. </j:when>
  117. <j:otherwise>
  118. <th class="pane" colspan="2">
  119. <local:computerCaption title="${c.displayName}"/>
  120. </th>
  121. </j:otherwise>
  122. </j:choose>
  123. </tr>
  124. <j:choose>
  125. <j:when test="${c.connecting}">
  126. <tr>
  127. <td class="pane" colspan="2">
  128. Connecting
  129. </td>
  130. </tr>
  131. </j:when>
  132. <j:when test="${c.offline}">
  133. <tr>
  134. <td class="pane" colspan="2">
  135. Offline
  136. </td>
  137. </tr>
  138. </j:when>
  139. <j:when test="${c.idle}">
  140. <tr>
  141. <td class="pane" colspan="2">
  142. Idle
  143. </td>
  144. </tr>
  145. </j:when>
  146. <j:otherwise>
  147. <j:forEach var="e" items="${c.executors}" varStatus="eloop">
  148. <local:executor name="${eloop.index+1}" url="executors/${eloop.index}"/>
  149. </j:forEach>
  150. <j:forEach var="e" items="${c.oneOffExecutors}" varStatus="eloop">
  151. <local:executor name="" url="oneOffExecutors/${eloop.index}"/>
  152. </j:forEach>
  153. </j:otherwise>
  154. </j:choose>
  155. </j:forEach>
  156. </l:pane>
  157. <!-- schedule updates only for the full page reload -->
  158. <j:if test="${ajax==null and !h.isAutoRefresh(request) and h.hasPermission(app.READ)}">
  159. <script defer="defer">
  160. refreshPart('executors',"${h.hasView(it,'ajaxExecutors')?'.':rootURL}/ajaxExecutors");
  161. </script>
  162. </j:if>
  163. </j:jelly>