BigW Consortium Gitlab

stop.rb 703 Bytes
Newer Older
Kamil Trzcinski committed
1 2 3
module Gitlab
  module Ci
    module Status
4
      module Build
5
        class Stop < Status::Extended
Kamil Trzcinski committed
6
          def label
7 8 9
            'manual stop action'
          end

10 11
          def has_action?
            can?(user, :update_build, subject)
Kamil Trzcinski committed
12 13 14
          end

          def action_icon
15
            'icon_action_stop'
16 17 18 19
          end

          def action_title
            'Stop'
Kamil Trzcinski committed
20 21 22
          end

          def action_path
23
            play_project_job_path(subject.project, subject)
Kamil Trzcinski committed
24 25 26 27 28 29
          end

          def action_method
            :post
          end

30
          def self.matches?(build, user)
Kamil Trzcinski committed
31 32 33 34 35 36 37
            build.playable? && build.stops_environment?
          end
        end
      end
    end
  end
end