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

runners_helper.rb « helpers « app - gitlab.com/gitlab-org/gitlab-foss.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
blob: c13db93ae9c3c0941db8a0db569f7386c5157349 (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
module RunnersHelper
  def runner_status_icon(runner)
    unless runner.contacted_at
      return content_tag :i, nil,
        class: "fa fa-warning-sign",
        title: "New runner. Has not connected yet"
    end

    status =
      if runner.active?
        runner.contacted_at > 3.hour.ago ? :online : :offline
      else
        :paused
      end

    content_tag :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

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

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