summaryrefslogtreecommitdiff
path: root/app/controllers/projects
diff options
context:
space:
mode:
authorKamil Trzcinski <ayufan@ayufan.eu>2016-12-19 13:20:17 +0100
committerKamil Trzcinski <ayufan@ayufan.eu>2016-12-19 13:20:17 +0100
commit083e185cdaee03e66dec0ab267a2f3b5d3dab9a7 (patch)
tree274d5b4a918d5bc9b3bbecebf28d3e59c1ddd497 /app/controllers/projects
parente1e677a653a1c6658ad7f3c9f4fbae7f120c8a8f (diff)
downloadgitlab-ce-083e185cdaee03e66dec0ab267a2f3b5d3dab9a7.tar.gz
Render stage dropdown in separate API call as HTML
``` Endpoint: /group/project/pipelines/id/stage.json?stage=name Call: stage_namespace_project_pipeline_path(pipeline.project.namespace, pipeline.project, pipeline, stage: stage.name) ```
Diffstat (limited to 'app/controllers/projects')
-rw-r--r--app/controllers/projects/pipelines_controller.rb12
1 files changed, 12 insertions, 0 deletions
diff --git a/app/controllers/projects/pipelines_controller.rb b/app/controllers/projects/pipelines_controller.rb
index 85188cfdd4c..0147072b0f1 100644
--- a/app/controllers/projects/pipelines_controller.rb
+++ b/app/controllers/projects/pipelines_controller.rb
@@ -8,6 +8,7 @@ class Projects::PipelinesController < Projects::ApplicationController
def index
@scope = params[:scope]
@pipelines = PipelinesFinder.new(project).execute(scope: @scope).page(params[:page]).per(30)
+ @pipelines = @pipelines.includes(project: :namespace)
@running_or_pending_count = PipelinesFinder.new(project).execute(scope: 'running').count
@pipelines_count = PipelinesFinder.new(project).execute.count
@@ -40,6 +41,17 @@ class Projects::PipelinesController < Projects::ApplicationController
end
end
+ def stage
+ @stage = pipeline.stages.find do |stage|
+ stage.name == params[:stage]
+ end
+ return not_found unless @stage
+
+ respond_to do |format|
+ format.json { render json: { html: view_to_html_string('projects/pipelines/_stage') } }
+ end
+ end
+
def retry
pipeline.retry_failed(current_user)