2018-09-14 01:42:05 -04:00
|
|
|
# frozen_string_literal: true
|
|
|
|
|
2017-05-16 07:41:15 -04:00
|
|
|
class Admin::JobsController < Admin::ApplicationController
|
2020-07-03 08:08:53 -04:00
|
|
|
BUILDS_PER_PAGE = 30
|
|
|
|
|
2020-10-05 17:08:47 -04:00
|
|
|
feature_category :continuous_integration
|
|
|
|
|
2015-12-04 06:55:23 -05:00
|
|
|
def index
|
2019-11-25 19:06:28 -05:00
|
|
|
# We need all builds for tabs counters
|
2020-03-13 20:09:30 -04:00
|
|
|
@all_builds = Ci::JobsFinder.new(current_user: current_user).execute
|
2019-11-25 19:06:28 -05:00
|
|
|
|
2015-12-04 06:55:23 -05:00
|
|
|
@scope = params[:scope]
|
2020-03-13 20:09:30 -04:00
|
|
|
@builds = Ci::JobsFinder.new(current_user: current_user, params: params).execute
|
2019-11-25 19:06:28 -05:00
|
|
|
@builds = @builds.eager_load_everything
|
2020-07-03 08:08:53 -04:00
|
|
|
@builds = @builds.page(params[:page]).per(BUILDS_PER_PAGE).without_count
|
2015-12-04 06:55:23 -05:00
|
|
|
end
|
|
|
|
|
|
|
|
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
|