diff options
author | Dmitriy Zaporozhets <dmitriy.zaporozhets@gmail.com> | 2015-09-29 16:26:40 +0200 |
---|---|---|
committer | Dmitriy Zaporozhets <dmitriy.zaporozhets@gmail.com> | 2015-09-29 16:26:40 +0200 |
commit | 3d9a7cdb4be6d6d059dfd7ccc8fa2e4bd3ab12e3 (patch) | |
tree | fbc4fb4a8ae361436e92c794c01ebab2c83c4e18 /app/helpers/runners_helper.rb | |
parent | 87240e989ba913bad787d8bc81da1a9b87f1da53 (diff) | |
download | gitlab-ce-3d9a7cdb4be6d6d059dfd7ccc8fa2e4bd3ab12e3.tar.gz |
Refactor CI helpers
Signed-off-by: Dmitriy Zaporozhets <dmitriy.zaporozhets@gmail.com>
Diffstat (limited to 'app/helpers/runners_helper.rb')
-rw-r--r-- | app/helpers/runners_helper.rb | 20 |
1 files changed, 20 insertions, 0 deletions
diff --git a/app/helpers/runners_helper.rb b/app/helpers/runners_helper.rb new file mode 100644 index 00000000000..5d7d06c8490 --- /dev/null +++ b/app/helpers/runners_helper.rb @@ -0,0 +1,20 @@ +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 +end |