2961: Save user information as part of the session cookie, eliminates looking
[arvados.git] / apps / workbench / app / controllers / jobs_controller.rb
1 class JobsController < ApplicationController
2
3   def generate_provenance(jobs)
4     return if params['tab_pane'] != "Provenance"
5
6     nodes = []
7     collections = []
8     jobs.each do |j|
9       nodes << j
10       collections << j[:output]
11       collections.concat(ProvenanceHelper::find_collections(j[:script_parameters]))
12       nodes << {:uuid => j[:script_version]}
13     end
14
15     Collection.where(uuid: collections).each do |c|
16       nodes << c
17     end
18
19     @svg = ProvenanceHelper::create_provenance_graph nodes, "provenance_svg", {
20       :request => request,
21       :all_script_parameters => true,
22       :script_version_nodes => true}
23   end
24
25   def index
26     @svg = ""
27     if params[:uuid]
28       @objects = Job.where(uuid: params[:uuid])
29       generate_provenance(@objects)
30     else
31       @limit = 20
32     end
33     super
34   end
35
36   def show
37     generate_provenance([@object])
38     super
39   end
40
41   def index_pane_list
42     if params[:uuid]
43       %w(Recent Provenance)
44     else
45       %w(Recent)
46     end
47   end
48
49   def show_pane_list
50     %w(Attributes Provenance Metadata JSON API)
51   end
52 end