Commit dbf7607a authored by Miguel Rincon's avatar Miguel Rincon Committed by Matthias Kaeppler

Remove usage of legacy stages

This change removes legacy stages in the pipeline details view.
parent 549ea1d9
...@@ -97,7 +97,7 @@ class Projects::PipelinesController < Projects::ApplicationController ...@@ -97,7 +97,7 @@ class Projects::PipelinesController < Projects::ApplicationController
Gitlab::QueryLimiting.disable!('https://gitlab.com/gitlab-org/gitlab/-/issues/26657') Gitlab::QueryLimiting.disable!('https://gitlab.com/gitlab-org/gitlab/-/issues/26657')
respond_to do |format| respond_to do |format|
format.html format.html { render_show }
format.json do format.json do
Gitlab::PollingInterval.set_header(response, interval: POLLING_INTERVAL) Gitlab::PollingInterval.set_header(response, interval: POLLING_INTERVAL)
...@@ -187,10 +187,7 @@ class Projects::PipelinesController < Projects::ApplicationController ...@@ -187,10 +187,7 @@ class Projects::PipelinesController < Projects::ApplicationController
def test_report def test_report
respond_to do |format| respond_to do |format|
format.html do format.html { render_show }
render 'show'
end
format.json do format.json do
render json: TestReportSerializer render json: TestReportSerializer
.new(current_user: @current_user) .new(current_user: @current_user)
...@@ -219,6 +216,8 @@ class Projects::PipelinesController < Projects::ApplicationController ...@@ -219,6 +216,8 @@ class Projects::PipelinesController < Projects::ApplicationController
end end
def render_show def render_show
@stages = @pipeline.stages.with_latest_and_retried_statuses
respond_to do |format| respond_to do |format|
format.html do format.html do
render 'show' render 'show'
......
...@@ -14,6 +14,7 @@ module Ci ...@@ -14,6 +14,7 @@ module Ci
has_many :statuses, class_name: 'CommitStatus', foreign_key: :stage_id has_many :statuses, class_name: 'CommitStatus', foreign_key: :stage_id
has_many :latest_statuses, -> { ordered.latest }, class_name: 'CommitStatus', foreign_key: :stage_id has_many :latest_statuses, -> { ordered.latest }, class_name: 'CommitStatus', foreign_key: :stage_id
has_many :retried_statuses, -> { ordered.retried }, class_name: 'CommitStatus', foreign_key: :stage_id
has_many :processables, class_name: 'Ci::Processable', foreign_key: :stage_id has_many :processables, class_name: 'Ci::Processable', foreign_key: :stage_id
has_many :builds, foreign_key: :stage_id has_many :builds, foreign_key: :stage_id
has_many :bridges, foreign_key: :stage_id has_many :bridges, foreign_key: :stage_id
...@@ -21,6 +22,12 @@ module Ci ...@@ -21,6 +22,12 @@ module Ci
scope :ordered, -> { order(position: :asc) } scope :ordered, -> { order(position: :asc) }
scope :in_pipelines, ->(pipelines) { where(pipeline: pipelines) } scope :in_pipelines, ->(pipelines) { where(pipeline: pipelines) }
scope :by_name, ->(names) { where(name: names) } scope :by_name, ->(names) { where(name: names) }
scope :with_latest_and_retried_statuses, -> do
includes(
latest_statuses: [:pipeline, project: :namespace],
retried_statuses: [:pipeline, project: :namespace]
)
end
with_options unless: :importing? do with_options unless: :importing? do
validates :project, presence: true validates :project, presence: true
......
...@@ -28,7 +28,7 @@ ...@@ -28,7 +28,7 @@
#js-pipeline-graph-vue #js-pipeline-graph-vue
#js-tab-builds.tab-pane #js-tab-builds.tab-pane
- if pipeline.legacy_stages.present? - if stages.present?
.table-holder.pipeline-holder .table-holder.pipeline-holder
%table.table.ci-table.pipeline %table.table.ci-table.pipeline
%thead %thead
...@@ -39,7 +39,7 @@ ...@@ -39,7 +39,7 @@
%th %th
%th= _('Coverage') %th= _('Coverage')
%th %th
= render partial: "projects/stage/stage", collection: pipeline.legacy_stages, as: :stage = render partial: "projects/stage/stage", collection: stages, as: :stage
- if @pipeline.failed_builds.present? - if @pipeline.failed_builds.present?
#js-tab-failures.build-failures.tab-pane.build-page #js-tab-failures.build-failures.tab-pane.build-page
......
...@@ -24,6 +24,6 @@ ...@@ -24,6 +24,6 @@
- lint_link_start = '<a href="%{url}">'.html_safe % { url: lint_link_url } - lint_link_start = '<a href="%{url}">'.html_safe % { url: lint_link_url }
= s_('You can also test your %{gitlab_ci_yml} in %{lint_link_start}CI Lint%{lint_link_end}').html_safe % { gitlab_ci_yml: '.gitlab-ci.yml', lint_link_start: lint_link_start, lint_link_end: '</a>'.html_safe } = s_('You can also test your %{gitlab_ci_yml} in %{lint_link_start}CI Lint%{lint_link_end}').html_safe % { gitlab_ci_yml: '.gitlab-ci.yml', lint_link_start: lint_link_start, lint_link_end: '</a>'.html_safe }
= render "projects/pipelines/with_tabs", pipeline: @pipeline, pipeline_has_errors: pipeline_has_errors = render "projects/pipelines/with_tabs", pipeline: @pipeline, stages: @stages, pipeline_has_errors: pipeline_has_errors
.js-pipeline-details-vue{ data: { endpoint: project_pipeline_path(@project, @pipeline, format: :json), metrics_path: namespace_project_ci_prometheus_metrics_histograms_path(namespace_id: @project.namespace, project_id: @project, format: :json), pipeline_project_path: @project.full_path, pipeline_iid: @pipeline.iid, graphql_resource_etag: graphql_etag_pipeline_path(@pipeline) } } .js-pipeline-details-vue{ data: { endpoint: project_pipeline_path(@project, @pipeline, format: :json), metrics_path: namespace_project_ci_prometheus_metrics_histograms_path(namespace_id: @project.namespace, project_id: @project, format: :json), pipeline_project_path: @project.full_path, pipeline_iid: @pipeline.iid, graphql_resource_etag: graphql_etag_pipeline_path(@pipeline) } }
- stage = stage.present(current_user: current_user)
%tr %tr
%th{ colspan: 10 } %th{ colspan: 10 }
%strong %strong
...@@ -8,8 +6,8 @@ ...@@ -8,8 +6,8 @@
= ci_icon_for_status(stage.status) = ci_icon_for_status(stage.status)
&nbsp; &nbsp;
= stage.name.titleize = stage.name.titleize
= render stage.latest_ordered_statuses, stage: false, ref: false, pipeline_link: false, allow_retry: true = render stage.latest_statuses, stage: false, ref: false, pipeline_link: false, allow_retry: true
= render stage.retried_ordered_statuses, stage: false, ref: false, pipeline_link: false, retried: true = render stage.retried_statuses, stage: false, ref: false, pipeline_link: false, retried: true
%tr %tr
%td{ colspan: 10 } %td{ colspan: 10 }
&nbsp; &nbsp;
...@@ -269,6 +269,7 @@ stages: ...@@ -269,6 +269,7 @@ stages:
- builds - builds
- bridges - bridges
- latest_statuses - latest_statuses
- retried_statuses
statuses: statuses:
- project - project
- pipeline - pipeline
......
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