Merge branch 'master' into 2257-inequality-conditions
[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 <%= form_tag do |f| %>
9
10 <table class="table table-condensed table-fixedlayout">
11   <colgroup>
12     <col width="5%" />
13     <col width="15%" />
14     <col width="25%" />
15     <col width="20%" />
16     <col width="15%" />
17     <col width="20%" />
18   </colgroup>
19   <thead>
20     <tr class="contain-align-left">
21       <th>
22       </th><th>
23         Status
24       </th><th>
25         Instance
26       </th><th>
27         Template
28       </th><th>
29         Owner
30       </th><th>
31         Age
32       </th>
33     </tr>
34   </thead>
35   <tbody>
36
37     <% @objects.sort_by { |ob| ob.created_at }.reverse.each do |ob| %>
38
39     <tr data-object-uuid="<%= ob.uuid %>">
40       <td>
41         <%= check_box_tag 'uuids[]', ob.uuid, false, :class => 'persistent-selection' %>
42       </td><td>
43         <%= render partial: 'pipeline_status_label', locals: {:p => ob} %>
44       </td><td colspan="1">
45         <%= link_to_if_arvados_object ob, friendly_name: true %>
46       </td><td>
47         <%= link_to_if_arvados_object ob.pipeline_template_uuid, friendly_name: true %>
48       </td><td>
49         <%= link_to_if_arvados_object ob.owner_uuid, friendly_name: true %>
50       </td><td>
51         <%= distance_of_time_in_words(ob.created_at, Time.now) %>
52       </td>
53     </tr>
54     <tr>
55       <td style="border-top: 0;" colspan="2">
56       </td>
57       <td style="border-top: 0; opacity: 0.5;" colspan="5">
58         <% ob.components.each do |cname, c| %>
59           <% if c[:job] %>
60             <%= render partial: "job_status_label", locals: {:j => c[:job], :title => cname.to_s } %>
61           <% else %>
62             <span class="label label-default"><%= cname.to_s %></span>            
63           <% end %>
64         <% end %>
65       </td>
66     </tr>
67     <% end %>
68
69   </tbody>
70 </table>
71
72 <% end %>
73
74 <% content_for :footer_js do %>
75 var showhide_compare = function() {
76     var form = $('form#compare')[0];
77     $('input[type=hidden][name="uuids[]"]', form).remove();
78     $('input[type=submit]', form).prop('disabled',true).show();
79     var checked_inputs = $('input[name="uuids[]"]:checked');
80     if (checked_inputs.length >= 2 && checked_inputs.length <= 3) {
81         checked_inputs.each(function(){
82             if(this.checked) {
83                 $('input[type=submit]', form).prop('disabled',false).show();
84                 $(form).append($('<input type="hidden" name="uuids[]"/>').val(this.value));
85             }
86         });
87     }
88 };
89 $('form input[name="uuids[]"]').on('click', showhide_compare);
90 showhide_compare();
91 <% end %>