13773: Show 'Warning' label on jobs that have this runtime status and aren't failing.
[arvados.git] / apps / workbench / app / models / container_work_unit.rb
index dbc81c52a376940231094dbf4415e5625016814f..964295619af4bf3b738b565ff401007fb203a72b 100644 (file)
@@ -23,7 +23,7 @@ class ContainerWorkUnit < ProxyWorkUnit
     items = []
     container_uuid = if @proxied.is_a?(Container) then uuid else get(:container_uuid) end
     if container_uuid
-      cols = ContainerRequest.columns.map(&:name) - %w(id updated_at mounts)
+      cols = ContainerRequest.columns.map(&:name) - %w(id updated_at mounts secret_mounts)
       my_children = @child_proxies || ContainerRequest.select(cols).where(requesting_container_uuid: container_uuid).results if !my_children
       my_child_containers = my_children.map(&:container_uuid).compact.uniq
       grandchildren = {}
@@ -117,12 +117,35 @@ class ContainerWorkUnit < ProxyWorkUnit
       else
         'Failed'
       end
+    when 'Running'
+      if runtime_status[:error]
+        'Failing'
+      elsif runtime_status[:warning]
+        'Warning'
+      else
+        state
+      end
     else
-      # Cancelled, Running, or Uncommitted (no container assigned)
+      # Cancelled, or Uncommitted (no container assigned)
       state
     end
   end
 
+  def runtime_status
+    return get(:runtime_status, @container) || get(:runtime_status, @proxied)
+  end
+
+  def state_bootstrap_class
+    case state_label
+    when 'Failing'
+      'danger'
+    when 'Warning'
+      'warning'
+    else
+      super
+    end
+  end
+
   def exit_code
     get_combined(:exit_code)
   end