14260: Fix tests.
[arvados.git] / apps / workbench / app / models / container_work_unit.rb
index 7f1052ebcd6d279a0d6afec10ce78af3a4fd5902..ef20a7f8f49cfd7ed72f7ff9c51774ca36ddaa74 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 secret_mounts)
+      cols = ContainerRequest.columns.map(&:name) - %w(id updated_at mounts secret_mounts runtime_token)
       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