PageRenderTime 27ms CodeModel.GetById 16ms app.highlight 4ms RepoModel.GetById 1ms app.codeStats 1ms

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