2018-09-14 05:42:05 +00:00
|
|
|
# frozen_string_literal: true
|
|
|
|
|
2017-05-16 11:41:15 +00:00
|
|
|
class Admin::JobsController < Admin::ApplicationController
|
2020-07-03 12:08:53 +00:00
|
|
|
BUILDS_PER_PAGE = 30
|
|
|
|
|
2020-10-05 21:08:47 +00:00
|
|
|
feature_category :continuous_integration
|
|
|
|
|
2015-12-04 11:55:23 +00:00
|
|
|
def index
|
2019-11-26 00:06:28 +00:00
|
|
|
# We need all builds for tabs counters
|
2020-03-14 00:09:30 +00:00
|
|
|
@all_builds = Ci::JobsFinder.new(current_user: current_user).execute
|
2019-11-26 00:06:28 +00:00
|
|
|
|
2015-12-04 11:55:23 +00:00
|
|
|
@scope = params[:scope]
|
2020-03-14 00:09:30 +00:00
|
|
|
@builds = Ci::JobsFinder.new(current_user: current_user, params: params).execute
|
2019-11-26 00:06:28 +00:00
|
|
|
@builds = @builds.eager_load_everything
|
2020-07-03 12:08:53 +00:00
|
|
|
@builds = @builds.page(params[:page]).per(BUILDS_PER_PAGE).without_count
|
2015-12-04 11:55:23 +00:00
|
|
|
end
|
|
|
|
|
|
|
|
def cancel_all
|
|
|
|
Ci::Build.running_or_pending.each(&:cancel)
|
|
|
|
|
2018-07-02 10:43:06 +00:00
|
|
|
redirect_to admin_jobs_path, status: :see_other
|
2015-12-04 11:55:23 +00:00
|
|
|
end
|
|
|
|
end
|