diff options
author | GitLab Bot <gitlab-bot@gitlab.com> | 2020-08-20 18:42:06 +0000 |
---|---|---|
committer | GitLab Bot <gitlab-bot@gitlab.com> | 2020-08-20 18:42:06 +0000 |
commit | 6e4e1050d9dba2b7b2523fdd1768823ab85feef4 (patch) | |
tree | 78be5963ec075d80116a932011d695dd33910b4e /config/routes | |
parent | 1ce776de4ae122aba3f349c02c17cebeaa8ecf07 (diff) | |
download | gitlab-ce-6e4e1050d9dba2b7b2523fdd1768823ab85feef4.tar.gz |
Add latest changes from gitlab-org/gitlab@13-3-stable-ee
Diffstat (limited to 'config/routes')
-rw-r--r-- | config/routes/group.rb | 44 | ||||
-rw-r--r-- | config/routes/help.rb | 1 | ||||
-rw-r--r-- | config/routes/import.rb | 4 | ||||
-rw-r--r-- | config/routes/pipelines.rb | 1 | ||||
-rw-r--r-- | config/routes/profile.rb | 2 | ||||
-rw-r--r-- | config/routes/project.rb | 130 | ||||
-rw-r--r-- | config/routes/repository.rb | 1 | ||||
-rw-r--r-- | config/routes/snippets.rb | 13 |
8 files changed, 111 insertions, 85 deletions
diff --git a/config/routes/group.rb b/config/routes/group.rb index 408c57eaa94..e07ed0fab05 100644 --- a/config/routes/group.rb +++ b/config/routes/group.rb @@ -5,23 +5,27 @@ constraints(::Constraints::GroupUrlConstrainer.new) do controller: :groups, constraints: { id: Gitlab::PathRegex.full_namespace_route_regex, format: /(html|json|atom|ics)/ }) do scope(path: '-') do - get :edit, as: :edit_group - get :issues, as: :issues_group_calendar, action: :issues_calendar, constraints: lambda { |req| req.format == :ics } - get :issues, as: :issues_group - get :merge_requests, as: :merge_requests_group - get :projects, as: :projects_group - get :details, as: :details_group - get :activity, as: :activity_group - put :transfer, as: :transfer_group - post :export, as: :export_group - get :download_export, as: :download_export_group + # These routes are legit and the cop rule will be improved in + # https://gitlab.com/gitlab-org/gitlab/-/issues/230703 + get :edit, as: :edit_group # rubocop:disable Cop/PutGroupRoutesUnderScope + get :issues, as: :issues_group_calendar, action: :issues_calendar, constraints: lambda { |req| req.format == :ics } # rubocop:disable Cop/PutGroupRoutesUnderScope + get :issues, as: :issues_group # rubocop:disable Cop/PutGroupRoutesUnderScope + get :merge_requests, as: :merge_requests_group # rubocop:disable Cop/PutGroupRoutesUnderScope + get :projects, as: :projects_group # rubocop:disable Cop/PutGroupRoutesUnderScope + get :details, as: :details_group # rubocop:disable Cop/PutGroupRoutesUnderScope + get :activity, as: :activity_group # rubocop:disable Cop/PutGroupRoutesUnderScope + put :transfer, as: :transfer_group # rubocop:disable Cop/PutGroupRoutesUnderScope + post :export, as: :export_group # rubocop:disable Cop/PutGroupRoutesUnderScope + get :download_export, as: :download_export_group # rubocop:disable Cop/PutGroupRoutesUnderScope # TODO: Remove as part of refactor in https://gitlab.com/gitlab-org/gitlab-foss/issues/49693 - get 'shared', action: :show, as: :group_shared - get 'archived', action: :show, as: :group_archived + get 'shared', action: :show, as: :group_shared # rubocop:disable Cop/PutGroupRoutesUnderScope + get 'archived', action: :show, as: :group_archived # rubocop:disable Cop/PutGroupRoutesUnderScope end - get '/', action: :show, as: :group_canonical + # These routes are legit and the cop rule will be improved in + # https://gitlab.com/gitlab-org/gitlab/-/issues/230703 + get '/', action: :show, as: :group_canonical # rubocop:disable Cop/PutGroupRoutesUnderScope end scope(path: 'groups/*group_id/-', @@ -55,6 +59,8 @@ constraints(::Constraints::GroupUrlConstrainer.new) do post :toggle_subscription, on: :member end + resources :packages, only: [:index] + resources :milestones, constraints: { id: %r{[^/]+} } do member do get :merge_requests @@ -63,6 +69,8 @@ constraints(::Constraints::GroupUrlConstrainer.new) do end end + resources :releases, only: [:index] + resources :deploy_tokens, constraints: { id: /\d+/ }, only: [] do member do put :revoke @@ -104,9 +112,11 @@ constraints(::Constraints::GroupUrlConstrainer.new) do as: :group, constraints: { id: Gitlab::PathRegex.full_namespace_route_regex, format: /(html|json|atom)/ }, controller: :groups) do - get '/', action: :show - patch '/', action: :update - put '/', action: :update - delete '/', action: :destroy + # These routes are legit and the cop rule will be improved in + # https://gitlab.com/gitlab-org/gitlab/-/issues/230703 + get '/', action: :show # rubocop:disable Cop/PutGroupRoutesUnderScope + patch '/', action: :update # rubocop:disable Cop/PutGroupRoutesUnderScope + put '/', action: :update # rubocop:disable Cop/PutGroupRoutesUnderScope + delete '/', action: :destroy # rubocop:disable Cop/PutGroupRoutesUnderScope end end diff --git a/config/routes/help.rb b/config/routes/help.rb index 2ea8bfd7aed..446310ba314 100644 --- a/config/routes/help.rb +++ b/config/routes/help.rb @@ -1,5 +1,4 @@ get 'help' => 'help#index' get 'help/shortcuts' => 'help#shortcuts' -get 'help/ui' => 'help#ui' get 'help/instance_configuration' => 'help#instance_configuration' get 'help/*path' => 'help#show', as: :help_page diff --git a/config/routes/import.rb b/config/routes/import.rb index 1dc27d489f0..0d3f202ba55 100644 --- a/config/routes/import.rb +++ b/config/routes/import.rb @@ -8,6 +8,8 @@ Devise.omniauth_providers.map(&:downcase).each do |provider| end namespace :import do + resources :available_namespaces, only: [:index], controller: :available_namespaces + resource :github, only: [:create, :new], controller: :github do post :personal_access_token get :status @@ -69,7 +71,7 @@ namespace :import do resource :manifest, only: [:create, :new], controller: :manifest do get :status - get :jobs + get :realtime_changes post :upload end diff --git a/config/routes/pipelines.rb b/config/routes/pipelines.rb index c7f9bf8791c..605e82af23a 100644 --- a/config/routes/pipelines.rb +++ b/config/routes/pipelines.rb @@ -19,7 +19,6 @@ resources :pipelines, only: [:index, :new, :create, :show, :destroy] do get :failures get :status get :test_report - get :test_reports_count end resources :stages, only: [], param: :name, controller: 'pipelines/stages' do diff --git a/config/routes/profile.rb b/config/routes/profile.rb index fcf8812ee2e..6126a3b593b 100644 --- a/config/routes/profile.rb +++ b/config/routes/profile.rb @@ -22,7 +22,7 @@ resource :profile, only: [:show, :update] do end resource :notifications, only: [:show, :update] do - resources :groups, only: :update + resources :groups, only: :update, constraints: { id: Gitlab::PathRegex.full_namespace_route_regex } end resource :password, only: [:new, :create, :edit, :update] do diff --git a/config/routes/project.rb b/config/routes/project.rb index 3bd72dbf87c..d02dc974434 100644 --- a/config/routes/project.rb +++ b/config/routes/project.rb @@ -25,11 +25,24 @@ constraints(::Constraints::ProjectUrlConstrainer.new) do # Use this scope for all new project routes. scope '-' do get 'archive/*id', constraints: { format: Gitlab::PathRegex.archive_formats_regex, id: /.+?/ }, to: 'repositories#archive', as: 'archive' - get 'metrics(/:dashboard_path)', constraints: { dashboard_path: /.+\.yml/ }, + get 'metrics(/:dashboard_path)(/:page)', constraints: { dashboard_path: /.+\.yml/, page: 'panel/new' }, to: 'metrics_dashboard#show', as: :metrics_dashboard, format: false + namespace :metrics, module: :metrics do + namespace :dashboards do + post :builder, to: 'builder#panel_preview' + end + end + resources :artifacts, only: [:index, :destroy] + resources :packages, only: [:index, :show, :destroy], module: :packages + resources :package_files, only: [], module: :packages do + member do + get :download + end + end + resources :jobs, only: [:index, :show], constraints: { id: /\d+/ } do collection do resources :artifacts, only: [] do @@ -291,10 +304,22 @@ constraints(::Constraints::ProjectUrlConstrainer.new) do get 'details', on: :member end + post 'incidents/integrations/pagerduty', to: 'incident_management/pager_duty_incidents#create' + + resources :incidents, only: [:index] + namespace :error_tracking do resources :projects, only: :index end + resources :product_analytics, only: [:index] do + collection do + get :setup + get :test + get :graphs + end + end + resources :error_tracking, only: [:index], controller: :error_tracking do collection do get ':issue_id/details', @@ -335,6 +360,13 @@ constraints(::Constraints::ProjectUrlConstrainer.new) do namespace :import do resource :jira, only: [:show], controller: :jira end + + resources :snippets, concerns: :awardable, constraints: { id: /\d+/ } do + member do + get :raw + post :mark_as_spam + end + end end # End of the /-/ scope. @@ -344,18 +376,18 @@ constraints(::Constraints::ProjectUrlConstrainer.new) do # # Service Desk # - get '/service_desk' => 'service_desk#show', as: :service_desk - put '/service_desk' => 'service_desk#update', as: :service_desk_refresh + get '/service_desk' => 'service_desk#show', as: :service_desk # rubocop:todo Cop/PutProjectRoutesUnderScope + put '/service_desk' => 'service_desk#update', as: :service_desk_refresh # rubocop:todo Cop/PutProjectRoutesUnderScope # # Templates # - get '/templates/:template_type/:key' => 'templates#show', + get '/templates/:template_type/:key' => 'templates#show', # rubocop:todo Cop/PutProjectRoutesUnderScope as: :template, defaults: { format: 'json' }, constraints: { key: %r{[^/]+}, template_type: %r{issue|merge_request}, format: 'json' } - get '/description_templates/names/:template_type', + get '/description_templates/names/:template_type', # rubocop:todo Cop/PutProjectRoutesUnderScope to: 'templates#names', as: :template_names, defaults: { format: 'json' }, @@ -364,61 +396,39 @@ constraints(::Constraints::ProjectUrlConstrainer.new) do resource :pages, only: [:show, :update, :destroy] do # rubocop: disable Cop/PutProjectRoutesUnderScope resources :domains, except: :index, controller: 'pages_domains', constraints: { id: %r{[^/]+} } do # rubocop: disable Cop/PutProjectRoutesUnderScope member do - post :verify - post :retry_auto_ssl - delete :clean_certificate - end - end - end - - resources :snippets, concerns: :awardable, constraints: { id: /\d+/ } do # rubocop: disable Cop/PutProjectRoutesUnderScope - member do - get :raw - post :mark_as_spam - end - end - - # Serve snippet routes under /-/snippets. - # To ensure an old unscoped routing is used for the UI we need to - # add prefix 'as' to the scope routing and place it below original routing. - # Issue https://gitlab.com/gitlab-org/gitlab/-/issues/29572 - scope '-', as: :scoped do - resources :snippets, concerns: :awardable, constraints: { id: /\d+/ } do # rubocop: disable Cop/PutProjectRoutesUnderScope - member do - get :raw - post :mark_as_spam + post :verify # rubocop:todo Cop/PutProjectRoutesUnderScope + post :retry_auto_ssl # rubocop:todo Cop/PutProjectRoutesUnderScope + delete :clean_certificate # rubocop:todo Cop/PutProjectRoutesUnderScope end end end namespace :prometheus do resources :alerts, constraints: { id: /\d+/ }, only: [:index, :create, :show, :update, :destroy] do # rubocop: disable Cop/PutProjectRoutesUnderScope - post :notify, on: :collection + post :notify, on: :collection # rubocop:todo Cop/PutProjectRoutesUnderScope member do - get :metrics_dashboard + get :metrics_dashboard # rubocop:todo Cop/PutProjectRoutesUnderScope end end resources :metrics, constraints: { id: %r{[^\/]+} }, only: [:index, :new, :create, :edit, :update, :destroy] do # rubocop: disable Cop/PutProjectRoutesUnderScope - get :active_common, on: :collection - post :validate_query, on: :collection + get :active_common, on: :collection # rubocop:todo Cop/PutProjectRoutesUnderScope + post :validate_query, on: :collection # rubocop:todo Cop/PutProjectRoutesUnderScope end end - post 'alerts/notify', to: 'alerting/notifications#create' - - post 'incidents/pagerduty', to: 'incident_management/pager_duty_incidents#create' + post 'alerts/notify', to: 'alerting/notifications#create' # rubocop:todo Cop/PutProjectRoutesUnderScope draw :legacy_builds resources :hooks, only: [:index, :create, :edit, :update, :destroy], constraints: { id: /\d+/ } do # rubocop: disable Cop/PutProjectRoutesUnderScope member do - post :test + post :test # rubocop:todo Cop/PutProjectRoutesUnderScope end resources :hook_logs, only: [:show] do # rubocop: disable Cop/PutProjectRoutesUnderScope member do - post :retry + post :retry # rubocop:todo Cop/PutProjectRoutesUnderScope end end end @@ -435,7 +445,7 @@ constraints(::Constraints::ProjectUrlConstrainer.new) do resources :tags, only: [:index, :destroy], # rubocop: disable Cop/PutProjectRoutesUnderScope constraints: { id: Gitlab::Regex.container_registry_tag_regex } do collection do - delete :bulk_destroy + delete :bulk_destroy # rubocop:todo Cop/PutProjectRoutesUnderScope end end end @@ -444,32 +454,32 @@ constraints(::Constraints::ProjectUrlConstrainer.new) do resources :notes, only: [:create, :destroy, :update], concerns: :awardable, constraints: { id: /\d+/ } do # rubocop: disable Cop/PutProjectRoutesUnderScope member do - delete :delete_attachment - post :resolve - delete :resolve, action: :unresolve + delete :delete_attachment # rubocop:todo Cop/PutProjectRoutesUnderScope + post :resolve # rubocop:todo Cop/PutProjectRoutesUnderScope + delete :resolve, action: :unresolve # rubocop:todo Cop/PutProjectRoutesUnderScope end end - get 'noteable/:target_type/:target_id/notes' => 'notes#index', as: 'noteable_notes' + get 'noteable/:target_type/:target_id/notes' => 'notes#index', as: 'noteable_notes' # rubocop:todo Cop/PutProjectRoutesUnderScope resources :todos, only: [:create] # rubocop: disable Cop/PutProjectRoutesUnderScope resources :uploads, only: [:create] do # rubocop: disable Cop/PutProjectRoutesUnderScope collection do - get ":secret/:filename", action: :show, as: :show, constraints: { filename: %r{[^/]+} }, format: false, defaults: { format: nil } - post :authorize + get ":secret/:filename", action: :show, as: :show, constraints: { filename: %r{[^/]+} }, format: false, defaults: { format: nil } # rubocop:todo Cop/PutProjectRoutesUnderScope + post :authorize # rubocop:todo Cop/PutProjectRoutesUnderScope end end resources :runners, only: [:index, :edit, :update, :destroy, :show] do # rubocop: disable Cop/PutProjectRoutesUnderScope member do - post :resume - post :pause + post :resume # rubocop:todo Cop/PutProjectRoutesUnderScope + post :pause # rubocop:todo Cop/PutProjectRoutesUnderScope end collection do - post :toggle_shared_runners - post :toggle_group_runners + post :toggle_shared_runners # rubocop:todo Cop/PutProjectRoutesUnderScope + post :toggle_group_runners # rubocop:todo Cop/PutProjectRoutesUnderScope end end @@ -478,34 +488,42 @@ constraints(::Constraints::ProjectUrlConstrainer.new) do collection do scope '*ref', constraints: { ref: Gitlab::PathRegex.git_reference_regex } do constraints format: /svg/ do - get :pipeline - get :coverage + get :pipeline # rubocop:todo Cop/PutProjectRoutesUnderScope + get :coverage # rubocop:todo Cop/PutProjectRoutesUnderScope end end end end scope :usage_ping, controller: :usage_ping do - post :web_ide_clientside_preview - post :web_ide_pipelines_count + post :web_ide_clientside_preview # rubocop:todo Cop/PutProjectRoutesUnderScope + post :web_ide_pipelines_count # rubocop:todo Cop/PutProjectRoutesUnderScope end resources :web_ide_terminals, path: :ide_terminals, only: [:create, :show], constraints: { id: /\d+/, format: :json } do # rubocop: disable Cop/PutProjectRoutesUnderScope member do - post :cancel - post :retry + post :cancel # rubocop:todo Cop/PutProjectRoutesUnderScope + post :retry # rubocop:todo Cop/PutProjectRoutesUnderScope end collection do - post :check_config + post :check_config # rubocop:todo Cop/PutProjectRoutesUnderScope end end # Deprecated unscoped routing. - # Issue https://gitlab.com/gitlab-org/gitlab/issues/118849 scope as: 'deprecated' do + # Issue https://gitlab.com/gitlab-org/gitlab/issues/118849 draw :pipelines draw :repository + + # Issue https://gitlab.com/gitlab-org/gitlab/-/issues/29572 + resources :snippets, concerns: :awardable, constraints: { id: /\d+/ } do # rubocop: disable Cop/PutProjectRoutesUnderScope + member do + get :raw # rubocop:todo Cop/PutProjectRoutesUnderScope + post :mark_as_spam # rubocop:todo Cop/PutProjectRoutesUnderScope + end + end end # All new routes should go under /-/ scope. diff --git a/config/routes/repository.rb b/config/routes/repository.rb index eec204f2870..43837f2ce34 100644 --- a/config/routes/repository.rb +++ b/config/routes/repository.rb @@ -17,6 +17,7 @@ resources :commit, only: [:show], constraints: { id: /\h{7,40}/ } do post :revert post :cherry_pick get :diff_for_path + get :diff_files get :merge_requests end end diff --git a/config/routes/snippets.rb b/config/routes/snippets.rb index 1ea9a6431d8..7bb82da4910 100644 --- a/config/routes/snippets.rb +++ b/config/routes/snippets.rb @@ -17,14 +17,11 @@ resources :snippets, concerns: :awardable do end end -# Use this /-/ scope for all new snippet routes. -scope path: '-' do - get '/snippets/:snippet_id/raw/:ref/*path', - to: 'snippets/blobs#raw', - as: :snippet_blob_raw, - format: false, - constraints: { snippet_id: /\d+/ } -end +get '/snippets/:snippet_id/raw/:ref/*path', + to: 'snippets/blobs#raw', + as: :snippet_blob_raw, + format: false, + constraints: { snippet_id: /\d+/ } get '/s/:username', to: redirect('users/%{username}/snippets'), constraints: { username: /[a-zA-Z.0-9_\-]+(?<!\.atom)/ } |