debian-mirror-gitlab/app/helpers/runners_helper.rb

44 lines
1.3 KiB
Ruby
Raw Normal View History

2018-12-05 23:21:45 +05:30
# frozen_string_literal: true
2015-10-24 18:46:33 +05:30
module RunnersHelper
def runner_status_icon(runner)
status = runner.status
case status
when :not_connected
content_tag :i, nil,
class: "fa fa-warning",
title: "New runner. Has not connected yet"
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
end
def runner_link(runner)
display_name = truncate(runner.display_name, length: 15)
id = "\##{runner.id}"
if current_user && current_user.admin
2015-12-23 02:04:40 +05:30
link_to admin_runner_path(runner) do
2015-10-24 18:46:33 +05:30
display_name + id
end
else
display_name + id
end
end
2019-02-15 15:39:39 +05:30
# 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.
2019-12-04 20:38:33 +05:30
# Please refer to the following issue for more details: https://gitlab.com/gitlab-org/gitlab-foss/issues/55920
2019-02-15 15:39:39 +05:30
def runner_contacted_at(runner)
if params[:sort] == 'contacted_asc'
runner.uncached_contacted_at
else
runner.contacted_at
end
end
2015-10-24 18:46:33 +05:30
end
2019-12-04 20:38:33 +05:30
RunnersHelper.prepend_if_ee('EE::RunnersHelper')