BigW Consortium Gitlab

cancelable.rb 621 Bytes
Newer Older
1 2 3
module Gitlab
  module Ci
    module Status
4
      module Build
5
        class Cancelable < Status::Extended
6 7
          def has_action?
            can?(user, :update_build, subject)
8 9 10
          end

          def action_icon
11
            'icon_action_cancel'
12 13 14
          end

          def action_path
15
            cancel_project_job_path(subject.project, subject)
16 17 18 19 20 21
          end

          def action_method
            :post
          end

22 23 24 25
          def action_title
            'Cancel'
          end

26
          def self.matches?(build, user)
27 28 29 30 31 32 33
            build.cancelable?
          end
        end
      end
    end
  end
end