Fix panic in test case (overwriting a locked sync.Mutex with an unlocked one).
[arvados.git] / apps / workbench / app / controllers / work_unit_templates_controller.rb
1 class WorkUnitTemplatesController < ApplicationController
2   def find_objects_for_index
3     return if !params[:partial]
4
5     @limit = 40
6     @filters = @filters || []
7
8     # get next page of pipeline_templates
9     if PipelineTemplate.api_exists?(:index)
10       filters = @filters + [["uuid", "is_a", ["arvados#pipelineTemplate"]]]
11       pipelines = PipelineTemplate.limit(@limit).order(["created_at desc"]).filter(filters)
12     end
13
14     # get next page of workflows
15     filters = @filters + [["uuid", "is_a", ["arvados#workflow"]]]
16     workflows = Workflow.limit(@limit).order(["created_at desc"]).filter(filters)
17
18     @objects = (pipelines.to_a + workflows.to_a).sort_by(&:created_at).reverse.first(@limit)
19
20     if @objects.any?
21       @next_page_filters = next_page_filters('<=')
22       @next_page_href = url_for(partial: :choose_rows,
23                                 filters: @next_page_filters.to_json)
24     else
25       @next_page_href = nil
26     end
27   end
28
29   def next_page_href with_params={}
30     @next_page_href
31   end
32 end