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