Merge branch 'master' into 1979-workbench-ui
[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><th>
25       </th>
26     </tr>
27   </thead>
28   <tbody>
29
30     <% @objects.sort_by { |ob| ob.created_at }.reverse.each do |ob| %>
31
32     <tr data-object-uuid="<%= ob.uuid %>">
33       <td>
34         <%= check_box_tag 'uuids[]', ob.uuid, false %>
35       </td><td>
36         <% if ob.success %>
37         <span class="label label-success">success</span>
38         <% elsif ob.active %>
39         <span class="label label-info">active</span>
40         <% end %>
41       </td><td>
42         <%= link_to_if_arvados_object ob %>
43       </td><td>
44         <%= ob.name %>
45       </td><td>
46         <%= link_to_if_arvados_object ob.pipeline_template_uuid %>
47       </td><td>
48         <%= link_to_if_arvados_object ob.owner_uuid %>
49       </td><td>
50         <% ob.components.each do |cname, c| %>
51         <% 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 %>
52         <span class="label <%= "label-#{status}" if status %>"><%= cname.to_s %></span>
53         <% end %>
54       </td><td>
55         <small>
56           <% ob.dependencies.each do |d| %>
57           <%= d %><br />
58           <% end %>
59         </small>
60       </td><td>
61         <%= ob.created_at %>
62       </td><td>
63         <% if ob.editable? %>
64         <%= link_to({action: 'destroy', id: ob.uuid}, method: :delete, remote: true, data: {confirm: "You are about to delete #{controller.model_class} #{ob.uuid}.\n\nAre you sure?"}) do %>
65         <i class="icon-trash"></i>
66         <% end %>
67         <% end %>
68       </td>
69     </tr>
70
71     <% end %>
72
73   </tbody>
74 </table>
75
76 <% end %>
77
78 <% content_for :footer_js do %>
79 $('form#compare input[name="uuids[]"]').on('click', function() {
80     var form = $('form#compare')[0]
81     $('input[type=submit]', form).prop('disabled',true);
82     $('input[name="uuids[]"]', form).each(function(){
83         if(this.checked) {
84             $('input[type=submit]', form).prop('disabled',false);
85         }
86     });
87 });
88 <% end %>