- if @pipeline
  .mr-widget-heading
    - %w[success success_with_warnings skipped canceled failed running pending].each do |status|
      .ci_widget{ class: "ci-#{status} ci-status-icon-#{status}", style: ("display:none" unless @pipeline.status == status) }
        = ci_icon_for_status(status)
        %span
          Pipeline
          = link_to "##{@pipeline.id}", namespace_project_pipeline_path(@pipeline.project.namespace, @pipeline.project, @pipeline.id), class: 'pipeline'
          = ci_label_for_status(status)
        for
        = succeed "." do
          = link_to @pipeline.short_sha, namespace_project_commit_path(@merge_request.source_project.namespace, @merge_request.source_project, @pipeline.sha), class: "monospace"
        %span.ci-coverage

- elsif @merge_request.has_ci?
  - # Compatibility with old CI integrations (ex jenkins) when you request status from CI server via AJAX
  - # TODO, remove in later versions when services like Jenkins will set CI status via Commit status API
  .mr-widget-heading
    - %w[success skipped canceled failed running pending].each do |status|
      .ci_widget{class: "ci-#{status}", style: "display:none"}
        = ci_icon_for_status(status)
        %span
          CI build
          = ci_label_for_status(status)
        for
        - commit = @merge_request.diff_head_commit
        = succeed "." do
          = link_to commit.short_id, namespace_project_commit_path(@merge_request.source_project.namespace, @merge_request.source_project, commit), class: "monospace"
        %span.ci-coverage

    .ci_widget
      = icon("spinner spin")
      Checking CI status for #{@merge_request.diff_head_commit.short_id}&hellip;

    .ci_widget.ci-not_found{style: "display:none"}
      = icon("times-circle")
      Could not find CI status for #{@merge_request.diff_head_commit.short_id}.

    .ci_widget.ci-error{style: "display:none"}
      = icon("times-circle")
      Could not connect to the CI server. Please check your settings and try again.

.js-success-icon.hidden
  = ci_icon_for_status('success')
