Commit 083e185c authored by Kamil Trzcinski's avatar Kamil Trzcinski

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)
```
parent e1e677a6
......@@ -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)
......
- detailed_status = @stage.detailed_status(current_user)
- klass = "has-tooltip ci-status-icon ci-status-icon-#{detailed_status}"
- hasMultipleBuilds = @stage.statuses.count > 1
- icon_status = "#{detailed_status.icon}_borderless"
- icon_status_klass = "ci-status-icon ci-status-icon-#{detailed_status}"
- tooltip = "#{@stage.name}: #{detailed_status.label || 'not found'}"
.dropdown.inline.build-content
%button.has-tooltip.builds-dropdown{ type: 'button', data: { toggle: 'dropdown', title: tooltip} }
%span{ class: klass }
%span.mini-pipeline-graph-icon-container
%span{ class: icon_status_klass }= custom_icon(icon_status)
= icon('caret-down', class: 'dropdown-caret')
......@@ -127,6 +127,7 @@ constraints(ProjectUrlConstrainer.new) do
end
member do
get :stage
post :cancel
post :retry
get :builds
......
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