Merge branch '9857-cwl-acceptlist-re' refs #9857
[arvados.git] / apps / workbench / app / models / proxy_work_unit.rb
index 91673371fe4a3e87f3ebb4c24ba74697c81978a5..11ec0ee196326d6a5c7d06cf0f0455a11fc9b167 100644 (file)
@@ -23,6 +23,10 @@ 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.is_a? String)
@@ -51,6 +55,8 @@ class ProxyWorkUnit < WorkUnit
     state = get(:state)
     if ["Running", "RunningOnServer", "RunningOnClient"].include? state
       "Running"
+    elsif state == 'New'
+      "Not started"
     else
       state
     end
@@ -322,9 +328,17 @@ class ProxyWorkUnit < WorkUnit
     resp
   end
 
-  def uri
-    uuid = get(:uuid)
-    "/#{@proxied.class.table_name}/#{uuid}"
+  def log_object_uuids
+    [uuid]
+  end
+
+  def live_log_lines(limit)
+    Log.where(object_uuid: log_object_uuids).
+      order("created_at DESC").
+      limit(limit).
+      select { |log| log.properties[:text].is_a? String }.
+      reverse.
+      flat_map { |log| log.properties[:text].split("\n") }
   end
 
   protected