diff options
author | Douwe Maan <douwe@gitlab.com> | 2018-07-23 10:50:27 +0300 |
---|---|---|
committer | Douwe Maan <douwe@gitlab.com> | 2018-07-23 10:50:27 +0300 |
commit | 480b5345682c6935314f1958e79c1edd1a19c2f3 (patch) | |
tree | 5ad85eb7effd256a3fa43b4e3cdc184bd0bd9124 /lib/api | |
parent | 8bc7845fbf424b9f451247459dcb3a8bbe953242 (diff) | |
parent | 0f02ce3563716659e0facb15e4c682970634d922 (diff) |
Merge branch 'rs-web_url-for-pipelines-and-jobs' into 'master'
Expose web_url attribute in PipelineBasic and JobBasic
See merge request gitlab-org/gitlab-ce!20703
Diffstat (limited to 'lib/api')
-rw-r--r-- | lib/api/entities.rb | 8 | ||||
-rw-r--r-- | lib/api/jobs.rb | 2 |
2 files changed, 9 insertions, 1 deletions
diff --git a/lib/api/entities.rb b/lib/api/entities.rb index 3f3a95ea8e6..8c40d66c651 100644 --- a/lib/api/entities.rb +++ b/lib/api/entities.rb @@ -529,6 +529,10 @@ module API class PipelineBasic < Grape::Entity expose :id, :sha, :ref, :status + + expose :web_url do |pipeline, _options| + Gitlab::Routing.url_helpers.project_pipeline_url(pipeline.project, pipeline) + end end class MergeRequestSimple < ProjectEntity @@ -1069,6 +1073,10 @@ module API expose :user, with: User expose :commit, with: Commit expose :pipeline, with: PipelineBasic + + expose :web_url do |job, _options| + Gitlab::Routing.url_helpers.project_job_url(job.project, job) + end end class Job < JobBasic diff --git a/lib/api/jobs.rb b/lib/api/jobs.rb index e95b0dd5267..10c6e565f09 100644 --- a/lib/api/jobs.rb +++ b/lib/api/jobs.rb @@ -54,7 +54,7 @@ module API pipeline = user_project.pipelines.find(params[:pipeline_id]) builds = pipeline.builds builds = filter_builds(builds, params[:scope]) - builds = builds.preload(:job_artifacts_archive) + builds = builds.preload(:job_artifacts_archive, project: [:namespace]) present paginate(builds), with: Entities::Job end |