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
|
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
|
2015-12-04 11:55:23 +00:00
|
|
|
@builds = @builds.page(params[:page]).per(30)
|
|
|
|
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
|