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

30 lines
707 B
Ruby
Raw Normal View History

2018-12-05 23:21:45 +05:30
# frozen_string_literal: true
2017-09-10 17:25:29 +05:30
class Admin::JobsController < Admin::ApplicationController
2018-12-05 23:21:45 +05:30
# rubocop: disable CodeReuse/ActiveRecord
2015-12-23 02:04:40 +05:30
def index
@scope = params[:scope]
@all_builds = Ci::Build
2018-11-18 11:00:15 +05:30
@builds = @all_builds.order('id DESC')
2015-12-23 02:04:40 +05:30
@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
2018-12-05 23:21:45 +05:30
# rubocop: enable CodeReuse/ActiveRecord
2015-12-23 02:04:40 +05:30
def cancel_all
Ci::Build.running_or_pending.each(&:cancel)
2018-11-18 11:00:15 +05:30
redirect_to admin_jobs_path, status: :see_other
2015-12-23 02:04:40 +05:30
end
end