Merge branch '8650-container-work-unit' into 9318-dashboard-uses-work-units
[arvados.git] / apps / workbench / app / views / work_unit / _show_component.html.erb
index 9789934a68764f20f1e6bf4667742f8f39e8352e..58b8aa861b61e502464a197ee22a55afdf165785 100644 (file)
@@ -8,22 +8,22 @@
       <div class="pull-right">
         <div class="container-fluid">
           <div class="row-fulid pipeline-instance-spacing">
+            <div class="col-md-8">
             <% if wu.is_running? and wu.child_summary_str %>
-              <div class="col-md-8">
                 <%= wu.child_summary_str %>
-              </div>
             <% end %>
+            </div>
             <div class="col-md-3">
               <%= render partial: 'work_unit/progress', locals: {wu: wu} %>
             </div>
-            <% if wu.can_be_canceled? and @object.editable? %>
-                <div class="col-md-1">
+            <div class="col-md-1">
+              <% if wu.can_cancel? and @object.editable? %>
                   <%= form_tag "#{wu.uri}/cancel", remote: true, style: "display:inline; padding-left: 1em" do |f| %>
                     <%= hidden_field_tag :return_to, url_for(@object) %>
                     <%= button_tag "Cancel", {class: 'btn btn-xs btn-danger', id: "cancel-obj-button"} %>
                   <% end %>
-                </div>
-            <% end %>
+              <% end %>
+            </div>
           </div>
         </div>
       </div>
         </p>
       <% end %>
 
-      <% runningtime = determine_wallclock_runtime(wu.children) %>
-      <% walltime = 0 %>
-      <% if wu.started_at %>
-        <% walltime = if wu.finished_at then (wu.finished_at - wu.started_at) else (Time.now - wu.started_at) end %>
-      <% end %>
-
-      <p>
-        <% active_for_str = wu.started_and_active_for_str %>
-        <% if active_for_str %>
-          <%= active_for_str[0] %>
-          <%= render_localized_date(wu.started_at) %>.
-          <%= active_for_str[1] %>
-          <%= if walltime > runningtime
-                render_runtime(walltime, false)
-              else
-                render_runtime(runningtime, false)
-              end %><% if wu.finished_at %> at <%= render_localized_date(wu.finished_at) %><% end %>.
-        <% else %>
-          <% if wu.state_label %> This <%= wu.title %> is <%= if wu.state_label == 'Running' then 'active' else wu.state_label.downcase end %>. <% end %>
-        <% end %>
-
-        <% if wu.is_failed? %>
-          Check the Log tab for more detail about why it failed.
-        <% end %>
-      </p>
-
-      <% ran_for_str = wu.ran_for_str %>
-      <% if ran_for_str %>
-        <p>
-            <%= ran_for_str %>
-            <%
-                cputime = wu.children.map { |c|
-                if c.started_at
-                  (c.runtime_constraints.andand[:min_nodes] || 1) * ((c.finished_at || Time.now()) - c.started_at)
-                else
-                  0
-                end
-               }.reduce(:+) || 0 %>
-            <%= render_runtime(runningtime, false) %><% if (walltime - runningtime) > 0 %>
-              (<%= render_runtime(walltime - runningtime, false) %> queued)<% end %><% if cputime == 0 %>.<% else %>
-              and used
-            <%= render_runtime(cputime, false) %>
-            of node allocation time (<%= (cputime/runningtime).round(1) %>&Cross; scaling).
-            <% end %>
-        </p>
-      <% end %>
+      <%= raw(wu.show_runtime) %>
     </div>
   </div>