Welcome to mirror list, hosted at ThFree Co, Russian Federation.

gitlab.com/gitlab-org/gitlab-foss.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorKamil Trzcinski <ayufan@ayufan.eu>2015-10-12 22:12:31 +0300
committerKamil Trzcinski <ayufan@ayufan.eu>2015-10-14 18:29:18 +0300
commit7af4f5215e28927830cbc74d383cdfeb9e4ef587 (patch)
tree1a318a590e96153ebb1a843538dd70279e098c2a /app/helpers/runners_helper.rb
parent2d0fcb4de23ab368e2e030b3cf7f6b1705ef676f (diff)
Show warning if build doesn't have runners with specified tags or runners didn't connect recently
Slightly refactor runner status detection: moving it to Runner class Signed-off-by: Kamil Trzcinski <ayufan@ayufan.eu>
Diffstat (limited to 'app/helpers/runners_helper.rb')
-rw-r--r--app/helpers/runners_helper.rb26
1 files changed, 11 insertions, 15 deletions
diff --git a/app/helpers/runners_helper.rb b/app/helpers/runners_helper.rb
index 5d7d06c8490..f79fef03ae8 100644
--- a/app/helpers/runners_helper.rb
+++ b/app/helpers/runners_helper.rb
@@ -1,20 +1,16 @@
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
+ status = runner.status
+ case status
+ when :not_connected
+ content_tag :i, nil,
+ class: "fa fa-warning-sign",
+ title: "New runner. Has not connected yet"
- 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"
+ 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
end