summaryrefslogtreecommitdiff
path: root/app/finders
diff options
context:
space:
mode:
authorAlexis Reigel <alexis.reigel.ext@siemens.com>2018-06-11 16:25:53 +0200
committerAlexis Reigel <alexis.reigel.ext@siemens.com>2018-09-24 16:04:10 +0200
commita1094e2316936ed455766feb7e3e3cdafcd29b53 (patch)
tree949febcfe8ece9d14ce892d000e4b47659c7dfa9 /app/finders
parentdc1e0f6bd835536702948dd84cd2addf9f293ab9 (diff)
downloadgitlab-ce-a1094e2316936ed455766feb7e3e3cdafcd29b53.tar.gz
add type filter to admin runners page
Diffstat (limited to 'app/finders')
-rw-r--r--app/finders/admin/runners_finder.rb18
1 files changed, 14 insertions, 4 deletions
diff --git a/app/finders/admin/runners_finder.rb b/app/finders/admin/runners_finder.rb
index 3c2d7ee7d76..fbb1cfc5c66 100644
--- a/app/finders/admin/runners_finder.rb
+++ b/app/finders/admin/runners_finder.rb
@@ -10,6 +10,7 @@ class Admin::RunnersFinder < UnionFinder
def execute
search!
filter_by_status!
+ filter_by_runner_type!
sort!
paginate!
@@ -36,10 +37,11 @@ class Admin::RunnersFinder < UnionFinder
end
def filter_by_status!
- status = @params[:status_status]
- if status.present? && Ci::Runner::AVAILABLE_STATUSES.include?(status)
- @runners = @runners.public_send(status) # rubocop:disable GitlabSecurity/PublicSend
- end
+ filter_by!(:status_status, Ci::Runner::AVAILABLE_STATUSES)
+ end
+
+ def filter_by_runner_type!
+ filter_by!(:type_type, Ci::Runner::AVAILABLE_TYPES)
end
def sort!
@@ -49,4 +51,12 @@ class Admin::RunnersFinder < UnionFinder
def paginate!
@runners = @runners.page(@params[:page]).per(NUMBER_OF_RUNNERS_PER_PAGE)
end
+
+ def filter_by!(scope_name, available_scopes)
+ scope = @params[scope_name]
+
+ if scope.present? && available_scopes.include?(scope)
+ @runners = @runners.public_send(scope) # rubocop:disable GitlabSecurity/PublicSend
+ end
+ end
end