Class: Ci::RunnersFinder

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

Constant Summary collapse

NUMBER_OF_RUNNERS_PER_PAGE =
30

Instance Method Summary collapse

Methods included from Gitlab::Allowable

#can?

Methods inherited from UnionFinder

#find_union

Constructor Details

#initialize(current_user:, group: nil, params:) ⇒ RunnersFinder

Returns a new instance of RunnersFinder.


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

def initialize(current_user:, group: nil, params:)
  @params = params
  @group = group
  @current_user = current_user
end

Instance Method Details

#executeObject


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

def execute
  search!
  filter_by_status!
  filter_by_runner_type!
  filter_by_tag_list!
  sort!
  paginate!

  @runners.with_tags

rescue Gitlab::Access::AccessDeniedError
  Ci::Runner.none
end

#sort_keyObject


29
30
31
32
33
34
35
# File 'app/finders/ci/runners_finder.rb', line 29

def sort_key
  if @params[:sort] == 'contacted_asc'
    'contacted_asc'
  else
    'created_date'
  end
end