summaryrefslogtreecommitdiff
path: root/app/views/projects/builds/_sidebar.html.haml
blob: 5b0b58e087be7dc0c895a516f446ba07f6750fad (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
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
%aside.right-sidebar.right-sidebar-expanded.build-sidebar.js-build-sidebar
  .block.build-sidebar-header.visible-xs-block.visible-sm-block.append-bottom-default
    Build
    %strong ##{@build.id}
    %a.gutter-toggle.pull-right.js-sidebar-build-toggle{ href: "#" }
      = icon('angle-double-right')
  - if @build.coverage
    .block.block-first
      .title
        Test coverage
      %p.build-detail-row
        #{@build.coverage}%

  - builds = @build.pipeline.builds.latest.to_a
  - statuses = ["failed", "pending", "running", "canceled", "success", "skipped"]
  - if builds.size > 1
    .dropdown.build-dropdown
      .build-light-text Stage
      %button.dropdown-menu-toggle{type: 'button', 'data-toggle' => 'dropdown'}
        %span.stage-selection More
        = icon('caret-down')
      %ul.dropdown-menu
        - builds.map(&:stage).uniq.each do |stage|
          %li
            %a.stage-item= stage

    .builds-container
      - statuses.each do |build_status|
        - builds.select{|build| build.status == build_status}.each do |build|
          .build-job{class: ('active' if build == @build), data: {stage: build.stage}}
            = link_to namespace_project_build_path(@project.namespace, @project, build) do
              = icon('check')
              = ci_icon_for_status(build.status)
              %span
                - if build.name
                  = build.name
                - else
                  = build.id

        - if @build.retried?
          %li.active
            %a
              Build ##{@build.id}
              ·
              %i.fa.fa-warning
              This build was retried.

  .blocks-container
    - if can?(current_user, :read_build, @project) && (@build.artifacts? || @build.artifacts_expired?)
      .block{ class: ("block-first" if !@build.coverage) }
        .title
          Build artifacts
        - if @build.artifacts_expired?
          %p.build-detail-row
            The artifacts were removed
            #{time_ago_with_tooltip(@build.artifacts_expire_at)}
        - elsif @build.artifacts_expire_at
          %p.build-detail-row
            The artifacts will be removed in
            %span.js-artifacts-remove= @build.artifacts_expire_at

        - if @build.artifacts?
          .btn-group.btn-group-justified{ role: :group }
            - if @build.artifacts_expire_at
              = link_to keep_namespace_project_build_artifacts_path(@project.namespace, @project, @build), class: 'btn btn-sm btn-default', method: :post do
                Keep

            = link_to download_namespace_project_build_artifacts_path(@project.namespace, @project, @build), class: 'btn btn-sm btn-default' do
              Download

            - if @build.artifacts_metadata?
              = link_to browse_namespace_project_build_artifacts_path(@project.namespace, @project, @build), class: 'btn btn-sm btn-default' do
                Browse

    .block{ class: ("block-first" if !@build.coverage && !(can?(current_user, :read_build, @project) && (@build.artifacts? || @build.artifacts_expired?))) }
      .title
        Build details
        - if can?(current_user, :update_build, @build) && @build.retryable?
          = link_to "Retry", retry_namespace_project_build_path(@project.namespace, @project, @build), class: 'pull-right', method: :post
      - if @build.merge_request
        %p.build-detail-row
          %span.build-light-text Merge Request:
          = link_to "#{@build.merge_request.to_reference}", merge_request_path(@build.merge_request)
      - if @build.duration
        %p.build-detail-row
          %span.build-light-text Duration:
          = time_interval_in_words(@build.duration)
      - if @build.finished_at
        %p.build-detail-row
          %span.build-light-text Finished:
          #{time_ago_with_tooltip(@build.finished_at)}
      - if @build.erased_at
        %p.build-detail-row
          %span.build-light-text Erased:
          #{time_ago_with_tooltip(@build.erased_at)}
      %p.build-detail-row
        %span.build-light-text Runner:
        - if @build.runner && current_user && current_user.admin
          = link_to "##{@build.runner.id}", admin_runner_path(@build.runner.id)
        - elsif @build.runner
          \##{@build.runner.id}
      .btn-group.btn-group-justified{ role: :group }
        - if @build.has_trace?
          = link_to 'Raw', raw_namespace_project_build_path(@project.namespace, @project, @build), class: 'btn btn-sm btn-default'
        - if @build.active?
          = link_to "Cancel", cancel_namespace_project_build_path(@project.namespace, @project, @build), class: 'btn btn-sm btn-default', method: :post
        - if can?(current_user, :update_build, @project) && @build.erasable?
          = link_to erase_namespace_project_build_path(@project.namespace, @project, @build),
                    class: "btn btn-sm btn-default", method: :post,
                    data: { confirm: "Are you sure you want to erase this build?" } do
            Erase

    - if @build.trigger_request
      .build-widget
        %h4.title
          Trigger

        %p
          %span.build-light-text Token:
          #{@build.trigger_request.trigger.short_token}

        - if @build.trigger_request.variables
          %p
            %span.build-light-text Variables:


          - @build.trigger_request.variables.each do |key, value|
            %code
              #{key}=#{value}

    .block
      .title
        Commit title
      %p.build-light-text.append-bottom-0
        #{@build.pipeline.git_commit_title}

    - if @build.tags.any?
      .block
        .title
          Tags
        - @build.tag_list.each do |tag|
          %span.label.label-primary
            = tag