4465: add API/Workbench Github links to help modal
[arvados.git] / apps / workbench / app / helpers / jobs_helper.rb
index 44c7bf621cff2affa9184a49e1d43072e5f6fac1..06c3d0d4206a554fd84539fb9275054ce55166e6 100644 (file)
@@ -1,2 +1,22 @@
 module JobsHelper
+  def stderr_log_history(job_uuids)
+    results = []
+
+    log_history = Log.where(event_type: 'stderr',
+                            object_uuid: job_uuids).order('id DESC')
+    if !log_history.results.empty?
+      reversed_results = log_history.results.reverse
+      reversed_results.each do |entry|
+        if entry.andand.properties
+          properties = entry.properties
+          text = properties[:text]
+          if text
+            results = results.concat text.split("\n")
+          end
+        end
+      end
+    end
+    return results
+  end
+
 end