summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorValery Sizov <vsv2711@gmail.com>2015-06-08 11:14:13 +0300
committerValery Sizov <vsv2711@gmail.com>2015-06-08 11:14:13 +0300
commit281a36a0144f0385d8453d047a5b55aa9cc6f1ad (patch)
tree040bfd653a12dcb65425bbb47acf12b2e603d637
parent06f586c8e85d100070745e8453bf9dc1b2528451 (diff)
downloadgitlab-ci-281a36a0144f0385d8453d047a5b55aa9cc6f1ad.tar.gz
active runners
-rw-r--r--CHANGELOG1
-rw-r--r--app/controllers/admin/runners_controller.rb1
-rw-r--r--app/views/admin/runners/index.html.haml16
-rw-r--r--spec/features/admin/runners_spec.rb5
4 files changed, 16 insertions, 7 deletions
diff --git a/CHANGELOG b/CHANGELOG
index cfccbc2..7da52dc 100644
--- a/CHANGELOG
+++ b/CHANGELOG
@@ -6,6 +6,7 @@ v7.12.0
- Increase default timeout for builds to 60 minutes
- Using .gitlab-ci.yml file instead of jobs
- Link to the runner from the build page for admin user
+ - Admin area: show amount of runners with last contact less than a minute ago
v7.11.0
- Deploy Jobs API calls
diff --git a/app/controllers/admin/runners_controller.rb b/app/controllers/admin/runners_controller.rb
index 2d530c1..3cb37f5 100644
--- a/app/controllers/admin/runners_controller.rb
+++ b/app/controllers/admin/runners_controller.rb
@@ -5,6 +5,7 @@ class Admin::RunnersController < Admin::ApplicationController
@runners = Runner.order('id DESC')
@runners = @runners.search(params[:search]) if params[:search].present?
@runners = @runners.page(params[:page]).per(30)
+ @active_runners_cnt = Runner.where("contacted_at > ?", 1.minutes.ago).count
end
def show
diff --git a/app/views/admin/runners/index.html.haml b/app/views/admin/runners/index.html.haml
index 966de9c..5935aa2 100644
--- a/app/views/admin/runners/index.html.haml
+++ b/app/views/admin/runners/index.html.haml
@@ -23,11 +23,17 @@
%span.label.label-danger paused
\- runner will not receive any new build
-.append-bottom-20
- = form_tag admin_runners_path, class: 'form-inline', method: :get do
- .form-group
- = search_field_tag :search, params[:search], class: 'form-control', placeholder: 'Runner description or token'
- = submit_tag 'Search', class: 'btn'
+.append-bottom-20.clearfix
+ .pull-left
+ = form_tag admin_runners_path, class: 'form-inline', method: :get do
+ .form-group
+ = search_field_tag :search, params[:search], class: 'form-control', placeholder: 'Runner description or token'
+ = submit_tag 'Search', class: 'btn'
+
+ .pull-right.light
+ Runners with last contact less than a minute ago: #{@active_runners_cnt}
+
+%br
%table.table
%thead
diff --git a/spec/features/admin/runners_spec.rb b/spec/features/admin/runners_spec.rb
index a966aee..2827a7f 100644
--- a/spec/features/admin/runners_spec.rb
+++ b/spec/features/admin/runners_spec.rb
@@ -6,7 +6,7 @@ describe "Admin Runners" do
login_as :user
end
- describe "GET /admin/runners" do
+ describe "Runners page" do
before do
runner = FactoryGirl.create(:runner)
commit = FactoryGirl.create(:commit)
@@ -16,6 +16,7 @@ describe "Admin Runners" do
it { page.has_text? "Manage Runners" }
it { page.has_text? "To register a new runner" }
+ it { page.has_text? "Runners with last contact less than a minute ago: 1" }
describe 'search' do
before do
@@ -31,7 +32,7 @@ describe "Admin Runners" do
end
end
- describe "GET /admin/runners/:id" do
+ describe "Runner show page" do
let(:runner) { FactoryGirl.create :runner }
before do