Class: Ci::RunnersFinder

Inherits:
UnionFinder show all
Includes:
Gitlab::Allowable
Defined in:
app/finders/ci/runners_finder.rb

Constant Summary collapse

DEFAULT_SORT =
'created_at_desc'

Instance Method Summary collapse

Methods included from Gitlab::Allowable

#can?

Methods inherited from UnionFinder

#find_union

Constructor Details

#initialize(current_user:, params:) ⇒ RunnersFinder

Returns a new instance of RunnersFinder.



9
10
11
12
13
14
# File 'app/finders/ci/runners_finder.rb', line 9

def initialize(current_user:, params:)
  @params = params
  @group = params.delete(:group)
  @project = params.delete(:project)
  @current_user = current_user
end

Instance Method Details

#executeObject



16
17
18
19
20
21
22
23
24
25
26
27
# File 'app/finders/ci/runners_finder.rb', line 16

def execute
  search!
  filter_by_active!
  filter_by_status!
  filter_by_upgrade_status!
  filter_by_runner_type!
  filter_by_tag_list!
  sort!
  request_tag_list!

  @runners
end

#sort_keyObject



29
30
31
# File 'app/finders/ci/runners_finder.rb', line 29

def sort_key
  allowed_sorts.include?(@params[:sort]) ? @params[:sort] : DEFAULT_SORT
end