Merge branch '10346-rearrange-api-docs' closes #10346
[arvados.git] / apps / workbench / app / models / container_work_unit.rb
index 2580105f9f81e7e59696a197961666c0950afb1f..88aab306cedc8b9ea5a8a94a27cc394f2022780b 100644 (file)
@@ -1,7 +1,7 @@
 class ContainerWorkUnit < ProxyWorkUnit
   attr_accessor :container
 
-  def initialize proxied, label
+  def initialize proxied, label, parent
     super
     if @proxied.is_a?(ContainerRequest)
       container_uuid = get(:container_uuid)
@@ -12,7 +12,7 @@ class ContainerWorkUnit < ProxyWorkUnit
   end
 
   def children
-    return self.my_children if self.my_children
+    return @my_children if @my_children
 
     container_uuid = nil
     container_uuid = if @proxied.is_a?(Container) then uuid else get(:container_uuid) end
@@ -25,7 +25,7 @@ class ContainerWorkUnit < ProxyWorkUnit
       end
     end
 
-    self.my_children = items
+    @my_children = items
   end
 
   def title
@@ -81,7 +81,9 @@ class ContainerWorkUnit < ProxyWorkUnit
   def state_label
     ec = exit_code
     return "Failed" if (ec && ec != 0)
-    get_combined(:state)
+    state = get_combined(:state)
+    return "Ready" if ((priority == 0) and (["Queued", "Locked"].include?(state)))
+    state
   end
 
   def exit_code
@@ -131,7 +133,7 @@ class ContainerWorkUnit < ProxyWorkUnit
   end
 
   def log_object_uuids
-    [get_combined(:uuid), get(:uuid)].uniq
+    [get(:uuid, @container), get(:uuid, @proxied)].compact
   end
 
   def render_log