diff options
Diffstat (limited to 'app/controllers/admin')
-rw-r--r-- | app/controllers/admin/application_settings/appearances_controller.rb (renamed from app/controllers/admin/appearances_controller.rb) | 12 | ||||
-rw-r--r-- | app/controllers/admin/application_settings_controller.rb | 2 | ||||
-rw-r--r-- | app/controllers/admin/background_migrations_controller.rb | 23 | ||||
-rw-r--r-- | app/controllers/admin/dashboard_controller.rb | 2 | ||||
-rw-r--r-- | app/controllers/admin/groups_controller.rb | 2 | ||||
-rw-r--r-- | app/controllers/admin/runners_controller.rb | 3 | ||||
-rw-r--r-- | app/controllers/admin/users_controller.rb | 27 |
7 files changed, 61 insertions, 10 deletions
diff --git a/app/controllers/admin/appearances_controller.rb b/app/controllers/admin/application_settings/appearances_controller.rb index c2614a158b7..47b2356a60f 100644 --- a/app/controllers/admin/appearances_controller.rb +++ b/app/controllers/admin/application_settings/appearances_controller.rb @@ -1,6 +1,6 @@ # frozen_string_literal: true -class Admin::AppearancesController < Admin::ApplicationController +class Admin::ApplicationSettings::AppearancesController < Admin::ApplicationController before_action :set_appearance, except: :create feature_category :navigation @@ -16,7 +16,7 @@ class Admin::AppearancesController < Admin::ApplicationController @appearance = Appearance.new(appearance_params) if @appearance.save - redirect_to admin_appearances_path, notice: _('Appearance was successfully created.') + redirect_to admin_application_settings_appearances_path, notice: _('Appearance was successfully created.') else render action: 'show' end @@ -24,7 +24,7 @@ class Admin::AppearancesController < Admin::ApplicationController def update if @appearance.update(appearance_params) - redirect_to admin_appearances_path, notice: _('Appearance was successfully updated.') + redirect_to admin_application_settings_appearances_path, notice: _('Appearance was successfully updated.') else render action: 'show' end @@ -35,21 +35,21 @@ class Admin::AppearancesController < Admin::ApplicationController @appearance.save - redirect_to admin_appearances_path, notice: _('Logo was successfully removed.') + redirect_to admin_application_settings_appearances_path, notice: _('Logo was successfully removed.') end def header_logos @appearance.remove_header_logo! @appearance.save - redirect_to admin_appearances_path, notice: _('Header logo was successfully removed.') + redirect_to admin_application_settings_appearances_path, notice: _('Header logo was successfully removed.') end def favicon @appearance.remove_favicon! @appearance.save - redirect_to admin_appearances_path, notice: _('Favicon was successfully removed.') + redirect_to admin_application_settings_appearances_path, notice: _('Favicon was successfully removed.') end private diff --git a/app/controllers/admin/application_settings_controller.rb b/app/controllers/admin/application_settings_controller.rb index 80cb04ac496..5ddeb9630ba 100644 --- a/app/controllers/admin/application_settings_controller.rb +++ b/app/controllers/admin/application_settings_controller.rb @@ -253,7 +253,7 @@ class Admin::ApplicationSettingsController < Admin::ApplicationController end def perform_update - successful = ApplicationSettings::UpdateService + successful = ::ApplicationSettings::UpdateService .new(@application_setting, current_user, application_setting_params) .execute diff --git a/app/controllers/admin/background_migrations_controller.rb b/app/controllers/admin/background_migrations_controller.rb new file mode 100644 index 00000000000..c1dffbf423d --- /dev/null +++ b/app/controllers/admin/background_migrations_controller.rb @@ -0,0 +1,23 @@ +# frozen_string_literal: true + +class Admin::BackgroundMigrationsController < Admin::ApplicationController + feature_category :database + + def index + @relations_by_tab = { + 'queued' => batched_migration_class.queued.queue_order, + 'failed' => batched_migration_class.failed.queue_order, + 'finished' => batched_migration_class.finished.queue_order.reverse_order + } + + @current_tab = @relations_by_tab.key?(params[:tab]) ? params[:tab] : 'queued' + @migrations = @relations_by_tab[@current_tab].page(params[:page]) + @successful_rows_counts = batched_migration_class.successful_rows_counts(@migrations.map(&:id)) + end + + private + + def batched_migration_class + Gitlab::Database::BackgroundMigration::BatchedMigration + end +end diff --git a/app/controllers/admin/dashboard_controller.rb b/app/controllers/admin/dashboard_controller.rb index 46e5a508a1b..ba24e3e619b 100644 --- a/app/controllers/admin/dashboard_controller.rb +++ b/app/controllers/admin/dashboard_controller.rb @@ -15,7 +15,7 @@ class Admin::DashboardController < Admin::ApplicationController @groups = Group.order_id_desc.with_route.limit(10) @notices = Gitlab::ConfigChecker::PumaRuggedChecker.check @notices += Gitlab::ConfigChecker::ExternalDatabaseChecker.check - @redis_versions = [Gitlab::Redis::Queues, Gitlab::Redis::SharedState, Gitlab::Redis::Cache].map(&:version).uniq + @redis_versions = [Gitlab::Redis::Queues, Gitlab::Redis::SharedState, Gitlab::Redis::Cache, Gitlab::Redis::TraceChunks].map(&:version).uniq end # rubocop: enable CodeReuse/ActiveRecord diff --git a/app/controllers/admin/groups_controller.rb b/app/controllers/admin/groups_controller.rb index 5b33ee78e8c..9abb244bc92 100644 --- a/app/controllers/admin/groups_controller.rb +++ b/app/controllers/admin/groups_controller.rb @@ -62,7 +62,7 @@ class Admin::GroupsController < Admin::ApplicationController def members_update member_params = params.permit(:user_ids, :access_level, :expires_at) - result = Members::CreateService.new(current_user, member_params.merge(limit: -1, source: @group)).execute + result = Members::CreateService.new(current_user, member_params.merge(limit: -1, source: @group, invite_source: 'admin-group-page')).execute if result[:status] == :success redirect_to [:admin, @group], notice: _('Users were successfully added.') diff --git a/app/controllers/admin/runners_controller.rb b/app/controllers/admin/runners_controller.rb index 40ec68c1d46..bf9cfa3acff 100644 --- a/app/controllers/admin/runners_controller.rb +++ b/app/controllers/admin/runners_controller.rb @@ -4,6 +4,9 @@ class Admin::RunnersController < Admin::ApplicationController include RunnerSetupScripts before_action :runner, except: [:index, :tag_list, :runner_setup_scripts] + before_action only: [:index] do + push_frontend_feature_flag(:runner_list_view_vue_ui, current_user, default_enabled: :yaml) + end feature_category :continuous_integration diff --git a/app/controllers/admin/users_controller.rb b/app/controllers/admin/users_controller.rb index 2e9229db56c..e397ecbadaf 100644 --- a/app/controllers/admin/users_controller.rb +++ b/app/controllers/admin/users_controller.rb @@ -209,6 +209,9 @@ class Admin::UsersController < Admin::ApplicationController user_params_with_pass.merge!(password_params) end + cc_validation_params = process_credit_card_validation_params(user_params_with_pass.delete(:credit_card_validation_attributes)) + user_params_with_pass.merge!(cc_validation_params) + respond_to do |format| result = Users::UpdateService.new(current_user, user_params_with_pass.merge(user: user)).execute do |user| user.skip_reconfirmation! @@ -253,6 +256,27 @@ class Admin::UsersController < Admin::ApplicationController protected + def process_credit_card_validation_params(cc_validation_params) + return unless cc_validation_params && cc_validation_params[:credit_card_validated_at] + + cc_validation = cc_validation_params[:credit_card_validated_at] + + if cc_validation == "1" && !user.credit_card_validated_at + { + credit_card_validation_attributes: { + credit_card_validated_at: Time.zone.now + } + } + + elsif cc_validation == "0" && user.credit_card_validated_at + { + credit_card_validation_attributes: { + _destroy: true + } + } + end + end + def paginate_without_count? counts = Gitlab::Database::Count.approximate_counts([User]) @@ -330,7 +354,8 @@ class Admin::UsersController < Admin::ApplicationController :twitter, :username, :website_url, - :note + :note, + credit_card_validation_attributes: [:credit_card_validated_at] ] end |