Add basic select-and-compare interface to pipeline_instances#index.
[arvados.git] / apps / workbench / app / views / pipeline_instances / index.html.erb
1 <%= form_tag({action: 'compare', controller: 'pipeline_instances', method: 'get'}, {method: 'get', id: 'compare'}) do |f| %>
2
3 <table class="table table-hover">
4   <thead>
5     <tr class="contain-align-left">
6       <th>
7         <%= submit_tag 'Compare', {class: 'btn btn-primary', disabled: true} %>
8       </th><th>
9         status
10       </th><th>
11         id
12       </th><th>
13         name
14       </th><th>
15         template
16       </th><th>
17         owner
18       </th><th>
19         components
20       </th><th>
21         dependencies
22       </th><th>
23         created
24       </th>
25     </tr>
26   </thead>
27   <tbody>
28
29     <% @objects.sort_by { |ob| ob.created_at }.reverse.each do |ob| %>
30
31     <tr>
32       <td>
33         <%= check_box_tag 'uuids[]', ob.uuid, false %>
34       </td><td>
35         <% if ob.success %>
36         <span class="label label-success">success</span>
37         <% elsif ob.active %>
38         <span class="label label-info">active</span>
39         <% end %>
40       </td><td>
41         <%= link_to_if_arvados_object ob %>
42       </td><td>
43         <%= ob.name %>
44       </td><td>
45         <%= link_to_if_arvados_object ob.pipeline_template_uuid %>
46       </td><td>
47         <%= link_to_if_arvados_object ob.owner_uuid %>
48       </td><td>
49         <% ob.components.each do |cname, c| %>
50         <% status = if !(c.is_a?(Hash) && c[:job].is_a?(Hash)) then nil elsif c[:job][:success] then 'success' elsif c[:job][:running] then 'info' else 'warning' end %>
51         <span class="label <%= "label-#{status}" if status %>"><%= cname.to_s %></span>
52         <% end %>
53       </td><td>
54         <small>
55           <% ob.dependencies.each do |d| %>
56           <%= d %><br />
57           <% end %>
58         </small>
59       </td><td>
60         <%= ob.created_at %>
61       </td>
62     </tr>
63
64     <% end %>
65
66   </tbody>
67 </table>
68
69 <% end %>
70
71 <% content_for :footer_js do %>
72 $('form#compare input[name="uuids[]"]').on('click', function() {
73     var form = $('form#compare')[0]
74     $('input[type=submit]', form).prop('disabled',true);
75     $('input[name="uuids[]"]', form).each(function(){
76         if(this.checked) {
77             $('input[type=submit]', form).prop('disabled',false);
78         }
79     });
80 });
81 <% end %>