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 7f1052ebcd6d279a0d6afec10ce78af3a4fd5902..964295619af4bf3b738b565ff401007fb203a72b 100644 (file)
@@ -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