summaryrefslogtreecommitdiff
path: root/app/controllers/admin/jobs_controller.rb
diff options
context:
space:
mode:
authorLin Jen-Shin <godfat@godfat.org>2017-05-16 19:41:15 +0800
committerLin Jen-Shin <godfat@godfat.org>2017-05-17 20:17:30 +0800
commit71777a4a184945d6b58170af55d9fd9fef821ac9 (patch)
treee3abb2579383d151ac4463b08a783ff9630e4b2c /app/controllers/admin/jobs_controller.rb
parenta5f0656392699dad7677a368c315217ea99b3982 (diff)
downloadgitlab-ce-71777a4a184945d6b58170af55d9fd9fef821ac9.tar.gz
Rename BuildsController to JobsController
Rename other URL generators admin_builds_path -> admin_jobs_path Fix tests and more renaming Fix more tests Also change build_id to job_id in the controller
Diffstat (limited to 'app/controllers/admin/jobs_controller.rb')
-rw-r--r--app/controllers/admin/jobs_controller.rb25
1 files changed, 25 insertions, 0 deletions
diff --git a/app/controllers/admin/jobs_controller.rb b/app/controllers/admin/jobs_controller.rb
new file mode 100644
index 00000000000..5162273ef8a
--- /dev/null
+++ b/app/controllers/admin/jobs_controller.rb
@@ -0,0 +1,25 @@
+class Admin::JobsController < Admin::ApplicationController
+ def index
+ @scope = params[:scope]
+ @all_builds = Ci::Build
+ @builds = @all_builds.order('created_at DESC')
+ @builds =
+ case @scope
+ when 'pending'
+ @builds.pending.reverse_order
+ when 'running'
+ @builds.running.reverse_order
+ when 'finished'
+ @builds.finished
+ else
+ @builds
+ end
+ @builds = @builds.page(params[:page]).per(30)
+ end
+
+ def cancel_all
+ Ci::Build.running_or_pending.each(&:cancel)
+
+ redirect_to admin_jobs_path
+ end
+end