2017-09-10 17:25:29 +05:30
|
|
|
class Admin::JobsController < Admin::ApplicationController
|
2015-12-23 02:04:40 +05:30
|
|
|
def index
|
|
|
|
@scope = params[:scope]
|
|
|
|
@all_builds = Ci::Build
|
|
|
|
@builds = @all_builds.order('created_at DESC')
|
|
|
|
@builds =
|
|
|
|
case @scope
|
2016-08-24 12:49:21 +05:30
|
|
|
when 'pending'
|
|
|
|
@builds.pending.reverse_order
|
2016-01-14 18:37:52 +05:30
|
|
|
when 'running'
|
2016-08-24 12:49:21 +05:30
|
|
|
@builds.running.reverse_order
|
2015-12-23 02:04:40 +05:30
|
|
|
when 'finished'
|
|
|
|
@builds.finished
|
|
|
|
else
|
2016-01-14 18:37:52 +05:30
|
|
|
@builds
|
2015-12-23 02:04:40 +05:30
|
|
|
end
|
|
|
|
@builds = @builds.page(params[:page]).per(30)
|
|
|
|
end
|
|
|
|
|
|
|
|
def cancel_all
|
|
|
|
Ci::Build.running_or_pending.each(&:cancel)
|
|
|
|
|
2018-03-17 18:26:18 +05:30
|
|
|
redirect_to admin_jobs_path, status: 303
|
2015-12-23 02:04:40 +05:30
|
|
|
end
|
|
|
|
end
|