BigW Consortium Gitlab

runners_helper.rb 792 Bytes
Newer Older
1 2
module RunnersHelper
  def runner_status_icon(runner)
3 4 5 6
    status = runner.status
    case status
    when :not_connected
      content_tag :i, nil,
Kamil Trzcinski committed
7
                  class: "fa fa-warning",
8
                  title: "New runner. Has not connected yet"
9

10 11 12 13 14
    when :online, :offline, :paused
      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
15
  end
Kamil Trzcinski committed
16 17

  def runner_link(runner)
18
    display_name = truncate(runner.display_name, length: 15)
Kamil Trzcinski committed
19 20 21
    id = "\##{runner.id}"

    if current_user && current_user.admin
22
      link_to admin_runner_path(runner) do
Kamil Trzcinski committed
23 24 25 26 27 28
        display_name + id
      end
    else
      display_name + id
    end
  end
29
end