diff options
Diffstat (limited to 'app/controllers/admin')
-rw-r--r-- | app/controllers/admin/application_settings_controller.rb | 28 | ||||
-rw-r--r-- | app/controllers/admin/applications_controller.rb | 11 | ||||
-rw-r--r-- | app/controllers/admin/broadcast_messages_controller.rb | 19 | ||||
-rw-r--r-- | app/controllers/admin/cohorts_controller.rb | 17 | ||||
-rw-r--r-- | app/controllers/admin/dashboard_controller.rb | 9 | ||||
-rw-r--r-- | app/controllers/admin/hook_logs_controller.rb | 37 | ||||
-rw-r--r-- | app/controllers/admin/hooks_controller.rb | 4 | ||||
-rw-r--r-- | app/controllers/admin/plan_limits_controller.rb | 39 | ||||
-rw-r--r-- | app/controllers/admin/runners_controller.rb | 10 | ||||
-rw-r--r-- | app/controllers/admin/spam_logs_controller.rb | 2 | ||||
-rw-r--r-- | app/controllers/admin/topics_controller.rb | 12 | ||||
-rw-r--r-- | app/controllers/admin/users_controller.rb | 2 |
12 files changed, 91 insertions, 99 deletions
diff --git a/app/controllers/admin/application_settings_controller.rb b/app/controllers/admin/application_settings_controller.rb index 6f21b123eb0..b75a7c4a2dd 100644 --- a/app/controllers/admin/application_settings_controller.rb +++ b/app/controllers/admin/application_settings_controller.rb @@ -18,23 +18,23 @@ class Admin::ApplicationSettingsController < Admin::ApplicationController end feature_category :not_owned, [ # rubocop:todo Gitlab/AvoidFeatureCategoryNotOwned - :general, :reporting, :metrics_and_profiling, :network, - :preferences, :update, :reset_health_check_token - ] + :general, :reporting, :metrics_and_profiling, :network, + :preferences, :update, :reset_health_check_token + ] feature_category :metrics, [ - :create_self_monitoring_project, - :status_create_self_monitoring_project, - :delete_self_monitoring_project, - :status_delete_self_monitoring_project - ] + :create_self_monitoring_project, + :status_create_self_monitoring_project, + :delete_self_monitoring_project, + :status_delete_self_monitoring_project + ] urgency :low, [ - :create_self_monitoring_project, - :status_create_self_monitoring_project, - :delete_self_monitoring_project, - :status_delete_self_monitoring_project, - :reset_error_tracking_access_token - ] + :create_self_monitoring_project, + :status_create_self_monitoring_project, + :delete_self_monitoring_project, + :status_delete_self_monitoring_project, + :reset_error_tracking_access_token + ] feature_category :source_code_management, [:repository, :clear_repository_check_states] feature_category :continuous_integration, [:ci_cd, :reset_registration_token] diff --git a/app/controllers/admin/applications_controller.rb b/app/controllers/admin/applications_controller.rb index b0d7c8cb8f2..d66b3cb4366 100644 --- a/app/controllers/admin/applications_controller.rb +++ b/app/controllers/admin/applications_controller.rb @@ -14,7 +14,7 @@ class Admin::ApplicationsController < Admin::ApplicationController end def show - @created = get_created_session + @created = get_created_session if Feature.disabled?('hash_oauth_secrets') end def new @@ -30,9 +30,14 @@ class Admin::ApplicationsController < Admin::ApplicationController if @application.persisted? flash[:notice] = I18n.t(:notice, scope: [:doorkeeper, :flash, :applications, :create]) - set_created_session + if Feature.enabled?('hash_oauth_secrets') + @created = true + render :show + else + set_created_session - redirect_to admin_application_url(@application) + redirect_to admin_application_url(@application) + end else render :new end diff --git a/app/controllers/admin/broadcast_messages_controller.rb b/app/controllers/admin/broadcast_messages_controller.rb index a53e832329f..251ba9e29f2 100644 --- a/app/controllers/admin/broadcast_messages_controller.rb +++ b/app/controllers/admin/broadcast_messages_controller.rb @@ -57,14 +57,15 @@ class Admin::BroadcastMessagesController < Admin::ApplicationController end def broadcast_message_params - params.require(:broadcast_message).permit(%i( - theme - ends_at - message - starts_at - target_path - broadcast_type - dismissable - ), target_access_levels: []).reverse_merge!(target_access_levels: []) + params.require(:broadcast_message) + .permit(%i( + theme + ends_at + message + starts_at + target_path + broadcast_type + dismissable + ), target_access_levels: []).reverse_merge!(target_access_levels: []) end end diff --git a/app/controllers/admin/cohorts_controller.rb b/app/controllers/admin/cohorts_controller.rb index 468a1077694..ce3d769f35e 100644 --- a/app/controllers/admin/cohorts_controller.rb +++ b/app/controllers/admin/cohorts_controller.rb @@ -1,15 +1,20 @@ # frozen_string_literal: true class Admin::CohortsController < Admin::ApplicationController - include RedisTracking + include ProductAnalyticsTracking feature_category :devops_reports urgency :low + track_custom_event :index, + name: 'i_analytics_cohorts', + action: 'perform_analytics_usage_action', + label: 'redis_hll_counters.analytics.analytics_total_unique_counts_monthly', + destinations: %i[redis_hll snowplow] + def index @cohorts = load_cohorts - track_cohorts_visit end private @@ -22,7 +27,11 @@ class Admin::CohortsController < Admin::ApplicationController CohortsSerializer.new.represent(cohorts_results) end - def track_cohorts_visit - track_unique_redis_hll_event('i_analytics_cohorts') if trackable_html_request? + def tracking_namespace_source + nil + end + + def tracking_project_source + nil end end diff --git a/app/controllers/admin/dashboard_controller.rb b/app/controllers/admin/dashboard_controller.rb index 8fe106249c3..37dde065e70 100644 --- a/app/controllers/admin/dashboard_controller.rb +++ b/app/controllers/admin/dashboard_controller.rb @@ -14,14 +14,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, - Gitlab::Redis::TraceChunks, - Gitlab::Redis::RateLimiting, - Gitlab::Redis::Sessions - ].map(&:version).uniq + @redis_versions = Gitlab::Redis::ALL_CLASSES.map(&:version).uniq end def stats diff --git a/app/controllers/admin/hook_logs_controller.rb b/app/controllers/admin/hook_logs_controller.rb index aa13673095d..a283d3abb0b 100644 --- a/app/controllers/admin/hook_logs_controller.rb +++ b/app/controllers/admin/hook_logs_controller.rb @@ -1,34 +1,17 @@ # frozen_string_literal: true -class Admin::HookLogsController < Admin::ApplicationController - include ::Integrations::HooksExecution +module Admin + class HookLogsController < Admin::ApplicationController + include WebHooks::HookLogActions - before_action :hook, only: [:show, :retry] - before_action :hook_log, only: [:show, :retry] + private - respond_to :html + def hook + @hook ||= SystemHook.find(params[:hook_id]) + end - feature_category :integrations - urgency :low, [:retry] - - def show - end - - def retry - result = hook.execute(hook_log.request_data, hook_log.trigger) - - set_hook_execution_notice(result) - - redirect_to edit_admin_hook_path(@hook) - end - - private - - def hook - @hook ||= SystemHook.find(params[:hook_id]) - end - - def hook_log - @hook_log ||= hook.web_hook_logs.find(params[:id]) + def after_retry_redirect_path + edit_admin_hook_path(hook) + end end end diff --git a/app/controllers/admin/hooks_controller.rb b/app/controllers/admin/hooks_controller.rb index 810801d4209..1dc6c68d8ca 100644 --- a/app/controllers/admin/hooks_controller.rb +++ b/app/controllers/admin/hooks_controller.rb @@ -1,7 +1,7 @@ # frozen_string_literal: true class Admin::HooksController < Admin::ApplicationController - include ::Integrations::HooksExecution + include ::WebHooks::HookActions before_action :hook_logs, only: :edit @@ -27,7 +27,7 @@ class Admin::HooksController < Admin::ApplicationController end def hook_logs - @hook_logs ||= hook.web_hook_logs.recent.page(params[:page]) + @hook_logs ||= hook.web_hook_logs.recent.page(params[:page]).without_count end def hook_param_names diff --git a/app/controllers/admin/plan_limits_controller.rb b/app/controllers/admin/plan_limits_controller.rb index 7bfbabe8dfc..2cebc059830 100644 --- a/app/controllers/admin/plan_limits_controller.rb +++ b/app/controllers/admin/plan_limits_controller.rb @@ -28,24 +28,25 @@ class Admin::PlanLimitsController < Admin::ApplicationController end def plan_limits_params - params.require(:plan_limits).permit(%i[ - plan_id - conan_max_file_size - helm_max_file_size - maven_max_file_size - npm_max_file_size - nuget_max_file_size - pypi_max_file_size - terraform_module_max_file_size - generic_packages_max_file_size - ci_pipeline_size - ci_active_jobs - ci_active_pipelines - ci_project_subscriptions - ci_pipeline_schedules - ci_needs_size_limit - ci_registered_group_runners - ci_registered_project_runners - ]) + params.require(:plan_limits) + .permit(%i[ + plan_id + conan_max_file_size + helm_max_file_size + maven_max_file_size + npm_max_file_size + nuget_max_file_size + pypi_max_file_size + terraform_module_max_file_size + generic_packages_max_file_size + ci_pipeline_size + ci_active_jobs + ci_active_pipelines + ci_project_subscriptions + ci_pipeline_schedules + ci_needs_size_limit + ci_registered_group_runners + ci_registered_project_runners + ]) end end diff --git a/app/controllers/admin/runners_controller.rb b/app/controllers/admin/runners_controller.rb index 24d7bd9ca7b..a0f72f5e58c 100644 --- a/app/controllers/admin/runners_controller.rb +++ b/app/controllers/admin/runners_controller.rb @@ -8,6 +8,10 @@ class Admin::RunnersController < Admin::ApplicationController push_frontend_feature_flag(:admin_runners_bulk_delete) end + before_action only: [:show] do + push_frontend_feature_flag(:enforce_runner_token_expires_at) + end + feature_category :runner urgency :low @@ -22,7 +26,7 @@ class Admin::RunnersController < Admin::ApplicationController end def update - if Ci::Runners::UpdateRunnerService.new(@runner).update(runner_params) + if Ci::Runners::UpdateRunnerService.new(@runner).execute(runner_params).success? respond_to do |format| format.html { redirect_to edit_admin_runner_path(@runner) } end @@ -39,7 +43,7 @@ class Admin::RunnersController < Admin::ApplicationController end def resume - if Ci::Runners::UpdateRunnerService.new(@runner).update(active: true) + if Ci::Runners::UpdateRunnerService.new(@runner).execute(active: true).success? redirect_to admin_runners_path, notice: _('Runner was successfully updated.') else redirect_to admin_runners_path, alert: _('Runner was not updated.') @@ -47,7 +51,7 @@ class Admin::RunnersController < Admin::ApplicationController end def pause - if Ci::Runners::UpdateRunnerService.new(@runner).update(active: false) + if Ci::Runners::UpdateRunnerService.new(@runner).execute(active: false).success? redirect_to admin_runners_path, notice: _('Runner was successfully updated.') else redirect_to admin_runners_path, alert: _('Runner was not updated.') diff --git a/app/controllers/admin/spam_logs_controller.rb b/app/controllers/admin/spam_logs_controller.rb index e4e866a8b60..3a55fc4b951 100644 --- a/app/controllers/admin/spam_logs_controller.rb +++ b/app/controllers/admin/spam_logs_controller.rb @@ -1,7 +1,7 @@ # frozen_string_literal: true class Admin::SpamLogsController < Admin::ApplicationController - feature_category :not_owned # rubocop:todo Gitlab/AvoidFeatureCategoryNotOwned + feature_category :instance_resiliency # rubocop: disable CodeReuse/ActiveRecord def index diff --git a/app/controllers/admin/topics_controller.rb b/app/controllers/admin/topics_controller.rb index 69bcfdf4791..e97ead12f71 100644 --- a/app/controllers/admin/topics_controller.rb +++ b/app/controllers/admin/topics_controller.rb @@ -49,16 +49,12 @@ class Admin::TopicsController < Admin::ApplicationController source_topic = Projects::Topic.find(merge_params[:source_topic_id]) target_topic = Projects::Topic.find(merge_params[:target_topic_id]) - begin - ::Topics::MergeService.new(source_topic, target_topic).execute - rescue ArgumentError => e - return render status: :bad_request, json: { type: :alert, message: e.message } - end + response = ::Topics::MergeService.new(source_topic, target_topic).execute + return render status: :bad_request, json: { type: :alert, message: response.message } if response.error? message = _('Topic %{source_topic} was successfully merged into topic %{target_topic}.') - redirect_to admin_topics_path, - status: :found, - notice: message % { source_topic: source_topic.name, target_topic: target_topic.name } + flash[:toast] = message % { source_topic: source_topic.name, target_topic: target_topic.name } + redirect_to admin_topics_path, status: :found end private diff --git a/app/controllers/admin/users_controller.rb b/app/controllers/admin/users_controller.rb index 5cc0c8f3970..1a57d271271 100644 --- a/app/controllers/admin/users_controller.rb +++ b/app/controllers/admin/users_controller.rb @@ -105,7 +105,7 @@ class Admin::UsersController < Admin::ApplicationController return redirect_back_or_admin_user(notice: _("Error occurred. A blocked user cannot be deactivated")) if user.blocked? return redirect_back_or_admin_user(notice: _("Successfully deactivated")) if user.deactivated? return redirect_back_or_admin_user(notice: _("Internal users cannot be deactivated")) if user.internal? - return redirect_back_or_admin_user(notice: _("The user you are trying to deactivate has been active in the past %{minimum_inactive_days} days and cannot be deactivated") % { minimum_inactive_days: ::User::MINIMUM_INACTIVE_DAYS }) unless user.can_be_deactivated? + return redirect_back_or_admin_user(notice: _("The user you are trying to deactivate has been active in the past %{minimum_inactive_days} days and cannot be deactivated") % { minimum_inactive_days: Gitlab::CurrentSettings.deactivate_dormant_users_period }) unless user.can_be_deactivated? user.deactivate redirect_back_or_admin_user(notice: _("Successfully deactivated")) |