debian-mirror-gitlab/app/controllers/admin/builds_controller.rb

26 lines
581 B
Ruby
Raw Normal View History

2015-12-23 02:04:40 +05:30
class Admin::BuildsController < Admin::ApplicationController
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
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
@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)
redirect_to admin_builds_path
end
end