Commit 551f8c4b authored by Kamil Trzciński's avatar Kamil Trzciński

Add proper stage.json data

parent e0b7541b
......@@ -104,9 +104,9 @@ class Projects::PipelinesController < Projects::ApplicationController
@stage = pipeline.legacy_stage(params[:stage])
return not_found unless @stage
respond_to do |format|
format.json { render json: { html: view_to_html_string('projects/pipelines/_stage') } }
end
render json: StageSerializer
.new(project: @project, current_user: @current_user)
.represent(@pipeline)
end
def retry
......
class StageDetailsEntity < Grape::Entity
include RequestAwareEntity
expose :name
expose :title do |stage|
"#{stage.name}: #{detailed_status.label}"
end
expose :statuses, with: JobEntity
expose :detailed_status, as: :status, with: StatusEntity
private
alias_method :stage, :object
def detailed_status
stage.detailed_status(request.current_user)
end
end
class StageSerializer < BaseSerializer
include WithPagination
InvalidResourceError = Class.new(StandardError)
entity StageDetailsEntity
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