core.rb 1.3 KB
Newer Older
1 2 3
module Gitlab
  module Ci
    module Status
4 5
      # Base abstract class fore core status
      #
6
      class Core
7 8
        include Gitlab::Routing.url_helpers

9 10 11 12 13 14 15 16 17 18 19 20
        def initialize(subject)
          @subject = subject
        end

        def icon
          raise NotImplementedError
        end

        def label
          raise NotImplementedError
        end

21 22 23 24
        def title
          "#{@subject.class.name.demodulize}: #{label}"
        end

25 26 27 28 29 30 31 32
        # Deprecation warning: this method is here because we need to maintain
        # backwards compatibility with legacy statuses. We often do something
        # like "ci-status ci-status-#{status}" to set CSS class.
        #
        # `to_s` method should be renamed to `group` at some point, after
        # phasing legacy satuses out.
        #
        def to_s
33
          self.class.name.demodulize.downcase.underscore
34 35
        end

36
        def has_details?
Kamil Trzcinski's avatar
Kamil Trzcinski committed
37
          false
38 39 40 41 42 43
        end

        def details_path
          raise NotImplementedError
        end

Kamil Trzcinski's avatar
Kamil Trzcinski committed
44 45
        def has_action?(_user = nil)
          false
46 47 48 49 50 51 52 53 54
        end

        def action_icon
          raise NotImplementedError
        end

        def action_path
          raise NotImplementedError
        end
Kamil Trzcinski's avatar
Kamil Trzcinski committed
55 56 57 58

        def action_method
          raise NotImplementedError
        end
59 60 61 62
      end
    end
  end
end