fix up editable stuff
[arvados.git] / apps / workbench / app / views / jobs / index.html.erb
1 <% content_for :head do %>
2 <style>
3   table.topalign>tbody>tr>td {
4   vertical-align: top;
5   }
6   table.topalign>thead>tr>td {
7   vertical-align: bottom;
8   }
9 </style>
10 <% end %>
11
12 <table class="topalign table">
13   <thead>
14     <tr class="contain-align-left">
15       <th>
16         id, result, schedule
17       </th><th>
18         script, parameters, input, output
19       </th><th>
20         resource_limits
21       </th>
22     </tr>
23   </thead>
24   <tbody>
25
26     <% @jobs.sort_by { |j| j[:created_at] }.reverse.each do |j| %>
27
28     <tr class="<%= 'error' if j.success == false %>">
29       <td>
30         <table class="table table-condensed table-hover">
31           <tr>
32             <td colspan="2">
33               <% if j.success == false %>
34               <span class="badge badge-warning" title="fail">&#x2716;</span>
35               <% elsif j.success %>
36               <span class="badge badge-success" title="success">&#x2714;</span>
37               <% elsif j.running %>
38               <span class="badge badge-info" title="running">&#x2708;</span>
39               <% else %>
40               <span class="badge" title="queued">&#x2709;</span>
41               <% end %>
42               <%= link_to_if_arvados_object j.uuid %>
43             </td>
44             <td>
45               <% if j.started_at and not j.finished_at %>
46               <% percent_total_tasks = 100 / (j.tasks_summary[:running] + j.tasks_summary[:done] + j.tasks_summary[:todo]) rescue 0 %>
47               <div class="progress" style="margin-bottom: 0">
48                 <div class="bar bar-success" style="width: <%= j.tasks_summary[:done] * percent_total_tasks rescue 0 %>%;"></div>
49                 <div class="bar" style="width: <%= j.tasks_summary[:running] * percent_total_tasks rescue 0 %>%; opacity: 0.3"></div>
50               </div>
51               <% end %>
52             </td>
53           </tr>
54           <tr>
55             <td>
56               queued
57             </td>
58             <td>
59               &#x2709;&nbsp;<span title="<%= j.created_at %>"><%= raw distance_of_time_in_words(Time.now, j.created_at).sub('about ','~').sub(' ','&nbsp;') + '&nbsp;ago' if j.created_at %></span>
60             </td>
61             <td>
62               <%= raw('for&nbsp;' + distance_of_time_in_words(j.started_at, j.created_at).sub('about ','~').sub(' ','&nbsp;')) if j.created_at and j.started_at %>
63             </td>
64           </tr>
65           <% if j.started_at.is_a? Time %>
66           <tr>
67             <td>
68               started
69             </td>
70             <td>
71               &#x2708;&nbsp;<span title="<%= j.created_at %>"><%= raw distance_of_time_in_words(j.started_at, Time.now).sub('about ','~').sub(' ','&nbsp;') + '&nbsp;ago' if j.started_at %></span>
72             </td>
73             <td>
74               <% if j.finished_at.is_a? Time %>
75               <%= raw('ran&nbsp;' + distance_of_time_in_words(j.finished_at, j.started_at).sub('about ','~').sub(' ','&nbsp;')) %>
76               <% elsif j.running %>
77               <span class="badge badge-success" title="tasks finished">&#x2714;&nbsp;<%= j.tasks_summary[:done] %></span>
78               <span class="badge badge-info" title="tasks running">&#x2708;&nbsp;<%= j.tasks_summary[:running] %></span>
79               <span class="badge" title="tasks todo">&#x2709;&nbsp;<%= j.tasks_summary[:todo] %></span>
80               <% if j.tasks_summary[:failed] %>
81               <span class="badge badge-warning" title="task failures">&#x2716;&nbsp;<%= j.tasks_summary[:failed] %></span>
82               <% end %>
83               <% end %>
84             </td>
85           </tr>
86           <% end %>
87         </table>
88       </td><td>
89         <table class="table table-condensed table-hover">
90           <tr class="info"><td colspan="2">
91               <%= j.script %> <%= j.script_version %>
92           </td></tr>
93           <% j.script_parameters.sort.each do |k,v| %>
94           <tr>
95             <td><%= k %></td><td><%= link_to_if_arvados_object v %></td>
96           </tr>
97           <% end %>
98           <tr>
99             <td>output</td><td><%= link_to_if_arvados_object j.output %></td>
100           </tr>
101         </table>
102       </td><td>
103         <table class="table table-condensed table-hover">
104         <% j.resource_limits.sort.each do |k,v| %>
105         <tr><td><%= v %></td><td><%= k %></td></tr>
106         <% end %>
107         </table>
108       </td>
109     </tr>
110
111     <% end %>
112
113   </tbody>
114 </table>