12840: Differentiate "Cancelled" from "Failed" pipeline instances.
[arvados.git] / apps / workbench / app / models / pipeline_instance_work_unit.rb
index 517dbc7a352a78502117c85662cc1e7318739eb8..de706896562c6f6f27c30eedd8432a32537c2f8b 100644 (file)
@@ -59,4 +59,19 @@ class PipelineInstanceWorkUnit < ProxyWorkUnit
   def template_uuid
     get(:pipeline_template_uuid)
   end
+
+  def state_label
+    # Show "Cancelled" instead of "Failed" if there are no failed
+    # components. #12840
+    if get(:state) != "Failed"
+      return super
+    end
+    get(:components).each do |_, c|
+      jstate = c[:job][:state] rescue nil
+      if jstate == "Failed"
+        return "Failed"
+      end
+    end
+    "Cancelled"
+  end
 end