2015-12-04 06:55:23 -05:00
|
|
|
class Admin::BuildsController < Admin::ApplicationController
|
|
|
|
def index
|
|
|
|
@scope = params[:scope]
|
|
|
|
@all_builds = Ci::Build
|
|
|
|
@builds = @all_builds.order('created_at DESC')
|
|
|
|
@builds =
|
|
|
|
case @scope
|
2015-12-30 09:25:42 -05:00
|
|
|
when 'running'
|
|
|
|
@builds.running_or_pending.reverse_order
|
2015-12-04 06:55:23 -05:00
|
|
|
when 'finished'
|
|
|
|
@builds.finished
|
|
|
|
else
|
2015-12-30 09:25:42 -05:00
|
|
|
@builds
|
2015-12-04 06:55:23 -05:00
|
|
|
end
|
|
|
|
@builds = @builds.page(params[:page]).per(30)
|
|
|
|
end
|
|
|
|
|
|
|
|
def cancel_all
|
|
|
|
Ci::Build.running_or_pending.each(&:cancel)
|
|
|
|
|
|
|
|
redirect_to admin_builds_path
|
|
|
|
end
|
|
|
|
end
|