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
|
2020-07-28 23:09:34 +05:30
|
|
|
BUILDS_PER_PAGE = 30
|
|
|
|
|
2021-01-03 14:25:43 +05:30
|
|
|
feature_category :continuous_integration
|
|
|
|
|
2015-12-23 02:04:40 +05:30
|
|
|
def index
|
2020-01-01 13:55:28 +05:30
|
|
|
# We need all builds for tabs counters
|
2020-04-08 14:13:33 +05:30
|
|
|
@all_builds = Ci::JobsFinder.new(current_user: current_user).execute
|
2020-01-01 13:55:28 +05:30
|
|
|
|
2015-12-23 02:04:40 +05:30
|
|
|
@scope = params[:scope]
|
2020-04-08 14:13:33 +05:30
|
|
|
@builds = Ci::JobsFinder.new(current_user: current_user, params: params).execute
|
2020-01-01 13:55:28 +05:30
|
|
|
@builds = @builds.eager_load_everything
|
2020-07-28 23:09:34 +05:30
|
|
|
@builds = @builds.page(params[:page]).per(BUILDS_PER_PAGE).without_count
|
2015-12-23 02:04:40 +05:30
|
|
|
end
|
|
|
|
|
|
|
|
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
|