2022-07-16 23:28:13 +05:30
|
|
|
# frozen_string_literal: true
|
|
|
|
|
2023-03-04 22:38:38 +05:30
|
|
|
module Admin
|
|
|
|
class BatchedJobsController < ApplicationController
|
|
|
|
feature_category :database
|
|
|
|
urgency :low
|
2022-07-16 23:28:13 +05:30
|
|
|
|
2023-03-04 22:38:38 +05:30
|
|
|
around_action :support_multiple_databases
|
2022-07-16 23:28:13 +05:30
|
|
|
|
2023-03-04 22:38:38 +05:30
|
|
|
def show
|
|
|
|
@job = Gitlab::Database::BackgroundMigration::BatchedJob.find(params[:id])
|
2022-07-16 23:28:13 +05:30
|
|
|
|
2023-03-04 22:38:38 +05:30
|
|
|
@transition_logs = @job.batched_job_transition_logs
|
|
|
|
end
|
2022-07-16 23:28:13 +05:30
|
|
|
|
2023-03-04 22:38:38 +05:30
|
|
|
private
|
2022-07-16 23:28:13 +05:30
|
|
|
|
2023-03-04 22:38:38 +05:30
|
|
|
def support_multiple_databases
|
|
|
|
Gitlab::Database::SharedModel.using_connection(base_model.connection) do
|
|
|
|
yield
|
|
|
|
end
|
2022-07-16 23:28:13 +05:30
|
|
|
end
|
|
|
|
|
2023-03-04 22:38:38 +05:30
|
|
|
def base_model
|
|
|
|
@selected_database = params[:database] || Gitlab::Database::MAIN_DATABASE_NAME
|
2022-07-16 23:28:13 +05:30
|
|
|
|
2023-03-04 22:38:38 +05:30
|
|
|
Gitlab::Database.database_base_models[@selected_database]
|
|
|
|
end
|
2022-07-16 23:28:13 +05:30
|
|
|
end
|
|
|
|
end
|