Commit 4c1368a9 authored by Sean McGivern's avatar Sean McGivern

Merge branch 'controller-feature-categories-a' into 'master'

Controller feature categories: A [RUN AS-IF-FOSS]

See merge request gitlab-org/gitlab!44283
parents 8054d618 fbb0b9ba
......@@ -3,6 +3,8 @@
class AbuseReportsController < ApplicationController
before_action :set_user, only: [:new]
feature_category :users
def new
@abuse_report = AbuseReport.new
@abuse_report.user_id = @user.id
......
# frozen_string_literal: true
class Admin::AbuseReportsController < Admin::ApplicationController
feature_category :users
def index
@abuse_reports = AbuseReportsFinder.new(params).execute
end
......
......@@ -3,6 +3,8 @@
class Admin::AppearancesController < Admin::ApplicationController
before_action :set_appearance, except: :create
feature_category :navigation
def show
end
......
......@@ -17,6 +17,24 @@ class Admin::ApplicationSettingsController < Admin::ApplicationController
push_frontend_feature_flag(:ci_instance_variables_ui, default_enabled: true)
end
feature_category :not_owned, [
: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
]
feature_category :source_code_management, [:repository, :clear_repository_check_states]
feature_category :continuous_integration, [:ci_cd, :reset_registration_token]
feature_category :collection, [:usage_data]
feature_category :integrations, [:integrations]
feature_category :pages, [:lets_encrypt_terms_of_service]
VALID_SETTING_PANELS = %w(general repository
ci_cd reporting metrics_and_profiling
network preferences).freeze
......
......@@ -6,6 +6,8 @@ class Admin::ApplicationsController < Admin::ApplicationController
before_action :set_application, only: [:show, :edit, :update, :destroy]
before_action :load_scopes, only: [:new, :create, :edit, :update]
feature_category :authentication_and_authorization
def index
applications = ApplicationsFinder.new.execute
@applications = Kaminari.paginate_array(applications).page(params[:page])
......
# frozen_string_literal: true
class Admin::BackgroundJobsController < Admin::ApplicationController
feature_category :not_owned
end
......@@ -5,6 +5,8 @@ class Admin::BroadcastMessagesController < Admin::ApplicationController
before_action :finder, only: [:edit, :update, :destroy]
feature_category :navigation
# rubocop: disable CodeReuse/ActiveRecord
def index
@broadcast_messages = BroadcastMessage.order(ends_at: :desc).page(params[:page])
......
# frozen_string_literal: true
class Admin::Ci::VariablesController < Admin::ApplicationController
feature_category :continuous_integration
def show
respond_to do |format|
format.json { render_instance_variables }
......
......@@ -5,6 +5,8 @@ class Admin::CohortsController < Admin::ApplicationController
track_unique_visits :index, target_id: 'i_analytics_cohorts'
feature_category :instance_statistics
def index
if Gitlab::CurrentSettings.usage_ping_enabled
cohorts_results = Rails.cache.fetch('cohorts', expires_in: 1.day) do
......
......@@ -6,6 +6,8 @@ class Admin::DashboardController < Admin::ApplicationController
COUNTED_ITEMS = [Project, User, Group].freeze
feature_category :not_owned
# rubocop: disable CodeReuse/ActiveRecord
def index
@counts = Gitlab::Database::Count.approximate_counts(COUNTED_ITEMS)
......
......@@ -4,6 +4,8 @@ class Admin::DeployKeysController < Admin::ApplicationController
before_action :deploy_keys, only: [:index]
before_action :deploy_key, only: [:destroy, :edit, :update]
feature_category :continuous_delivery
def index
end
......
......@@ -5,6 +5,8 @@ class Admin::DevOpsReportController < Admin::ApplicationController
track_unique_visits :show, target_id: 'i_analytics_dev_ops_score'
feature_category :devops_reports
# rubocop: disable CodeReuse/ActiveRecord
def show
@metric = DevOpsReport::Metric.order(:created_at).last&.present
......
# frozen_string_literal: true
class Admin::GitalyServersController < Admin::ApplicationController
feature_category :gitaly
def index
@gitaly_servers = Gitaly::Server.all
end
......
......@@ -5,6 +5,8 @@ class Admin::GroupsController < Admin::ApplicationController
before_action :group, only: [:edit, :update, :destroy, :project_update, :members_update]
feature_category :subgroups
def index
@groups = groups.sort_by_attribute(@sort = params[:sort])
@groups = @groups.search(params[:name]) if params[:name].present?
......
# frozen_string_literal: true
class Admin::HealthCheckController < Admin::ApplicationController
feature_category :not_owned
def show
@errors = HealthCheck::Utils.process_checks(checks)
end
......
......@@ -8,6 +8,8 @@ class Admin::HookLogsController < Admin::ApplicationController
respond_to :html
feature_category :integrations
def show
end
......
......@@ -5,6 +5,8 @@ class Admin::HooksController < Admin::ApplicationController
before_action :hook_logs, only: :edit
feature_category :integrations
def index
@hooks = SystemHook.all
@hook = SystemHook.new
......
......@@ -4,6 +4,8 @@ class Admin::IdentitiesController < Admin::ApplicationController
before_action :user
before_action :identity, except: [:index, :new, :create]
feature_category :authentication_and_authorization
def new
@identity = Identity.new
end
......
......@@ -3,6 +3,8 @@
class Admin::ImpersonationTokensController < Admin::ApplicationController
before_action :user
feature_category :authentication_and_authorization
def index
set_index_vars
end
......
......@@ -4,6 +4,8 @@ class Admin::ImpersonationsController < Admin::ApplicationController
skip_before_action :authenticate_admin!
before_action :authenticate_impersonator!
feature_category :authentication_and_authorization
def destroy
original_user = stop_impersonation
redirect_to admin_user_path(original_user), status: :found
......
......@@ -7,6 +7,8 @@ class Admin::InstanceStatisticsController < Admin::ApplicationController
track_unique_visits :index, target_id: 'i_analytics_instance_statistics'
feature_category :instance_statistics
def index
end
......
......@@ -4,6 +4,8 @@ class Admin::IntegrationsController < Admin::ApplicationController
include IntegrationsActions
include ServicesHelper
feature_category :integrations
private
def find_or_initialize_integration(name)
......
......@@ -3,6 +3,8 @@
class Admin::JobsController < Admin::ApplicationController
BUILDS_PER_PAGE = 30
feature_category :continuous_integration
def index
# We need all builds for tabs counters
@all_builds = Ci::JobsFinder.new(current_user: current_user).execute
......
......@@ -3,6 +3,8 @@
class Admin::KeysController < Admin::ApplicationController
before_action :user, only: [:show, :destroy]
feature_category :authentication_and_authorization
def show
@key = user.keys.find(params[:id])
......
......@@ -3,6 +3,8 @@
class Admin::LabelsController < Admin::ApplicationController
before_action :set_label, only: [:show, :edit, :update, :destroy]
feature_category :issue_tracking
def index
@labels = Label.templates.page(params[:page])
end
......
......@@ -5,6 +5,8 @@ class Admin::PlanLimitsController < Admin::ApplicationController
before_action :set_plan_limits
feature_category :not_owned
def create
redirect_path = referer_path(request) || general_admin_application_settings_path
......
......@@ -6,6 +6,9 @@ class Admin::ProjectsController < Admin::ApplicationController
before_action :project, only: [:show, :transfer, :repository_check, :destroy]
before_action :group, only: [:show, :transfer]
feature_category :projects, [:index, :show, :transfer, :destroy]
feature_category :source_code_management, [:repository_check]
def index
params[:sort] ||= 'latest_activity_desc'
@sort = params[:sort]
......
# frozen_string_literal: true
class Admin::RequestsProfilesController < Admin::ApplicationController
feature_category :not_owned
def index
@profile_token = Gitlab::RequestProfiler.profile_token
@profiles = Gitlab::RequestProfiler.all.group_by(&:request_path)
......
......@@ -3,6 +3,8 @@
class Admin::RunnerProjectsController < Admin::ApplicationController
before_action :project, only: [:create]
feature_category :continuous_integration
def create
@runner = Ci::Runner.find(params[:runner_project][:runner_id])
......
......@@ -5,6 +5,8 @@ class Admin::RunnersController < Admin::ApplicationController
before_action :runner, except: [:index, :tag_list, :runner_setup_scripts]
feature_category :continuous_integration
def index
finder = Ci::RunnersFinder.new(current_user: current_user, params: params)
@runners = finder.execute
......
......@@ -4,6 +4,8 @@ class Admin::Serverless::DomainsController < Admin::ApplicationController
before_action :check_feature_flag
before_action :domain, only: [:update, :verify, :destroy]
feature_category :serverless
def index
@domain = PagesDomain.instance_serverless.first_or_initialize
end
......
......@@ -6,6 +6,8 @@ class Admin::ServicesController < Admin::ApplicationController
before_action :service, only: [:edit, :update]
before_action :whitelist_query_limiting, only: [:index]
feature_category :integrations
def index
@services = Service.find_or_create_templates.sort_by(&:title)
@existing_instance_types = Service.for_instance.pluck(:type) # rubocop: disable CodeReuse/ActiveRecord
......
......@@ -7,6 +7,8 @@ class Admin::SessionsController < ApplicationController
before_action :user_is_admin!
feature_category :authentication_and_authorization
def new
if current_user_mode.admin_mode?
redirect_to redirect_path, notice: _('Admin mode already enabled')
......
# frozen_string_literal: true
class Admin::SpamLogsController < Admin::ApplicationController
feature_category :not_owned
# rubocop: disable CodeReuse/ActiveRecord
def index
@spam_logs = SpamLog.order(id: :desc).page(params[:page])
......
# frozen_string_literal: true
class Admin::SystemInfoController < Admin::ApplicationController
feature_category :not_owned
EXCLUDED_MOUNT_OPTIONS = %w[
nobrowse
read-only
......
......@@ -7,6 +7,8 @@ class Admin::UsersController < Admin::ApplicationController
before_action :check_impersonation_availability, only: :impersonate
before_action :ensure_destroy_prerequisites_met, only: [:destroy]
feature_category :users
def index
@users = User.filter_items(params[:filter]).order_name_asc
@users = @users.search_with_secondary_emails(params[:search_query]) if params[:search_query].present?
......
......@@ -3,6 +3,12 @@
class AutocompleteController < ApplicationController
skip_before_action :authenticate_user!, only: [:users, :award_emojis, :merge_request_target_branches]
feature_category :users, [:users, :user]
feature_category :projects, [:projects]
feature_category :issue_tracking, [:award_emojis]
feature_category :code_review, [:merge_request_target_branches]
feature_category :continuous_delivery, [:deploy_keys_with_owners]
def users
group = Autocomplete::GroupFinder
.new(current_user, project, params)
......
......@@ -8,6 +8,8 @@ class Clusters::BaseController < ApplicationController
helper_method :clusterable
feature_category :kubernetes_management
private
def cluster
......
......@@ -3,6 +3,8 @@
class Admin::AuditLogReportsController < Admin::ApplicationController
before_action :validate_audit_log_reports_available!
feature_category :audit_events
def index
csv_data = AuditEvents::ExportCsvService.new(audit_log_reports_params).csv_data
......
......@@ -12,6 +12,8 @@ class Admin::AuditLogsController < Admin::ApplicationController
track_unique_visits :index, target_id: 'i_compliance_audit_events'
feature_category :audit_events
PER_PAGE = 25
def index
......
......@@ -11,6 +11,8 @@ class Admin::CredentialsController < Admin::ApplicationController
track_unique_visits :index, target_id: 'i_compliance_credential_inventory'
feature_category :compliance_management
private
def check_license_credentials_inventory_available!
......
# frozen_string_literal: true
class Admin::ElasticsearchController < Admin::ApplicationController
feature_category :global_search
# POST
# Scheduling indexing jobs
def enqueue_index
......
......@@ -6,6 +6,8 @@ class Admin::EmailsController < Admin::ApplicationController
before_action :check_license_send_emails_from_admin_area_available!
before_action :check_rate_limit!, only: [:create]
feature_category :not_owned
def show
end
......
......@@ -3,6 +3,8 @@
class Admin::Geo::ApplicationController < Admin::ApplicationController
helper ::EE::GeoHelper
feature_category :geo_replication
protected
def check_license!
......
......@@ -4,6 +4,8 @@ class Admin::Geo::SettingsController < Admin::ApplicationSettingsController
helper ::EE::GeoHelper
before_action :check_license!, except: :show
feature_category :geo_replication
def show
end
......
# frozen_string_literal: true
class Admin::InstanceReviewController < Admin::ApplicationController
feature_category :instance_statistics
def index
redirect_to("#{EE::SUBSCRIPTIONS_URL}/instance_review?#{instance_review_params}")
end
......
......@@ -7,6 +7,8 @@ module Admin
before_action :require_license, only: :show
feature_category :collection
def show
historical_data = HistoricalData.in_license_term(license)
......
......@@ -8,6 +8,8 @@ class Admin::LicensesController < Admin::ApplicationController
respond_to :html
feature_category :provision
def show
if @license.present? || License.future_dated_only?
@licenses = License.history
......
......@@ -7,6 +7,8 @@ class Admin::PushRulesController < Admin::ApplicationController
respond_to :html
feature_category :source_code_management
def show
end
......
......@@ -11,6 +11,9 @@ module EE
prepended do
before_action :elasticsearch_reindexing_task, only: [:general]
feature_category :provision, [:seat_link_payload]
feature_category :source_code_management, [:templates]
def elasticsearch_reindexing_task
@elasticsearch_reindexing_task = Elastic::ReindexingTask.last
end
......
......@@ -2,6 +2,13 @@
module EE
module AutocompleteController
extend ::ActiveSupport::Concern
prepended do
feature_category :subgroups, [:project_groups, :namespace_routes]
feature_category :projects, [:project_routes]
end
def project_groups
groups = ::Autocomplete::ProjectInvitedGroupsFinder
.new(current_user, params)
......
......@@ -18,7 +18,7 @@ RSpec.describe "Every controller" do
.select { |route| route[:controller].present? && route[:action].present? }
.map { |route| [constantize_controller(route[:controller]), route[:action]] }
.select { |(controller, action)| controller&.include?(ControllerWithFeatureCategory) }
.reject { |(controller, action)| controller == Devise::UnlocksController }
.reject { |(controller, action)| controller == ApplicationController || controller == Devise::UnlocksController }
end
let_it_be(:routes_without_category) do
......@@ -29,7 +29,7 @@ RSpec.describe "Every controller" do
'H', 'I', 'J', 'K', 'L',
'M', 'N', 'O', 'Q', 'R',
'S', 'T', 'U', 'V', 'W',
'X', 'Y', 'Z',
'X', 'Y', 'Z', 'A',
'Projects::MergeRequestsController')
"#{controller}##{action}"
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment