gitlab-org--gitlab-foss/app/controllers/admin/jobs_controller.rb

30 lines
707 B
Ruby
Raw Normal View History

# frozen_string_literal: true
class Admin::JobsController < Admin::ApplicationController
# rubocop: disable CodeReuse/ActiveRecord
2015-12-04 06:55:23 -05:00
def index
@scope = params[:scope]
@all_builds = Ci::Build
@builds = @all_builds.order('id DESC')
2015-12-04 06:55:23 -05:00
@builds =
case @scope
when 'pending'
@builds.pending.reverse_order
when 'running'
@builds.running.reverse_order
2015-12-04 06:55:23 -05:00
when 'finished'
@builds.finished
else
@builds
2015-12-04 06:55:23 -05:00
end
@builds = @builds.page(params[:page]).per(30)
end
# rubocop: enable CodeReuse/ActiveRecord
2015-12-04 06:55:23 -05:00
def cancel_all
Ci::Build.running_or_pending.each(&:cancel)
2018-07-02 06:43:06 -04:00
redirect_to admin_jobs_path, status: :see_other
2015-12-04 06:55:23 -05:00
end
end