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