8876: work unit views
[arvados.git] / apps / workbench / app / views / work_unit / _show_child.html.erb
index dc88a216dbe4e0f639475d792a1e94608641d5fd..7478d222f2a1de3e61a3100f291ec987bc3bc84a 100644 (file)
@@ -13,7 +13,7 @@
 
         <%# column offset 2 %>
         <div class="col-md-2 pipeline-instance-spacing">
-          <%= current_obj.progress %>
+          <span class="label label-<%= current_obj.state_bootstrap_class %>"><%= current_obj.progress%></span>
         </div>
 
         <%# column offset 4 %>
               Queued for <%= render_runtime(queuetime, false) %>.
             </div>
           <% elsif current_obj.state_label == "Running" %>
-            <%# column offset 8 %>
-            <div class="col-md-3">
-              <span class="task-summary-status">
-                <%= current_obj.tasks_summary[:done] %>&nbsp;<%= "task".pluralize(current_obj.tasks_summary[:done]) %> done,
-                <%= current_obj.tasks_summary[:failed] %>&nbsp;failed,
-                <%= current_obj.tasks_summary[:running] %>&nbsp;running,
-                <%= current_obj.tasks_summary[:todo] %>&nbsp;pending
-              </span>
-            </div>
+            <% if current_obj.child_summary %>
+              <%# column offset 8 %>
+              <div class="col-md-3">
+                <span class="task-summary-status">
+                  <%= current_obj.child_summary[:done] %>&nbsp;<%= "task".pluralize(current_obj.child_summary[:done]) %> done,
+                  <%= current_obj.child_summary[:failed] %>&nbsp;failed,
+                  <%= current_obj.child_summary[:running] %>&nbsp;running,
+                  <%= current_obj.child_summary[:todo] %>&nbsp;pending
+                </span>
+              </div>
+            <% end %>
           <% elsif current_obj.state_label.in? ["Complete", "Failed", "Cancelled"] %>
             <%# column offset 8 %>
             <div class="col-md-4 text-overflow-ellipsis">
             </div>
           <% end %>
 
-          <% if current_obj.state_label.in? ["Queued", "Running"] and @object.editable? %>
+          <% if current_obj.state_label.in? ["Queued", "Running"] and @object.work_unit(@object.name).can_cancel? and @object.editable? %>
             <%# column offset 11 %>
             <div class="col-md-1 pipeline-instance-spacing">
-              <%= form_tag "/jobs/#{current_obj.uuid}/cancel", remote: true, style: "display:inline; padding-left: 1em" do |f| %>
+              <%= form_tag "#{current_obj.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-job-button"} %>
               <% end %>