Module: Ci::RunnersHelper

Defined in:
app/helpers/ci/runners_helper.rb

Instance Method Summary collapse

Instance Method Details

#runner_contacted_at(runner) ⇒ Object

Due to inability of performing sorting of runners by cached “contacted_at” values we have to show uncached values if sorting by “contacted_asc” is requested. Please refer to the following issue for more details: gitlab.com/gitlab-org/gitlab-foss/issues/55920


35
36
37
38
39
40
41
# File 'app/helpers/ci/runners_helper.rb', line 35

def runner_contacted_at(runner)
  if params[:sort] == 'contacted_asc'
    runner.uncached_contacted_at
  else
    runner.contacted_at
  end
end

20
21
22
23
24
25
26
27
28
29
30
31
# File 'app/helpers/ci/runners_helper.rb', line 20

def runner_link(runner)
  display_name = truncate(runner.display_name, length: 15)
  id = "\##{runner.id}"

  if current_user && current_user.admin
    link_to admin_runner_path(runner) do
      display_name + id
    end
  else
    display_name + id
  end
end

#runner_status_icon(runner) ⇒ Object


5
6
7
8
9
10
11
12
13
14
15
16
17
18
# File 'app/helpers/ci/runners_helper.rb', line 5

def runner_status_icon(runner)
  status = runner.status
  case status
  when :not_connected
     :i, nil,
                class: "fa fa-warning",
                title: "New runner. Has not connected yet"

  when :online, :offline, :paused
     :i, nil,
                class: "fa fa-circle runner-status-#{status}",
                title: "Runner is #{status}, last contact was #{time_ago_in_words(runner.contacted_at)} ago"
  end
end