Merge branch '18947-githttpd'
[arvados.git] / apps / workbench / app / views / projects / _container_summary.html.erb
1 <%# Copyright (C) The Arvados Authors. All rights reserved.
2
3 SPDX-License-Identifier: AGPL-3.0 %>
4
5 <div class="compute-summary-numbers">
6   <table>
7       <colgroup>
8         <col width="50%">
9         <col width="50%">
10       </colgroup>
11       <tr>
12         <th scope="col">Pending containers</th>
13         <th scope="col">Running containers</th>
14       </tr>
15       <tr>
16         <% pending_containers = Container.order("created_at asc").filter([["state", "in", ["Queued", "Locked"]], ["priority", ">", 0]]).limit(1) %>
17         <% running_containers = Container.order("started_at asc").where(state: "Running").limit(1) %>
18         <td><%= pending_containers.items_available %></td>
19         <td><%= running_containers.items_available %></td>
20       </tr>
21       <tr>
22         <th scope="col">Oldest pending</th>
23         <th scope="col">Longest running</th>
24       </tr>
25       <tr>
26         <td><% if pending_containers.first then %>
27             <%= link_to_if_arvados_object pending_containers.first, link_text: render_runtime(Time.now - pending_containers.first.created_at, false, false) %>
28           <% else %>
29             -
30           <% end %>
31         </td>
32
33         <td><% if running_containers.first then %>
34             <%= link_to_if_arvados_object running_containers.first, link_text: render_runtime(Time.now - running_containers.first.created_at, false, false) %>
35           <% else %>
36             -
37           <% end %>
38         </td>
39       </tr>
40     </table>
41
42 </div>