diff options
author | GitLab Bot <gitlab-bot@gitlab.com> | 2022-02-18 09:45:46 +0000 |
---|---|---|
committer | GitLab Bot <gitlab-bot@gitlab.com> | 2022-02-18 09:45:46 +0000 |
commit | a7b3560714b4d9cc4ab32dffcd1f74a284b93580 (patch) | |
tree | 7452bd5c3545c2fa67a28aa013835fb4fa071baf /app/controllers/admin | |
parent | ee9173579ae56a3dbfe5afe9f9410c65bb327ca7 (diff) | |
download | gitlab-ce-a7b3560714b4d9cc4ab32dffcd1f74a284b93580.tar.gz |
Add latest changes from gitlab-org/gitlab@14-8-stable-eev14.8.0-rc42
Diffstat (limited to 'app/controllers/admin')
-rw-r--r-- | app/controllers/admin/application_settings_controller.rb | 9 | ||||
-rw-r--r-- | app/controllers/admin/instance_review_controller.rb | 2 | ||||
-rw-r--r-- | app/controllers/admin/runners_controller.rb | 18 | ||||
-rw-r--r-- | app/controllers/admin/users_controller.rb | 4 |
4 files changed, 19 insertions, 14 deletions
diff --git a/app/controllers/admin/application_settings_controller.rb b/app/controllers/admin/application_settings_controller.rb index 8644d95b96c..1d0930ba73c 100644 --- a/app/controllers/admin/application_settings_controller.rb +++ b/app/controllers/admin/application_settings_controller.rb @@ -27,7 +27,7 @@ class Admin::ApplicationSettingsController < Admin::ApplicationController feature_category :source_code_management, [:repository, :clear_repository_check_states] feature_category :continuous_integration, [:ci_cd, :reset_registration_token] - feature_category :service_ping, [:usage_data] + feature_category :service_ping, [:usage_data, :service_usage_data] feature_category :integrations, [:integrations] feature_category :pages, [:lets_encrypt_terms_of_service] @@ -52,6 +52,9 @@ class Admin::ApplicationSettingsController < Admin::ApplicationController @integrations = Integration.find_or_initialize_all_non_project_specific(Integration.for_instance).sort_by(&:title) end + def service_usage_data + end + def update perform_update end @@ -59,11 +62,11 @@ class Admin::ApplicationSettingsController < Admin::ApplicationController def usage_data respond_to do |format| format.html do - usage_data_json = Gitlab::Json.pretty_generate(Gitlab::UsageData.data) + usage_data_json = Gitlab::Json.pretty_generate(Gitlab::Usage::ServicePingReport.for(output: :all_metrics_values, cached: true)) render html: Gitlab::Highlight.highlight('payload.json', usage_data_json, language: 'json') end - format.json { render json: Gitlab::UsageData.to_json } + format.json { render json: Gitlab::Usage::ServicePingReport.for(output: :all_metrics_values, cached: true).to_json } end end diff --git a/app/controllers/admin/instance_review_controller.rb b/app/controllers/admin/instance_review_controller.rb index 5567ffbdc84..1ce6e66c6de 100644 --- a/app/controllers/admin/instance_review_controller.rb +++ b/app/controllers/admin/instance_review_controller.rb @@ -16,7 +16,7 @@ class Admin::InstanceReviewController < Admin::ApplicationController } if Gitlab::CurrentSettings.usage_ping_enabled? - data = ::Gitlab::UsageData.data + data = Gitlab::Usage::ServicePingReport.for(output: :all_metrics_values, cached: true) counts = data[:counts] result[:instance_review].merge!( diff --git a/app/controllers/admin/runners_controller.rb b/app/controllers/admin/runners_controller.rb index 16657612050..f7f78ab3229 100644 --- a/app/controllers/admin/runners_controller.rb +++ b/app/controllers/admin/runners_controller.rb @@ -34,7 +34,7 @@ class Admin::RunnersController < Admin::ApplicationController end def destroy - @runner.destroy + Ci::UnregisterRunnerService.new(@runner).execute redirect_to admin_runners_path, status: :found end @@ -85,7 +85,11 @@ class Admin::RunnersController < Admin::ApplicationController # rubocop: disable CodeReuse/ActiveRecord def assign_builds_and_projects - @builds = runner.builds.order('id DESC').preload_project_and_pipeline_project.first(30) + @builds = runner + .builds + .order_id_desc + .preload_project_and_pipeline_project.first(30) + @projects = if params[:search].present? ::Project.search(params[:search]) @@ -93,12 +97,10 @@ class Admin::RunnersController < Admin::ApplicationController Project.all end - ::Gitlab::Database.allow_cross_joins_across_databases(url: 'https://gitlab.com/gitlab-org/gitlab/-/issues/338659') do - @projects = @projects.where.not(id: runner.projects.select(:id)) if runner.projects.any? - @projects = @projects.allow_cross_joins_across_databases(url: 'https://gitlab.com/gitlab-org/gitlab/-/issues/338659') - @projects = @projects.inc_routes - @projects = @projects.page(params[:page]).per(30).without_count - end + runner_projects_ids = runner.runner_projects.pluck(:project_id) + @projects = @projects.where.not(id: runner_projects_ids) if runner_projects_ids.any? + @projects = @projects.inc_routes + @projects = @projects.page(params[:page]).per(30).without_count end # rubocop: enable CodeReuse/ActiveRecord end diff --git a/app/controllers/admin/users_controller.rb b/app/controllers/admin/users_controller.rb index b40e2affcee..c1fa104ffda 100644 --- a/app/controllers/admin/users_controller.rb +++ b/app/controllers/admin/users_controller.rb @@ -16,7 +16,7 @@ class Admin::UsersController < Admin::ApplicationController return redirect_to admin_cohorts_path if params[:tab] == 'cohorts' @users = User.filter_items(params[:filter]).order_name_asc - @users = @users.search_with_secondary_emails(params[:search_query]) if params[:search_query].present? + @users = @users.search(params[:search_query], with_private_emails: true) if params[:search_query].present? @users = users_with_included_associations(@users) @users = @users.sort_by_attribute(@sort = params[:sort]) @users = @users.page(params[:page]) @@ -370,7 +370,7 @@ class Admin::UsersController < Admin::ApplicationController end def check_ban_user_feature_flag - access_denied! unless Feature.enabled?(:ban_user_feature_flag) + access_denied! unless Feature.enabled?(:ban_user_feature_flag, default_enabled: :yaml) end def log_impersonation_event |