summaryrefslogtreecommitdiff
path: root/app/helpers/runners_helper.rb
diff options
context:
space:
mode:
authorDmitriy Zaporozhets <dmitriy.zaporozhets@gmail.com>2015-09-29 16:26:40 +0200
committerDmitriy Zaporozhets <dmitriy.zaporozhets@gmail.com>2015-09-29 16:26:40 +0200
commit3d9a7cdb4be6d6d059dfd7ccc8fa2e4bd3ab12e3 (patch)
treefbc4fb4a8ae361436e92c794c01ebab2c83c4e18 /app/helpers/runners_helper.rb
parent87240e989ba913bad787d8bc81da1a9b87f1da53 (diff)
downloadgitlab-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.rb20
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