closes #9319
[arvados.git] / apps / workbench / app / models / proxy_work_unit.rb
index 7cf0a1b455ed7977642b582051eb774007f68f8f..53b49085660e3d0a5b4c55dc63626f2818aa4fe3 100644 (file)
@@ -23,21 +23,31 @@ class ProxyWorkUnit < WorkUnit
     get(:modified_by_user_uuid)
   end
 
+  def owner_uuid
+    get(:owner_uuid)
+  end
+
   def created_at
     t = get(:created_at)
-    t = Time.parse(t) if (t.andand.class == String)
+    t = Time.parse(t) if (t.is_a? String)
     t
   end
 
   def started_at
     t = get(:started_at)
-    t = Time.parse(t) if (t.andand.class == String)
+    t = Time.parse(t) if (t.is_a? String)
+    t
+  end
+
+  def modified_at
+    t = get(:modified_at)
+    t = Time.parse(t) if (t.is_a? String)
     t
   end
 
   def finished_at
     t = get(:finished_at)
-    t = Time.parse(t) if (t.andand.class == String)
+    t = Time.parse(t) if (t.is_a? String)
     t
   end
 
@@ -45,13 +55,15 @@ class ProxyWorkUnit < WorkUnit
     state = get(:state)
     if ["Running", "RunningOnServer", "RunningOnClient"].include? state
       "Running"
+    elsif state == 'New'
+      "Not started"
     else
       state
     end
   end
 
   def state_bootstrap_class
-    state = get(:state)
+    state = state_label
     case state
     when 'Complete'
       'success'
@@ -65,7 +77,7 @@ class ProxyWorkUnit < WorkUnit
   end
 
   def success?
-    state = get(:state)
+    state = state_label
     if state == 'Complete'
       true
     elsif state == 'Failed' or state == 'Cancelled'
@@ -123,7 +135,7 @@ class ProxyWorkUnit < WorkUnit
   end
 
   def progress
-    state = get(:state)
+    state = state_label
     if state == 'Complete'
       return 1.0
     elsif state == 'Failed' or state == 'Cancelled'
@@ -149,6 +161,10 @@ class ProxyWorkUnit < WorkUnit
     []
   end
 
+  def outputs
+    []
+  end
+
   def title
     "process"
   end
@@ -314,11 +330,11 @@ class ProxyWorkUnit < WorkUnit
 
   protected
 
-  def get key
-    if @proxied.respond_to? key
-      @proxied.send(key)
-    elsif @proxied.is_a?(Hash)
-      @proxied[key]
+  def get key, obj=@proxied
+    if obj.respond_to? key
+      obj.send(key)
+    elsif obj.is_a?(Hash)
+      obj[key]
     end
   end
 end