10079: add "parent" to work_unit to aid the child display
[arvados.git] / apps / workbench / app / models / job_work_unit.rb
index 256003795adcd9c9d1e1775593af853bfb67dd82..a3f13f388c9bff38d8f5450633b1e41d1fad338a 100644 (file)
@@ -1,6 +1,6 @@
 class JobWorkUnit < ProxyWorkUnit
   def children
-    return self.my_children if self.my_children
+    return @my_children if @my_children
 
     # Jobs components
     items = []
@@ -20,7 +20,35 @@ class JobWorkUnit < ProxyWorkUnit
       end
     end
 
-    self.my_children = items
+    @my_children = items
+  end
+
+  def child_summary
+    if children.any?
+      super
+    else
+      get(:tasks_summary)
+    end
+  end
+
+  def parameters
+    get(:script_parameters)
+  end
+
+  def repository
+    get(:repository)
+  end
+
+  def script
+    get(:script)
+  end
+
+  def script_version
+    get(:script_version)
+  end
+
+  def supplied_script_version
+    get(:supplied_script_version)
   end
 
   def docker_image
@@ -31,6 +59,10 @@ class JobWorkUnit < ProxyWorkUnit
     get(:nondeterministic)
   end
 
+  def runtime_constraints
+    get(:runtime_constraints)
+  end
+
   def priority
     get(:priority)
   end
@@ -39,20 +71,14 @@ class JobWorkUnit < ProxyWorkUnit
     get(:log)
   end
 
-  def output
-    get(:output)
-  end
-
-  def child_summary
-    if children.any?
-      super
-    else
-      get(:tasks_summary)
-    end
+  def outputs
+    items = []
+    items << get(:output) if get(:output)
+    items
   end
 
   def can_cancel?
-    true
+    state_label.in? ["Queued", "Running"]
   end
 
   def uri