summaryrefslogtreecommitdiff
path: root/app/serializers/stage_entity.rb
diff options
context:
space:
mode:
authorGrzegorz Bizon <grzesiek.bizon@gmail.com>2016-12-27 12:48:01 +0100
committerGrzegorz Bizon <grzesiek.bizon@gmail.com>2016-12-27 12:48:01 +0100
commit1b14182f21a60384234e79b3a0f02c81d016192d (patch)
treec244009f20c46b39ed65432b7c39105c3dd9fcde /app/serializers/stage_entity.rb
parentf9331db136f19dfdc6b2affa0922bdcda7c681fc (diff)
downloadgitlab-ce-1b14182f21a60384234e79b3a0f02c81d016192d.tar.gz
Expose stage dropdown path and title in stage entity
Diffstat (limited to 'app/serializers/stage_entity.rb')
-rw-r--r--app/serializers/stage_entity.rb28
1 files changed, 23 insertions, 5 deletions
diff --git a/app/serializers/stage_entity.rb b/app/serializers/stage_entity.rb
index b57202a6267..1aebba3a2d1 100644
--- a/app/serializers/stage_entity.rb
+++ b/app/serializers/stage_entity.rb
@@ -3,17 +3,35 @@ class StageEntity < Grape::Entity
expose :name
- expose :status do |stage, options|
- StatusEntity.represent(
- stage.detailed_status(request.user),
- options)
+ expose :title do |stage|
+ "#{stage.name}: #{detailed_status.label}"
end
+ expose :detailed_status, as: :status,
+ with: StatusEntity
+
expose :path do |stage|
namespace_project_pipeline_path(
stage.pipeline.project.namespace,
stage.pipeline.project,
- stage.pipeline.id,
+ stage.pipeline,
anchor: stage.name)
end
+
+ expose :dropdown_path do |stage|
+ stage_namespace_project_pipeline_path(
+ stage.pipeline.project.namespace,
+ stage.pipeline.project,
+ stage.pipeline,
+ stage: stage.name,
+ format: :json)
+ end
+
+ private
+
+ alias_method :stage, :object
+
+ def detailed_status
+ stage.detailed_status(request.user)
+ end
end