Welcome to mirror list, hosted at ThFree Co, Russian Federation.

gitlab.com/gitlab-org/gitlab-foss.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorTomasz Maczukin <tomasz@maczukin.pl>2017-11-28 00:59:01 +0300
committerTomasz Maczukin <tomasz@maczukin.pl>2017-11-28 02:36:50 +0300
commit13a902a9a42c0909ad8c6790c040447a9e12211f (patch)
tree6eb605aae6e13b77905e1df87b2d32842dffc07d /lib/api/runners.rb
parent9d27ce1630004e37cd0615830857a3135dc8d5fe (diff)
Refactorize jobs finding logic
Diffstat (limited to 'lib/api/runners.rb')
-rw-r--r--lib/api/runners.rb8
1 files changed, 2 insertions, 6 deletions
diff --git a/lib/api/runners.rb b/lib/api/runners.rb
index 3ea7340d9be..996457c5dfe 100644
--- a/lib/api/runners.rb
+++ b/lib/api/runners.rb
@@ -90,18 +90,14 @@ module API
end
params do
requires :id, type: Integer, desc: 'The ID of the runner'
- optional :status, type: String, desc: 'Status of job'
+ optional :status, type: String, desc: 'Status of the job', values: Ci::Build::AVAILABLE_STATUSES
use :pagination
end
get ':id/jobs' do
runner = get_runner(params[:id])
authenticate_list_runners_jobs!(runner)
- jobs = runner.builds
- if params[:status]
- not_found!('Status') unless Ci::Build::AVAILABLE_STATUSES.include?(params[:status])
- jobs = jobs.where(status: params[:status].to_sym)
- end
+ jobs = RunnerJobsFinder.new(runner, params).execute
present paginate(jobs), with: Entities::JobBasicWithProject
end