diff options
author | Tomasz Maczukin <tomasz@maczukin.pl> | 2017-11-27 22:59:01 +0100 |
---|---|---|
committer | Tomasz Maczukin <tomasz@maczukin.pl> | 2017-11-28 00:36:50 +0100 |
commit | 13a902a9a42c0909ad8c6790c040447a9e12211f (patch) | |
tree | 6eb605aae6e13b77905e1df87b2d32842dffc07d /lib/api | |
parent | 9d27ce1630004e37cd0615830857a3135dc8d5fe (diff) | |
download | gitlab-ce-13a902a9a42c0909ad8c6790c040447a9e12211f.tar.gz |
Refactorize jobs finding logic
Diffstat (limited to 'lib/api')
-rw-r--r-- | lib/api/runners.rb | 8 |
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 |