Commit ba2d1fde authored by Kamil Trzcinski's avatar Kamil Trzcinski

Add `pipeline.url` to API [ci skip]

parent 8012abf4
...@@ -3,6 +3,12 @@ class PipelineEntity < Grape::Entity ...@@ -3,6 +3,12 @@ class PipelineEntity < Grape::Entity
expose :id expose :id
expose :user, if: -> (pipeline, opts) { created?(pipeline, opts) }, using: UserEntity expose :user, if: -> (pipeline, opts) { created?(pipeline, opts) }, using: UserEntity
expose :url do |pipeline|
namespace_project_pipeline_path(
pipeline.project.namespace,
pipeline.project,
pipeline)
end
expose :details, if: -> (pipeline, opts) { updated?(pipeline, opts) } do expose :details, if: -> (pipeline, opts) { updated?(pipeline, opts) } do
expose :status expose :status
...@@ -29,7 +35,7 @@ class PipelineEntity < Grape::Entity ...@@ -29,7 +35,7 @@ class PipelineEntity < Grape::Entity
pipeline.ref pipeline.ref
end end
expose :ref_url do |pipeline| expose :url do |pipeline|
namespace_project_tree_url( namespace_project_tree_url(
pipeline.project.namespace, pipeline.project.namespace,
pipeline.project, pipeline.project,
...@@ -39,24 +45,7 @@ class PipelineEntity < Grape::Entity ...@@ -39,24 +45,7 @@ class PipelineEntity < Grape::Entity
expose :tag? expose :tag?
end end
expose :commit, if: -> (pipeline, opts) { created?(pipeline, opts) } do expose :commit, if: -> (pipeline, opts) { created?(pipeline, opts) }, using: CommitEntity
expose :short_sha
expose :sha_url do |pipeline|
namespace_project_commit_path(
pipeline.project.namespace,
pipeline.project,
pipeline.sha)
end
expose :title do |pipeline|
pipeline.commit.try(:title)
end
expose :author, using: UserEntity do |pipeline|
pipeline.commit.try(:author)
end
end
expose :retry_url, if: -> (pipeline, opts) { updated?(pipeline, opts) } do |pipeline| expose :retry_url, if: -> (pipeline, opts) { updated?(pipeline, opts) } do |pipeline|
can?(current_user, :update_pipeline, pipeline.project) && can?(current_user, :update_pipeline, pipeline.project) &&
......
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