BigW Consortium Gitlab

play.rb 870 Bytes
Newer Older
Kamil Trzcinski committed
1 2 3
module Gitlab
  module Ci
    module Status
4
      module Build
Kamil Trzcinski committed
5
        class Play < SimpleDelegator
6
          include Status::Extended
Kamil Trzcinski committed
7 8

          def label
9 10 11
            'manual play action'
          end

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

          def action_icon
17
            'icon_action_play'
Kamil Trzcinski committed
18 19
          end

20 21 22 23
          def action_title
            'Play'
          end

Kamil Trzcinski committed
24
          def action_path
25 26 27
            play_namespace_project_build_path(subject.project.namespace,
                                              subject.project,
                                              subject)
Kamil Trzcinski committed
28 29 30 31 32 33
          end

          def action_method
            :post
          end

34
          def self.matches?(build, user)
Kamil Trzcinski committed
35 36 37 38 39 40 41
            build.playable? && !build.stops_environment?
          end
        end
      end
    end
  end
end