diff options
author | Rémy Coutable <remy@rymai.me> | 2017-10-11 13:04:04 +0300 |
---|---|---|
committer | Rémy Coutable <remy@rymai.me> | 2017-10-11 13:04:04 +0300 |
commit | 22ade6e7cb2fedd7ad88f897fb501fce9f427bbd (patch) | |
tree | 1730bae9955049ef31602d973a545c9dec893de1 /app | |
parent | 1faa97b298d31a982c5dfa7049a04569b67cf3f2 (diff) | |
parent | 6aff498426519a806e905902fba2e50e7efef83b (diff) |
Merge branch '38720-sort-admin-runners' into 'master'
Add sort runners on admin runners
Closes #38720
See merge request gitlab-org/gitlab-ce!14661
Diffstat (limited to 'app')
-rw-r--r-- | app/controllers/admin/runners_controller.rb | 3 | ||||
-rw-r--r-- | app/views/admin/runners/index.html.haml | 2 |
2 files changed, 3 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| |