Merge branch '2328-keep-permission-flags' (closes #2328)
[arvados.git] / apps / workbench / app / views / pipeline_instances / _show_recent.html.erb
1 <%= content_for :tab_line_buttons do %>
2 <%= form_tag({action: 'compare', controller: params[:controller], method: 'get'}, {method: 'get', id: 'compare', class: 'pull-right small-form-margin'}) do |f| %>
3   <%= submit_tag 'Compare 2 or 3 selected', {class: 'btn btn-primary', disabled: true, style: 'display: none'} %>
4   &nbsp;
5 <% end rescue nil %>
6 <% end %>
7
8 <%= render partial: "paging", locals: {results: @objects, object: @object} %>
9
10 <%= form_tag do |f| %>
11
12 <table class="table table-condensed table-fixedlayout">
13   <colgroup>
14     <col width="5%" />
15     <col width="15%" />
16     <col width="25%" />
17     <col width="20%" />
18     <col width="15%" />
19     <col width="15%" />
20     <col width="5%" />
21   </colgroup>
22   <thead>
23     <tr class="contain-align-left">
24       <th>
25       </th><th>
26         Status
27       </th><th>
28         Instance
29       </th><th>
30         Template
31       </th><th>
32         Owner
33       </th><th>
34         Age
35       </th><th>
36       </th>
37     </tr>
38   </thead>
39   <tbody>
40
41     <% @objects.sort_by { |ob| ob.created_at }.reverse.each do |ob| %>
42
43     <tr data-object-uuid="<%= ob.uuid %>">
44       <td>
45         <%= check_box_tag 'uuids[]', ob.uuid, false, :class => 'persistent-selection' %>
46       </td><td>
47         <%= render partial: 'pipeline_status_label', locals: {:p => ob} %>
48       </td><td colspan="1">
49         <%= link_to_if_arvados_object ob, friendly_name: true %>
50       </td><td>
51         <%= link_to_if_arvados_object ob.pipeline_template_uuid, friendly_name: true %>
52       </td><td>
53         <%= link_to_if_arvados_object ob.owner_uuid, friendly_name: true %>
54       </td><td>
55         <%= distance_of_time_in_words(ob.created_at, Time.now) %>
56       </td><td>
57         <%= render partial: 'delete_object_button', locals: {object:ob} %>
58       </td>
59     </tr>
60     <tr>
61       <td style="border-top: 0;" colspan="2">
62       </td>
63       <td style="border-top: 0; opacity: 0.5;" colspan="6">
64         <% ob.components.each do |cname, c| %>
65           <% if c[:job] %>
66             <%= render partial: "job_status_label", locals: {:j => c[:job], :title => cname.to_s } %>
67           <% else %>
68             <span class="label label-default"><%= cname.to_s %></span>            
69           <% end %>
70         <% end %>
71       </td>
72     </tr>
73     <% end %>
74
75   </tbody>
76 </table>
77
78 <% end %>
79
80 <%= render partial: "paging", locals: {results: @objects, object: @object} %>
81
82 <% content_for :footer_js do %>
83 var showhide_compare = function() {
84     var form = $('form#compare')[0];
85     $('input[type=hidden][name="uuids[]"]', form).remove();
86     $('input[type=submit]', form).prop('disabled',true).show();
87     var checked_inputs = $('input[name="uuids[]"]:checked');
88     if (checked_inputs.length >= 2 && checked_inputs.length <= 3) {
89         checked_inputs.each(function(){
90             if(this.checked) {
91                 $('input[type=submit]', form).prop('disabled',false).show();
92                 $(form).append($('<input type="hidden" name="uuids[]"/>').val(this.value));
93             }
94         });
95     }
96 };
97 $('form input[name="uuids[]"]').on('click', showhide_compare);
98 showhide_compare();
99 <% end %>