2015-09-29 14:26:40 +00:00
|
|
|
module RunnersHelper
|
|
|
|
def runner_status_icon(runner)
|
2015-10-12 19:12:31 +00:00
|
|
|
status = runner.status
|
|
|
|
case status
|
|
|
|
when :not_connected
|
|
|
|
content_tag :i, nil,
|
2015-10-14 11:51:29 +00:00
|
|
|
class: "fa fa-warning",
|
2015-10-12 19:12:31 +00:00
|
|
|
title: "New runner. Has not connected yet"
|
2015-09-29 14:26:40 +00:00
|
|
|
|
2015-10-12 19:12:31 +00:00
|
|
|
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
|
2015-09-29 14:26:40 +00:00
|
|
|
end
|
2015-10-14 10:15:03 +00:00
|
|
|
|
|
|
|
def runner_link(runner)
|
2015-10-15 15:13:36 +00:00
|
|
|
display_name = truncate(runner.display_name, length: 15)
|
2015-10-14 10:15:03 +00:00
|
|
|
id = "\##{runner.id}"
|
|
|
|
|
|
|
|
if current_user && current_user.admin
|
2015-12-04 11:55:23 +00:00
|
|
|
link_to admin_runner_path(runner) do
|
2015-10-14 10:15:03 +00:00
|
|
|
display_name + id
|
|
|
|
end
|
|
|
|
else
|
|
|
|
display_name + id
|
|
|
|
end
|
|
|
|
end
|
2015-09-29 14:26:40 +00:00
|
|
|
end
|