- admin = local_assigns.fetch(:admin, false)
- ref = local_assigns.fetch(:ref, nil)
- commit_sha = local_assigns.fetch(:commit_sha, nil)
- retried = local_assigns.fetch(:retried, false)
- pipeline_link = local_assigns.fetch(:pipeline_link, false)
- stage = local_assigns.fetch(:stage, false)
- coverage = local_assigns.fetch(:coverage, false)

%tr.generic_commit_status{class: ('retried' if retried)}
  %td.status
    = render 'ci/status/badge', status: generic_commit_status.detailed_status(current_user)

  %td.generic_commit_status-link
    - if can?(current_user, :read_commit_status, generic_commit_status) && generic_commit_status.target_url
      = link_to generic_commit_status.target_url do
        %span.build-link ##{generic_commit_status.id}
    - else
      %span.build-link ##{generic_commit_status.id}

    - if ref
      - if generic_commit_status.ref
        .icon-container
          = generic_commit_status.tags.any? ? icon('tag') : icon('code-fork')
        = link_to generic_commit_status.ref, namespace_project_commits_path(generic_commit_status.project.namespace, generic_commit_status.project, generic_commit_status.ref)
      - else
        .light none
      .icon-container.commit-icon
        = custom_icon("icon_commit")

    - if commit_sha
      = link_to generic_commit_status.short_sha, namespace_project_commit_path(generic_commit_status.project.namespace, generic_commit_status.project, generic_commit_status.sha), class: "commit-id monospace"

    - if retried
      = icon('warning', class: 'text-warning has-tooltip', title: 'Status was retried.')

    .label-container
      - if generic_commit_status.tags.any?
        - generic_commit_status.tags.each do |tag|
          %span.label.label-primary
            = tag
      - if retried
        %span.label.label-warning retried

  - if pipeline_link
    %td
      = link_to pipeline_path(generic_commit_status.pipeline) do
        %span.pipeline-id ##{generic_commit_status.pipeline.id}
      %span by
      - if generic_commit_status.pipeline.user
        = user_avatar(user: generic_commit_status.pipeline.user, size: 20)
      - else
        %span.monospace API

  - if admin
    %td
      - if generic_commit_status.project
        = link_to generic_commit_status.project.name_with_namespace, admin_namespace_project_path(generic_commit_status.project.namespace, generic_commit_status.project)
    %td
      - if generic_commit_status.try(:runner)
        = runner_link(generic_commit_status.runner)
      - else
        .light none

  - if stage
    %td
      = generic_commit_status.stage

  %td
    = generic_commit_status.name

  %td
    - if generic_commit_status.duration
      %p.duration
        = custom_icon("icon_timer")
        = duration_in_numbers(generic_commit_status.duration)

    - if generic_commit_status.finished_at
      %p.finished-at
        = icon("calendar")
        %span #{time_ago_with_tooltip(generic_commit_status.finished_at)}

  %td.coverage
    - if coverage && generic_commit_status.try(:coverage)
      #{generic_commit_status.coverage}%

  %td
    -# empty column to match number of columns in ci/builds/_build.html.haml
