11870: minor update
[arvados.git] / apps / workbench / app / controllers / jobs_controller.rb
index 536518277f1ca86da6256af0887a5be9ee7bc560..c39b7c4317d56fdcd7d31f95116e23572bcbec49 100644 (file)
@@ -1,4 +1,8 @@
 class JobsController < ApplicationController
+  skip_around_filter :require_thread_api_token, if: proc { |ctrl|
+    Rails.configuration.anonymous_user_token and
+    'show' == ctrl.action_name
+  }
 
   def generate_provenance(jobs)
     return if params['tab_pane'] != "Provenance"
@@ -26,6 +30,7 @@ class JobsController < ApplicationController
 
     @svg = ProvenanceHelper::create_provenance_graph nodes, "provenance_svg", {
       :request => request,
+      :direction => :top_down,
       :all_script_parameters => true,
       :script_version_nodes => true}
   end
@@ -56,6 +61,15 @@ class JobsController < ApplicationController
     super
   end
 
+  def logs
+    @logs = @object.
+      stderr_log_query(Rails.configuration.running_job_log_records_to_fetch).
+      map { |e| e.serializable_hash.merge({ 'prepend' => true }) }
+    respond_to do |format|
+      format.json { render json: @logs }
+    end
+  end
+
   def index_pane_list
     if params[:uuid]
       %w(Recent Provenance)