summaryrefslogtreecommitdiff
path: root/app/helpers
diff options
context:
space:
mode:
authorDmitriy Zaporozhets <dmitriy.zaporozhets@gmail.com>2015-04-09 16:58:54 +0300
committerValery Sizov <vsv2711@gmail.com>2015-04-21 19:28:17 +0300
commit26ea08c2b05b2050f16224f6dd729b195c9e5d5e (patch)
treedf49d480ba543b00f789ba35620c074882db86e7 /app/helpers
parentb3e2939aa2904c92aba0399d511cb05228bfc9be (diff)
downloadgitlab-ci-26ea08c2b05b2050f16224f6dd729b195c9e5d5e.tar.gz
Improved runner page for project
* ability to add runner to several projects * render runner status (online, offline, disabled) * two column style of page: specific and shared runners Signed-off-by: Dmitriy Zaporozhets <dmitriy.zaporozhets@gmail.com>
Diffstat (limited to 'app/helpers')
-rw-r--r--app/helpers/runners_helper.rb24
1 files changed, 24 insertions, 0 deletions
diff --git a/app/helpers/runners_helper.rb b/app/helpers/runners_helper.rb
new file mode 100644
index 0000000..487fba0
--- /dev/null
+++ b/app/helpers/runners_helper.rb
@@ -0,0 +1,24 @@
+module RunnersHelper
+ def runner_status_icon(runner)
+ unless runner.contacted_at
+ return content_tag :i, nil,
+ class: "icon-warning-sign",
+ title: "New runner. Has no connect yet"
+ end
+
+ status =
+ if runner.active?
+ if runner.contacted_at > 1.hour.ago
+ :online
+ else
+ :offline
+ end
+ else
+ :paused
+ end
+
+ content_tag :i, nil,
+ class: "icon-circle runner-status-#{status}",
+ title: "Runner is #{status}, last contact was #{time_ago_in_words(runner.contacted_at)} ago"
+ end
+end