diff options
Diffstat (limited to 'app/controllers')
-rw-r--r-- | app/controllers/projects/blob_controller.rb | 26 | ||||
-rw-r--r-- | app/controllers/projects/performance_monitoring/dashboards_controller.rb | 114 | ||||
-rw-r--r-- | app/controllers/search_controller.rb | 2 |
3 files changed, 1 insertions, 141 deletions
diff --git a/app/controllers/projects/blob_controller.rb b/app/controllers/projects/blob_controller.rb index 388135726a0..56e4b22ded2 100644 --- a/app/controllers/projects/blob_controller.rb +++ b/app/controllers/projects/blob_controller.rb @@ -274,8 +274,6 @@ class Projects::BlobController < Projects::ApplicationController @last_commit = @repository.last_commit_for_path(@commit.id, @blob.path, literal_pathspec: true) @code_navigation_path = Gitlab::CodeNavigationPath.new(@project, @blob.commit_id).full_json_path_for(@blob.path) - allow_lfs_direct_download - render 'show' end @@ -320,30 +318,6 @@ class Projects::BlobController < Projects::ApplicationController current_user&.id end - def allow_lfs_direct_download - return unless directly_downloading_lfs_object? && content_security_policy_enabled? - return unless (lfs_object = @project.lfs_objects.find_by_oid(@blob.lfs_oid)) - - request.content_security_policy.directives['connect-src'] ||= [] - request.content_security_policy.directives['connect-src'] << lfs_src(lfs_object) - end - - def directly_downloading_lfs_object? - Gitlab.config.lfs.enabled && - !Gitlab.config.lfs.object_store.proxy_download && - @blob&.stored_externally? - end - - def content_security_policy_enabled? - Gitlab.config.gitlab.content_security_policy.enabled - end - - def lfs_src(lfs_object) - file = lfs_object.file - file = file.cdn_enabled_url(request.remote_ip) if file.respond_to?(:cdn_enabled_url) - file.url - end - alias_method :tracking_project_source, :project def tracking_namespace_source diff --git a/app/controllers/projects/performance_monitoring/dashboards_controller.rb b/app/controllers/projects/performance_monitoring/dashboards_controller.rb deleted file mode 100644 index 1255ec1dde2..00000000000 --- a/app/controllers/projects/performance_monitoring/dashboards_controller.rb +++ /dev/null @@ -1,114 +0,0 @@ -# frozen_string_literal: true - -module Projects - module PerformanceMonitoring - class DashboardsController < ::Projects::ApplicationController - include BlobHelper - - before_action :check_repository_available! - before_action :validate_required_params! - - rescue_from ActionController::ParameterMissing do |exception| - respond_error(http_status: :bad_request, message: _('Request parameter %{param} is missing.') % { param: exception.param }) - end - - feature_category :metrics - urgency :low - - def create - return not_found if Feature.enabled?(:remove_monitor_metrics) - - result = ::Metrics::Dashboard::CloneDashboardService.new(project, current_user, dashboard_params).execute - - if result[:status] == :success - respond_success(result) - else - respond_error(result) - end - end - - def update - return not_found if Feature.enabled?(:remove_monitor_metrics) - - result = ::Metrics::Dashboard::UpdateDashboardService.new(project, current_user, dashboard_params.merge(file_content_params)).execute - - if result[:status] == :success - respond_update_success(result) - else - respond_error(result) - end - end - - private - - def respond_success(result) - set_web_ide_link_notice(result.dig(:dashboard, :path)) - respond_to do |format| - format.json { render status: result.delete(:http_status), json: result } - end - end - - def respond_error(result) - respond_to do |format| - format.json { render json: { error: result[:message] }, status: result[:http_status] } - end - end - - def set_web_ide_link_notice(new_dashboard_path) - web_ide_link_start = "<a href=\"#{ide_edit_path(project, redirect_safe_branch_name, new_dashboard_path)}\">" - message = _("Your dashboard has been copied. You can %{web_ide_link_start}edit it here%{web_ide_link_end}.") % { web_ide_link_start: web_ide_link_start, web_ide_link_end: "</a>" } - flash[:notice] = message.html_safe - end - - def respond_update_success(result) - set_web_ide_link_update_notice(result.dig(:dashboard, :path)) - respond_to do |format| - format.json { render status: result.delete(:http_status), json: result } - end - end - - def set_web_ide_link_update_notice(new_dashboard_path) - web_ide_link_start = "<a href=\"#{ide_edit_path(project, redirect_safe_branch_name, new_dashboard_path)}\">" - message = _("Your dashboard has been updated. You can %{web_ide_link_start}edit it here%{web_ide_link_end}.") % { web_ide_link_start: web_ide_link_start, web_ide_link_end: "</a>" } - flash[:notice] = message.html_safe - end - - def validate_required_params! - params.require(%i[branch file_name dashboard commit_message]) - end - - def redirect_safe_branch_name - repository.find_branch(params[:branch]).name - end - - def dashboard_params - params.permit(%i[branch file_name dashboard commit_message]).to_h - end - - def file_content_params - params.permit( - file_content: [ - :dashboard, - panel_groups: [ - :group, - :priority, - panels: [ - :type, - :title, - :y_label, - :weight, - metrics: [ - :id, - :unit, - :label, - :query, - :query_range - ] - ] - ] - ] - ) - end - end - end -end diff --git a/app/controllers/search_controller.rb b/app/controllers/search_controller.rb index 2d6b51a49fc..af62ff8313d 100644 --- a/app/controllers/search_controller.rb +++ b/app/controllers/search_controller.rb @@ -252,7 +252,7 @@ class SearchController < ApplicationController end def search_type - 'basic' + search_service.search_type end end |