Commit 7b643c02 authored by Tomasz Maczukin's avatar Tomasz Maczukin

Modify output

parent b7ed102e
...@@ -832,18 +832,21 @@ module API ...@@ -832,18 +832,21 @@ module API
expose :id, :sha, :ref, :status expose :id, :sha, :ref, :status
end end
class Job < Grape::Entity class JobBasic < Grape::Entity
expose :id, :status, :stage, :name, :ref, :tag, :coverage expose :id, :status, :stage, :name, :ref, :tag, :coverage
expose :created_at, :started_at, :finished_at expose :created_at, :started_at, :finished_at
expose :duration expose :duration
expose :user, with: User expose :user, with: User
expose :artifacts_file, using: JobArtifactFile, if: -> (job, opts) { job.artifacts? }
expose :commit, with: Commit expose :commit, with: Commit
expose :runner, with: Runner
expose :pipeline, with: PipelineBasic expose :pipeline, with: PipelineBasic
end end
class JobWithProject < Job class Job < JobBasic
expose :artifacts_file, using: JobArtifactFile, if: -> (job, opts) { job.artifacts? }
expose :runner, with: Runner
end
class JobBasicWithProject < JobBasic
expose :project, with: ProjectIdentity expose :project, with: ProjectIdentity
end end
......
...@@ -86,7 +86,7 @@ module API ...@@ -86,7 +86,7 @@ module API
end end
desc 'List jobs running on a runner' do desc 'List jobs running on a runner' do
success Entities::JobWithProject success Entities::JobBasicWithProject
end end
params do params do
requires :id, type: Integer, desc: 'The ID of the runner' requires :id, type: Integer, desc: 'The ID of the runner'
...@@ -103,7 +103,7 @@ module API ...@@ -103,7 +103,7 @@ module API
jobs = jobs.where(status: params[:status].to_sym) jobs = jobs.where(status: params[:status].to_sym)
end end
present paginate(jobs), with: Entities::JobWithProject present paginate(jobs), with: Entities::JobBasicWithProject
end end
end end
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment