Merge branch '9180-avoid-overreplication-keepclient'
[arvados.git] / apps / workbench / app / views / work_unit / _show_component.html.erb
1 <%# Work unit status %>
2
3 <div class="container-fluid>
4   <div class="row-fluid">
5     <%# Need additional handling for main object display  %>
6     <% if @object.uuid == wu.uuid %>
7     <div class="container-fluid">
8       <div class="pull-right">
9         <div class="container-fluid">
10           <div class="row-fulid pipeline-instance-spacing">
11             <div class="col-md-7">
12             <% if wu.is_running? and wu.child_summary_str %>
13                 <%= wu.child_summary_str %>
14             <% end %>
15             </div>
16             <div class="col-md-3">
17               <%= render partial: 'work_unit/progress', locals: {wu: wu} %>
18             </div>
19             <div class="col-md-1">
20               <% if wu.can_cancel? and @object.editable? %>
21                   <%= form_tag "#{wu.uri}/cancel", remote: true, style: "display:inline; padding-left: 1em" do |f| %>
22                     <%= hidden_field_tag :return_to, url_for(@object) %>
23                     <%= button_tag "Cancel", {class: 'btn btn-xs btn-danger', id: "cancel-obj-button"} %>
24                   <% end %>
25               <% end %>
26             </div>
27           </div>
28         </div>
29       </div>
30     </div>
31     <% end %>
32
33     <div class="col-md-10" >
34       <% if wu.is_paused? %>
35         <p>
36           This <%= wu.title %> is paused. Children that are already running
37           will continue to run, but no new processes will be submitted.
38         </p>
39       <% end %>
40
41       <%= raw(wu.show_runtime) %>
42     </div>
43   </div>
44
45 <p>
46   <%= render(partial: 'work_unit/component_detail', locals: {current_obj: wu}) %>
47 </p>
48
49 <%# Work unit children %>
50
51 <%
52   uuids = wu.children.collect {|c| c.uuid}.compact
53   if uuids.any?
54     resource_class = resource_class_for_uuid(uuids.first, friendly_name: true)
55     preload_objects_for_dataclass resource_class, uuids
56   end
57
58   collections = wu.children.collect {|j| j.outputs}.compact
59   collections = collections.flatten.uniq
60   collections.concat wu.children.collect {|j| j.docker_image}.uniq.compact
61   collections_pdhs = collections.select {|x| !(m = CollectionsHelper.match(x)).nil?}.uniq.compact
62   collections_uuids = collections - collections_pdhs
63   preload_collections_for_objects collections_uuids if collections_uuids.any?
64   preload_for_pdhs collections_pdhs if collections_pdhs.any?
65 %>
66
67 <% if wu.has_unreadable_children %>
68   <%= render(partial: "pipeline_instances/show_components_json",
69              locals: {error_name: "Unreadable components", backtrace: nil, wu: wu}) %>
70 <% else %>
71   <% @descendent_count = 0 if !@descendent_count %>
72   <% wu.children.each do |c| %>
73     <% @descendent_count += 1 %>
74     <%= render(partial: 'work_unit/show_child', locals: {current_obj: c, i: @descendent_count, expanded: false}) %>
75   <% end %>
76 <% end %>