Skip to content
Snippets Groups Projects
Commit 551f8c4b authored by Kamil Trzcińśki's avatar Kamil Trzcińśki
Browse files

Add proper stage.json data

parent e0b7541b
No related branches found
No related tags found
No related merge requests found
Loading
Loading
@@ -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
Loading
Loading
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
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment