2017-05-16 11:41:15 +00:00
|
|
|
class Admin::JobsController < Admin::ApplicationController
|
2015-12-04 11:55:23 +00:00
|
|
|
def index
|
|
|
|
@scope = params[:scope]
|
|
|
|
@all_builds = Ci::Build
|
|
|
|
@builds = @all_builds.order('created_at DESC')
|
|
|
|
@builds =
|
|
|
|
case @scope
|
2016-07-05 08:10:34 +00:00
|
|
|
when 'pending'
|
|
|
|
@builds.pending.reverse_order
|
2015-12-30 14:25:42 +00:00
|
|
|
when 'running'
|
2016-07-05 08:10:34 +00:00
|
|
|
@builds.running.reverse_order
|
2015-12-04 11:55:23 +00:00
|
|
|
when 'finished'
|
|
|
|
@builds.finished
|
|
|
|
else
|
2015-12-30 14:25:42 +00:00
|
|
|
@builds
|
2015-12-04 11:55:23 +00:00
|
|
|
end
|
|
|
|
@builds = @builds.page(params[:page]).per(30)
|
|
|
|
end
|
|
|
|
|
|
|
|
def cancel_all
|
|
|
|
Ci::Build.running_or_pending.each(&:cancel)
|
|
|
|
|
2018-01-08 16:37:00 +00:00
|
|
|
redirect_to admin_jobs_path, status: 303
|
2015-12-04 11:55:23 +00:00
|
|
|
end
|
|
|
|
end
|