BigW Consortium Gitlab

retryable.rb 784 Bytes
Newer Older
1 2 3
module Gitlab
  module Ci
    module Status
4
      module Build
5
        class Retryable < SimpleDelegator
6
          include Status::Extended
7

8 9
          def has_action?
            can?(user, :update_build, subject)
10 11 12
          end

          def action_icon
13
            'icon_action_retry'
14 15 16 17
          end

          def action_title
            'Retry'
18 19 20
          end

          def action_path
21 22 23
            retry_namespace_project_build_path(subject.project.namespace,
                                               subject.project,
                                               subject)
24 25 26 27 28 29
          end

          def action_method
            :post
          end

30
          def self.matches?(build, user)
31 32 33 34 35 36 37
            build.retryable?
          end
        end
      end
    end
  end
end