diff options
Diffstat (limited to 'app/controllers/admin')
-rw-r--r-- | app/controllers/admin/clusters/applications_controller.rb | 11 | ||||
-rw-r--r-- | app/controllers/admin/integrations_controller.rb | 17 | ||||
-rw-r--r-- | app/controllers/admin/runner_projects_controller.rb | 2 | ||||
-rw-r--r-- | app/controllers/admin/runners_controller.rb | 8 | ||||
-rw-r--r-- | app/controllers/admin/services_controller.rb | 47 | ||||
-rw-r--r-- | app/controllers/admin/users_controller.rb | 11 |
6 files changed, 20 insertions, 76 deletions
diff --git a/app/controllers/admin/clusters/applications_controller.rb b/app/controllers/admin/clusters/applications_controller.rb deleted file mode 100644 index 7400cc16175..00000000000 --- a/app/controllers/admin/clusters/applications_controller.rb +++ /dev/null @@ -1,11 +0,0 @@ -# frozen_string_literal: true - -class Admin::Clusters::ApplicationsController < Clusters::ApplicationsController - include EnforcesAdminAuthentication - - private - - def clusterable - @clusterable ||= InstanceClusterablePresenter.fabricate(Clusters::Instance.new, current_user: current_user) - end -end diff --git a/app/controllers/admin/integrations_controller.rb b/app/controllers/admin/integrations_controller.rb index 76c1c46e0e8..a3eb24b9b6f 100644 --- a/app/controllers/admin/integrations_controller.rb +++ b/app/controllers/admin/integrations_controller.rb @@ -2,19 +2,26 @@ class Admin::IntegrationsController < Admin::ApplicationController include IntegrationsActions - include IntegrationsHelper before_action :not_found, unless: -> { instance_level_integrations? } feature_category :integrations + def overrides + respond_to do |format| + format.json do + projects = Project.with_active_integration(integration.class).merge(::Integration.with_custom_settings) + serializer = ::Integrations::ProjectSerializer.new.with_pagination(request, response) + + render json: serializer.represent(projects) + end + format.html { render 'shared/integrations/overrides' } + end + end + private def find_or_initialize_non_project_specific_integration(name) Integration.find_or_initialize_non_project_specific_integration(name, instance: true) end - - def scoped_edit_integration_path(integration) - edit_admin_application_settings_integration_path(integration) - end end diff --git a/app/controllers/admin/runner_projects_controller.rb b/app/controllers/admin/runner_projects_controller.rb index 7761ffaac84..3b408de5f01 100644 --- a/app/controllers/admin/runner_projects_controller.rb +++ b/app/controllers/admin/runner_projects_controller.rb @@ -3,7 +3,7 @@ class Admin::RunnerProjectsController < Admin::ApplicationController before_action :project, only: [:create] - feature_category :continuous_integration + feature_category :runner def create @runner = Ci::Runner.find(params[:runner_project][:runner_id]) diff --git a/app/controllers/admin/runners_controller.rb b/app/controllers/admin/runners_controller.rb index d1c91d9617f..8c74352a179 100644 --- a/app/controllers/admin/runners_controller.rb +++ b/app/controllers/admin/runners_controller.rb @@ -4,19 +4,11 @@ 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 :runner - NUMBER_OF_RUNNERS_PER_PAGE = 30 - def index - finder = Ci::RunnersFinder.new(current_user: current_user, params: params) - @runners = finder.execute.page(params[:page]).per(NUMBER_OF_RUNNERS_PER_PAGE) @active_runners_count = Ci::Runner.online.count - @sort = finder.sort_key end def show diff --git a/app/controllers/admin/services_controller.rb b/app/controllers/admin/services_controller.rb deleted file mode 100644 index d34773ee4dc..00000000000 --- a/app/controllers/admin/services_controller.rb +++ /dev/null @@ -1,47 +0,0 @@ -# frozen_string_literal: true - -class Admin::ServicesController < Admin::ApplicationController - include Integrations::Params - - before_action :integration, only: [:edit, :update] - before_action :disable_query_limiting, only: [:index] - - feature_category :integrations - - def index - @activated_services = Integration.for_template.active.sort_by(&:title) - @existing_instance_types = Integration.for_instance.pluck(:type) # rubocop: disable CodeReuse/ActiveRecord - end - - def edit - if integration.nil? || Integration.instance_exists_for?(integration.type) - redirect_to admin_application_settings_services_path, - alert: "Service is unknown or it doesn't exist" - end - end - - def update - if integration.update(integration_params[:integration]) - PropagateServiceTemplateWorker.perform_async(integration.id) if integration.active? # rubocop:disable CodeReuse/Worker - - redirect_to admin_application_settings_services_path, - notice: 'Application settings saved successfully' - else - render :edit - end - end - - private - - # rubocop: disable CodeReuse/ActiveRecord - def integration - @integration ||= Integration.find_by(id: params[:id], template: true) - @service ||= @integration # TODO: https://gitlab.com/gitlab-org/gitlab/-/issues/329759 - end - alias_method :service, :integration - # rubocop: enable CodeReuse/ActiveRecord - - def disable_query_limiting - Gitlab::QueryLimiting.disable!('https://gitlab.com/gitlab-org/gitlab/-/issues/220357') - end -end diff --git a/app/controllers/admin/users_controller.rb b/app/controllers/admin/users_controller.rb index 145b4d10b16..3801906635f 100644 --- a/app/controllers/admin/users_controller.rb +++ b/app/controllers/admin/users_controller.rb @@ -26,9 +26,10 @@ class Admin::UsersController < Admin::ApplicationController def show end + # rubocop: disable CodeReuse/ActiveRecord def projects - @personal_projects = user.personal_projects - @joined_projects = user.projects.joined(@user) + @personal_projects = user.personal_projects.includes(:topics) + @joined_projects = user.projects.joined(@user).includes(:topics) end def keys @@ -136,7 +137,9 @@ class Admin::UsersController < Admin::ApplicationController end def unban - if update_user { |user| user.activate } + result = Users::UnbanService.new(current_user).execute(user) + + if result[:status] == :success redirect_back_or_admin_user(notice: _("Successfully unbanned")) else redirect_back_or_admin_user(alert: _("Error occurred. User was not unbanned")) @@ -145,7 +148,7 @@ class Admin::UsersController < Admin::ApplicationController def unlock if update_user { |user| user.unlock_access! } - redirect_back_or_admin_user(alert: _("Successfully unlocked")) + redirect_back_or_admin_user(notice: _("Successfully unlocked")) else redirect_back_or_admin_user(alert: _("Error occurred. User was not unlocked")) end |