Welcome to mirror list, hosted at ThFree Co, Russian Federation.

waiting_for_resource.rb « processable « status « ci « gitlab « lib - gitlab.com/gitlab-org/gitlab-foss.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
blob: ac82c99b5f1d3e6fad31761c339e7f484f3492b7 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
# frozen_string_literal: true

module Gitlab
  module Ci
    module Status
      module Processable
        class WaitingForResource < Status::Extended
          ##
          # TODO: image is shared with 'pending'
          # until we get a dedicated one
          #
          def illustration
            {
              image: 'illustrations/pending_job_empty.svg',
              size: 'svg-430',
              title: _('This job is waiting for resource: ') + subject.resource_group.key
            }
          end

          def has_action?
            current_processable.present?
          end

          def action_icon
            nil
          end

          def action_title
            nil
          end

          def action_button_title
            _('View job currently using resource')
          end

          def action_path
            project_job_path(subject.project, current_processable)
          end

          def action_method
            :get
          end

          def self.matches?(processable, _)
            processable.waiting_for_resource?
          end

          private

          def current_processable
            @current_processable ||= subject.resource_group.current_processable
          end
        end
      end
    end
  end
end