summaryrefslogtreecommitdiff
path: root/app/views/projects/ci/pipelines/_pipeline.html.haml
blob: 9ecdb6269b94c27c334e5981b0d64da1b7214df1 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
- status = pipeline.status
- show_commit = local_assigns.fetch(:show_commit, true)
- show_branch = local_assigns.fetch(:show_branch, true)

%tr.commit
  %td.commit-link
    = render 'ci/status/badge', status: pipeline.detailed_status(current_user)

  %td
    = link_to namespace_project_pipeline_path(pipeline.project.namespace, pipeline.project, pipeline.id) do
      %span.pipeline-id ##{pipeline.id}
    %span by
    - if pipeline.user
      = user_avatar(user: pipeline.user, size: 20)
    - else
      %span.api.monospace API
    - if pipeline.latest?
      %span.label.label-success.has-tooltip{ title: 'Latest build for this branch' } latest
    - if pipeline.triggered?
      %span.label.label-primary triggered
    - if pipeline.yaml_errors.present?
      %span.label.label-danger.has-tooltip{ title: "#{pipeline.yaml_errors}" } yaml invalid
    - if pipeline.builds.any?(&:stuck?)
      %span.label.label-warning stuck

  %td.branch-commit
    - if pipeline.ref && show_branch
      .icon-container
        = pipeline.tag? ? icon('tag') : icon('code-fork')
      = link_to pipeline.ref, namespace_project_commits_path(pipeline.project.namespace, pipeline.project, pipeline.ref), class: "monospace branch-name"
    - if show_commit
      .icon-container.commit-icon
        = custom_icon("icon_commit")
      = link_to pipeline.short_sha, namespace_project_commit_path(pipeline.project.namespace, pipeline.project, pipeline.sha), class: "commit-id monospace"

    %p.commit-title
      - if commit = pipeline.commit
        = author_avatar(commit, size: 20)
        = link_to_gfm truncate(commit.title, length: 60, escape: false), namespace_project_commit_path(pipeline.project.namespace, pipeline.project, commit.id), class: "commit-row-message"
      - else
        Cant find HEAD commit for this branch

  %td.stage-cell
    - pipeline.stages.each do |stage|
      - if stage.status
        - detailed_status = stage.detailed_status(current_user)
        - details_path = detailed_status.details_path if detailed_status.has_details?
        - klass = "has-tooltip ci-status-icon ci-status-icon-#{detailed_status}"
        - hasMultipleBuilds = stage.statuses.count > 1
        - tooltip = "#{stage.name.titleize}: #{stage.status || 'not found'}"

        .stage-container.mini-pipeline-graph
          - if hasMultipleBuilds
            .dropdown.inline.build-content
              %button.has-tooltip.builds-dropdown{ type: 'button', data: { toggle: 'dropdown', title: tooltip} }
                %span{ class: klass }
                  = ci_icon_for_status(detailed_status.icon)
                %span= icon('caret-down', class: 'dropdown-caret')
              .dropdown-menu.grouped-pipeline-dropdown
                .arrow-up
                  %ul
                    - stage.statuses.each do |status|
                      %li.dropdown-build
                        = render 'ci/status/graph_badge', subject: status
          - else
            - if details_path
              = link_to details_path, class: klass, title: tooltip do
                = custom_icon(detailed_status.icon)

  %td
    - if pipeline.duration
      %p.duration
        = custom_icon("icon_timer")
        = duration_in_numbers(pipeline.duration)
    - if pipeline.finished_at
      %p.finished-at
        = icon("calendar")
        #{time_ago_with_tooltip(pipeline.finished_at, short_format: false)}

  %td.pipeline-actions.hidden-xs
    .controls.pull-right
      - artifacts = pipeline.builds.latest.with_artifacts_not_expired
      - actions = pipeline.manual_actions
      - if artifacts.present? || actions.any?
        .btn-group.inline
          - if actions.any?
            .btn-group
              %a.dropdown-toggle.btn.btn-default{type: 'button', 'data-toggle' => 'dropdown'}
                = custom_icon('icon_play')
                = icon('caret-down')
              %ul.dropdown-menu.dropdown-menu-align-right
                - actions.each do |build|
                  %li
                    = link_to play_namespace_project_build_path(pipeline.project.namespace, pipeline.project, build), method: :post, rel: 'nofollow' do
                      = custom_icon('icon_play')
                      %span= build.name.humanize
          - if artifacts.present?
            .btn-group
              %a.dropdown-toggle.btn.btn-default.build-artifacts{type: 'button', 'data-toggle' => 'dropdown'}
                = icon("download")
                = icon('caret-down')
              %ul.dropdown-menu.dropdown-menu-align-right
                - artifacts.each do |build|
                  %li
                    = link_to download_namespace_project_build_artifacts_path(pipeline.project.namespace, pipeline.project, build), rel: 'nofollow' do
                      = icon("download")
                      %span Download '#{build.name}' artifacts

      - if can?(current_user, :update_pipeline, pipeline.project)
        .cancel-retry-btns.inline
          - if pipeline.retryable?
            = link_to retry_namespace_project_pipeline_path(pipeline.project.namespace, pipeline.project, pipeline.id), class: 'btn has-tooltip', title: "Retry", method: :post do
              = icon("repeat")
          - if pipeline.cancelable?
            = link_to cancel_namespace_project_pipeline_path(pipeline.project.namespace, pipeline.project, pipeline.id), class: 'btn btn-remove has-tooltip', title: "Cancel", method: :post do
              = icon("remove")