481d276e3090339a9c5906a430593168a30e244a
[arvados.git] / apps / workbench / app / views / pipeline_instances / _recent.html.erb
1 <%= form_tag do |f| %>
2
3 <table class="table table-hover">
4   <thead>
5     <tr class="contain-align-left">
6       <th>
7       </th><th>
8         status
9       </th><th>
10         id
11       </th><th>
12         name
13       </th><th>
14         template
15       </th><th>
16         owner
17       </th><th>
18         components
19       </th><th>
20         dependencies
21       </th><th>
22         created
23       </th><th>
24       </th>
25     </tr>
26   </thead>
27   <tbody>
28
29     <% @objects.sort_by { |ob| ob.created_at }.reverse.each do |ob| %>
30
31     <tr data-object-uuid="<%= ob.uuid %>">
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><td>
62         <% if ob.editable? %>
63         <%= 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 %>
64         <i class="icon-trash"></i>
65         <% end %>
66         <% end %>
67       </td>
68     </tr>
69
70     <% end %>
71
72   </tbody>
73 </table>
74
75 <% end %>
76
77 <% content_for :footer_js do %>
78 var showhide_compare = function() {
79     var form = $('form#compare')[0];
80     $('input[type=hidden][name="uuids[]"]', form).remove();
81     $('input[type=submit]', form).prop('disabled',true);
82     $('input[name="uuids[]"]').each(function(){
83         if(this.checked) {
84             $('input[type=submit]', form).prop('disabled',false).show();
85             $(form).append($('<input type="hidden" name="uuids[]"/>').val(this.value));
86         }
87     });
88 };
89 $('form input[name="uuids[]"]').on('click', showhide_compare);
90 showhide_compare();
91 <% end %>