diff options
Diffstat (limited to 'app/controllers/admin')
-rw-r--r-- | app/controllers/admin/application_settings_controller.rb | 4 | ||||
-rw-r--r-- | app/controllers/admin/applications_controller.rb | 1 | ||||
-rw-r--r-- | app/controllers/admin/broadcast_messages_controller.rb | 1 | ||||
-rw-r--r-- | app/controllers/admin/ci/variables_controller.rb | 4 | ||||
-rw-r--r-- | app/controllers/admin/dev_ops_report_controller.rb | 17 | ||||
-rw-r--r-- | app/controllers/admin/projects_controller.rb | 4 | ||||
-rw-r--r-- | app/controllers/admin/runner_projects_controller.rb | 2 | ||||
-rw-r--r-- | app/controllers/admin/system_info_controller.rb | 18 | ||||
-rw-r--r-- | app/controllers/admin/topics_controller.rb | 20 | ||||
-rw-r--r-- | app/controllers/admin/usage_trends_controller.rb | 16 | ||||
-rw-r--r-- | app/controllers/admin/users_controller.rb | 2 |
11 files changed, 72 insertions, 17 deletions
diff --git a/app/controllers/admin/application_settings_controller.rb b/app/controllers/admin/application_settings_controller.rb index e05e87ffd89..6f21b123eb0 100644 --- a/app/controllers/admin/application_settings_controller.rb +++ b/app/controllers/admin/application_settings_controller.rb @@ -13,6 +13,10 @@ class Admin::ApplicationSettingsController < Admin::ApplicationController before_action :disable_query_limiting, only: [:usage_data] + before_action do + push_frontend_feature_flag(:ci_variable_settings_graphql) + end + feature_category :not_owned, [ # rubocop:todo Gitlab/AvoidFeatureCategoryNotOwned :general, :reporting, :metrics_and_profiling, :network, :preferences, :update, :reset_health_check_token diff --git a/app/controllers/admin/applications_controller.rb b/app/controllers/admin/applications_controller.rb index a6a21cf3649..b0d7c8cb8f2 100644 --- a/app/controllers/admin/applications_controller.rb +++ b/app/controllers/admin/applications_controller.rb @@ -11,7 +11,6 @@ class Admin::ApplicationsController < Admin::ApplicationController def index applications = ApplicationsFinder.new.execute @applications = Kaminari.paginate_array(applications).page(params[:page]) - @application_counts = OauthAccessToken.distinct_resource_owner_counts(@applications) end def show diff --git a/app/controllers/admin/broadcast_messages_controller.rb b/app/controllers/admin/broadcast_messages_controller.rb index bf573d45852..a53e832329f 100644 --- a/app/controllers/admin/broadcast_messages_controller.rb +++ b/app/controllers/admin/broadcast_messages_controller.rb @@ -58,7 +58,6 @@ class Admin::BroadcastMessagesController < Admin::ApplicationController def broadcast_message_params params.require(:broadcast_message).permit(%i( - color theme ends_at message diff --git a/app/controllers/admin/ci/variables_controller.rb b/app/controllers/admin/ci/variables_controller.rb index d4b7d750759..7d643435ddb 100644 --- a/app/controllers/admin/ci/variables_controller.rb +++ b/app/controllers/admin/ci/variables_controller.rb @@ -31,7 +31,7 @@ class Admin::Ci::VariablesController < Admin::ApplicationController def render_instance_variables render status: :ok, - json: { + json: { variables: Ci::InstanceVariableSerializer.new.represent(variables) } end @@ -41,7 +41,7 @@ class Admin::Ci::VariablesController < Admin::ApplicationController end def variables_params - params.permit(variables_attributes: [*variable_params_attributes]) + params.permit(variables_attributes: Array(variable_params_attributes)) end def variable_params_attributes diff --git a/app/controllers/admin/dev_ops_report_controller.rb b/app/controllers/admin/dev_ops_report_controller.rb index 47e3337aed7..71ee19ddf39 100644 --- a/app/controllers/admin/dev_ops_report_controller.rb +++ b/app/controllers/admin/dev_ops_report_controller.rb @@ -1,11 +1,16 @@ # frozen_string_literal: true class Admin::DevOpsReportController < Admin::ApplicationController - include RedisTracking + include ProductAnalyticsTracking helper_method :show_adoption? - track_redis_hll_event :show, name: 'i_analytics_dev_ops_score', if: -> { should_track_devops_score? } + track_custom_event :show, + name: 'i_analytics_dev_ops_score', + action: 'perform_analytics_usage_action', + label: 'redis_hll_counters.analytics.analytics_total_unique_counts_monthly', + destinations: %i[redis_hll snowplow], + conditions: -> { should_track_devops_score? } feature_category :devops_reports @@ -24,6 +29,14 @@ class Admin::DevOpsReportController < Admin::ApplicationController def should_track_devops_score? true end + + def tracking_namespace_source + nil + end + + def tracking_project_source + nil + end end Admin::DevOpsReportController.prepend_mod_with('Admin::DevOpsReportController') diff --git a/app/controllers/admin/projects_controller.rb b/app/controllers/admin/projects_controller.rb index 6fd1e9bb70e..3f3c3581555 100644 --- a/app/controllers/admin/projects_controller.rb +++ b/app/controllers/admin/projects_controller.rb @@ -48,8 +48,8 @@ class Admin::ProjectsController < Admin::ApplicationController flash[:notice] = _("Project '%{project_name}' is in the process of being deleted.") % { project_name: @project.full_name } redirect_to admin_projects_path, status: :found - rescue Projects::DestroyService::DestroyError => ex - redirect_to admin_projects_path, status: :found, alert: ex.message + rescue Projects::DestroyService::DestroyError => e + redirect_to admin_projects_path, status: :found, alert: e.message end # rubocop: disable CodeReuse/ActiveRecord diff --git a/app/controllers/admin/runner_projects_controller.rb b/app/controllers/admin/runner_projects_controller.rb index 0165c6471db..7dbae565d07 100644 --- a/app/controllers/admin/runner_projects_controller.rb +++ b/app/controllers/admin/runner_projects_controller.rb @@ -9,7 +9,7 @@ class Admin::RunnerProjectsController < Admin::ApplicationController def create @runner = Ci::Runner.find(params[:runner_project][:runner_id]) - if ::Ci::Runners::AssignRunnerService.new(@runner, @project, current_user).execute + if ::Ci::Runners::AssignRunnerService.new(@runner, @project, current_user).execute.success? redirect_to edit_admin_runner_url(@runner), notice: s_('Runners|Runner assigned to project.') else redirect_to edit_admin_runner_url(@runner), alert: 'Failed adding runner to project' diff --git a/app/controllers/admin/system_info_controller.rb b/app/controllers/admin/system_info_controller.rb index f81b02ad31f..41f95addc66 100644 --- a/app/controllers/admin/system_info_controller.rb +++ b/app/controllers/admin/system_info_controller.rb @@ -37,8 +37,16 @@ class Admin::SystemInfoController < Admin::ApplicationController ].freeze def show - @cpus = Vmstat.cpu rescue nil - @memory = Vmstat.memory rescue nil + @cpus = begin + Vmstat.cpu + rescue StandardError + nil + end + @memory = begin + Vmstat.memory + rescue StandardError + nil + end mounts = Sys::Filesystem.mounts @disks = [] @@ -52,9 +60,9 @@ class Admin::SystemInfoController < Admin::ApplicationController disk = Sys::Filesystem.stat(mount.mount_point) @disks.push({ bytes_total: disk.bytes_total, - bytes_used: disk.bytes_used, - disk_name: mount.name, - mount_path: disk.path + bytes_used: disk.bytes_used, + disk_name: mount.name, + mount_path: disk.path }) rescue Sys::Filesystem::Error end diff --git a/app/controllers/admin/topics_controller.rb b/app/controllers/admin/topics_controller.rb index b451928e591..69bcfdf4791 100644 --- a/app/controllers/admin/topics_controller.rb +++ b/app/controllers/admin/topics_controller.rb @@ -45,6 +45,22 @@ class Admin::TopicsController < Admin::ApplicationController notice: _('Topic %{topic_name} was successfully removed.') % { topic_name: @topic.title_or_name } end + def merge + 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 + + 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 } + end + private def topic @@ -63,4 +79,8 @@ class Admin::TopicsController < Admin::ApplicationController :title ] end + + def merge_params + params.permit([:source_topic_id, :target_topic_id]) + end end diff --git a/app/controllers/admin/usage_trends_controller.rb b/app/controllers/admin/usage_trends_controller.rb index 2cede1aec05..082b38ac3a8 100644 --- a/app/controllers/admin/usage_trends_controller.rb +++ b/app/controllers/admin/usage_trends_controller.rb @@ -1,9 +1,13 @@ # frozen_string_literal: true class Admin::UsageTrendsController < Admin::ApplicationController - include RedisTracking + include ProductAnalyticsTracking - track_redis_hll_event :index, name: 'i_analytics_instance_statistics' + track_custom_event :index, + name: 'i_analytics_instance_statistics', + action: 'perform_analytics_usage_action', + label: 'redis_hll_counters.analytics.analytics_total_unique_counts_monthly', + destinations: %i[redis_hll snowplow] feature_category :devops_reports @@ -11,4 +15,12 @@ class Admin::UsageTrendsController < Admin::ApplicationController def index end + + def tracking_namespace_source + @group + end + + def tracking_project_source + nil + end end diff --git a/app/controllers/admin/users_controller.rb b/app/controllers/admin/users_controller.rb index 874eb8985fb..5cc0c8f3970 100644 --- a/app/controllers/admin/users_controller.rb +++ b/app/controllers/admin/users_controller.rb @@ -88,7 +88,7 @@ class Admin::UsersController < Admin::ApplicationController result = Users::RejectService.new(current_user).execute(user) if result[:status] == :success - redirect_to admin_users_path, status: :found, notice: _("You've rejected %{user}" % { user: user.name }) + redirect_back_or_admin_user(notice: _("You've rejected %{user}" % { user: user.name })) else redirect_back_or_admin_user(alert: result[:message]) end |