summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorRémy Coutable <remy@rymai.me>2017-10-11 10:04:04 +0000
committerRémy Coutable <remy@rymai.me>2017-10-11 10:04:04 +0000
commit22ade6e7cb2fedd7ad88f897fb501fce9f427bbd (patch)
tree1730bae9955049ef31602d973a545c9dec893de1
parent1faa97b298d31a982c5dfa7049a04569b67cf3f2 (diff)
parent6aff498426519a806e905902fba2e50e7efef83b (diff)
downloadgitlab-ce-22ade6e7cb2fedd7ad88f897fb501fce9f427bbd.tar.gz
Merge branch '38720-sort-admin-runners' into 'master'
Add sort runners on admin runners Closes #38720 See merge request gitlab-org/gitlab-ce!14661
-rw-r--r--app/controllers/admin/runners_controller.rb3
-rw-r--r--app/views/admin/runners/index.html.haml2
-rw-r--r--changelogs/unreleased/38720-sort-admin-runners.yml5
3 files changed, 8 insertions, 2 deletions
diff --git a/app/controllers/admin/runners_controller.rb b/app/controllers/admin/runners_controller.rb
index 719893c0bc8..38b808cdc31 100644
--- a/app/controllers/admin/runners_controller.rb
+++ b/app/controllers/admin/runners_controller.rb
@@ -2,7 +2,8 @@ class Admin::RunnersController < Admin::ApplicationController
before_action :runner, except: :index
def index
- @runners = Ci::Runner.order('id DESC')
+ sort = params[:sort] == 'contacted_asc' ? { contacted_at: :asc } : { id: :desc }
+ @runners = Ci::Runner.order(sort)
@runners = @runners.search(params[:search]) if params[:search].present?
@runners = @runners.page(params[:page]).per(30)
@active_runners_cnt = Ci::Runner.online.count
diff --git a/app/views/admin/runners/index.html.haml b/app/views/admin/runners/index.html.haml
index 43cea1358cc..76f4a817744 100644
--- a/app/views/admin/runners/index.html.haml
+++ b/app/views/admin/runners/index.html.haml
@@ -63,7 +63,7 @@
%th Projects
%th Jobs
%th Tags
- %th Last contact
+ %th= link_to 'Last contact', admin_runners_path(params.slice(:search).merge(sort: 'contacted_asc'))
%th
- @runners.each do |runner|
diff --git a/changelogs/unreleased/38720-sort-admin-runners.yml b/changelogs/unreleased/38720-sort-admin-runners.yml
new file mode 100644
index 00000000000..b1047644891
--- /dev/null
+++ b/changelogs/unreleased/38720-sort-admin-runners.yml
@@ -0,0 +1,5 @@
+---
+title: Add sort runners on admin runners
+merge_request: 14661
+author: Takuya Noguchi
+type: added