summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorValery Sizov <valery@gitlab.com>2015-06-08 08:21:39 +0000
committerValery Sizov <valery@gitlab.com>2015-06-08 08:21:39 +0000
commit36dbe836bdf65563ee04dd4a819f8ccef5c9b831 (patch)
tree86fa61d614686b71ea25f900cb34c1736758e827
parent324f8ea6aa1778fcd1bfc65f47e63d0df5ce08ed (diff)
parent281a36a0144f0385d8453d047a5b55aa9cc6f1ad (diff)
downloadgitlab-ci-36dbe836bdf65563ee04dd4a819f8ccef5c9b831.tar.gz
Merge branch 'active_runners' into 'master'
Show number of runners actively checking in on runners page https://dev.gitlab.org/gitlab/gitlab-ci/issues/241 ![joxi_screenshot_1433751389715](https://gitlab.com/gitlab-org/gitlab-ci/uploads/6f08e9e35a5c63396486d46792b703dc/joxi_screenshot_1433751389715.png) See merge request !127
-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 aeab8f8..24c9614 100644
--- a/CHANGELOG
+++ b/CHANGELOG
@@ -8,6 +8,7 @@ v7.12.0
- Link to the runner from the build page for admin user
- Ability to set secret variables for runner
- Dont retry build when push same commit in same ref twice
+ - 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