diff options
Diffstat (limited to 'config/routes')
-rw-r--r-- | config/routes/admin.rb | 8 | ||||
-rw-r--r-- | config/routes/group.rb | 14 | ||||
-rw-r--r-- | config/routes/instance_statistics.rb | 8 | ||||
-rw-r--r-- | config/routes/issues.rb | 2 | ||||
-rw-r--r-- | config/routes/jira_connect.rb | 15 | ||||
-rw-r--r-- | config/routes/profile.rb | 2 | ||||
-rw-r--r-- | config/routes/project.rb | 52 | ||||
-rw-r--r-- | config/routes/user.rb | 2 |
8 files changed, 84 insertions, 19 deletions
diff --git a/config/routes/admin.rb b/config/routes/admin.rb index f3b7fb5ed45..bac8247de2e 100644 --- a/config/routes/admin.rb +++ b/config/routes/admin.rb @@ -89,6 +89,12 @@ namespace :admin do resources :projects, only: [:index] + resources :instance_statistics, only: :index + resource :dev_ops_report, controller: 'dev_ops_report', only: :show + # remove in 13.5 + get '/dev_ops_score', to: redirect('admin/dev_ops_report') + resources :cohorts, only: :index + scope(path: 'projects/*namespace_id', as: :namespace, constraints: { namespace_id: Gitlab::PathRegex.full_namespace_route_regex }) do @@ -135,6 +141,8 @@ namespace :admin do get :status_delete_self_monitoring_project end + resources :plan_limits, only: :create + resources :labels resources :runners, only: [:index, :show, :update, :destroy] do diff --git a/config/routes/group.rb b/config/routes/group.rb index e07ed0fab05..e5bbfdf7548 100644 --- a/config/routes/group.rb +++ b/config/routes/group.rb @@ -23,9 +23,7 @@ constraints(::Constraints::GroupUrlConstrainer.new) do get 'archived', action: :show, as: :group_archived # rubocop:disable Cop/PutGroupRoutesUnderScope end - # 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 + get '/', action: :show, as: :group_canonical end scope(path: 'groups/*group_id/-', @@ -112,11 +110,9 @@ constraints(::Constraints::GroupUrlConstrainer.new) do as: :group, constraints: { id: Gitlab::PathRegex.full_namespace_route_regex, format: /(html|json|atom)/ }, controller: :groups) do - # 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 + get '/', action: :show + patch '/', action: :update + put '/', action: :update + delete '/', action: :destroy end end diff --git a/config/routes/instance_statistics.rb b/config/routes/instance_statistics.rb deleted file mode 100644 index 967255d5b82..00000000000 --- a/config/routes/instance_statistics.rb +++ /dev/null @@ -1,8 +0,0 @@ -# frozen_string_literal: true - -namespace :instance_statistics do - root to: redirect('-/instance_statistics/dev_ops_score') - - resources :cohorts, only: :index - resources :dev_ops_score, only: :index -end diff --git a/config/routes/issues.rb b/config/routes/issues.rb index eae1cacfcf7..cc4399693ed 100644 --- a/config/routes/issues.rb +++ b/config/routes/issues.rb @@ -22,4 +22,6 @@ resources :issues, concerns: :awardable, constraints: { id: /\d+/ } do post :import_csv post :export_csv end + + resources :issue_links, only: [:index, :create, :destroy], as: 'links', path: 'links' end diff --git a/config/routes/jira_connect.rb b/config/routes/jira_connect.rb new file mode 100644 index 00000000000..a3b786b60f0 --- /dev/null +++ b/config/routes/jira_connect.rb @@ -0,0 +1,15 @@ +# frozen_string_literal: true + +namespace :jira_connect do + # This is so we can have a named route helper for the base URL + root to: proc { [404, {}, ['']] }, as: 'base' + + get 'app_descriptor' => 'app_descriptor#show' + + namespace :events do + post 'installed' + post 'uninstalled' + end + + resources :subscriptions, only: [:index, :create, :destroy] +end diff --git a/config/routes/profile.rb b/config/routes/profile.rb index 6126a3b593b..3eda53318e3 100644 --- a/config/routes/profile.rb +++ b/config/routes/profile.rb @@ -63,9 +63,11 @@ resource :profile, only: [:show, :update] do post :create_u2f post :codes patch :skip + post :create_webauthn end end resources :u2f_registrations, only: [:destroy] + resources :webauthn_registrations, only: [:destroy] end end diff --git a/config/routes/project.rb b/config/routes/project.rb index d02dc974434..24b44646d95 100644 --- a/config/routes/project.rb +++ b/config/routes/project.rb @@ -25,7 +25,10 @@ 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)(/:page)', constraints: { dashboard_path: /.+\.yml/, page: 'panel/new' }, + # Since the page parameter can contain slashes (panel/new), use Rails' + # "Route Globbing" syntax (/*page) so that the route helpers do not encode + # the slash character. + 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 @@ -367,6 +370,19 @@ constraints(::Constraints::ProjectUrlConstrainer.new) do post :mark_as_spam end end + + resources :feature_flags, param: :iid do + resources :feature_flag_issues, only: [:index, :create, :destroy], as: 'issues', path: 'issues' + end + resource :feature_flags_client, only: [] do + post :reset_token + end + resources :feature_flags_user_lists, param: :iid, only: [:new, :edit, :show] + + get '/schema/:branch/*filename', + to: 'web_ide_schemas#show', + format: false, + as: :schema end # End of the /-/ scope. @@ -564,3 +580,37 @@ constraints(::Constraints::ProjectUrlConstrainer.new) do # rubocop: enable Cop/PutProjectRoutesUnderScope end end + +# It's under /-/jira scope but cop is only checking /-/ +# rubocop: disable Cop/PutProjectRoutesUnderScope +scope path: '(/-/jira)', constraints: ::Constraints::JiraEncodedUrlConstrainer.new, as: :jira do + scope path: '*namespace_id/:project_id', + namespace_id: Gitlab::Jira::Dvcs::ENCODED_ROUTE_REGEX, + project_id: Gitlab::Jira::Dvcs::ENCODED_ROUTE_REGEX do + get '/', to: redirect { |params, req| + ::Gitlab::Jira::Dvcs.restore_full_path( + namespace: params[:namespace_id], + project: params[:project_id] + ) + } + + get 'commit/:id', constraints: { id: /\h{7,40}/ }, to: redirect { |params, req| + project_full_path = ::Gitlab::Jira::Dvcs.restore_full_path( + namespace: params[:namespace_id], + project: params[:project_id] + ) + + "/#{project_full_path}/commit/#{params[:id]}" + } + + get 'tree/*id', as: nil, to: redirect { |params, req| + project_full_path = ::Gitlab::Jira::Dvcs.restore_full_path( + namespace: params[:namespace_id], + project: params[:project_id] + ) + + "/#{project_full_path}/-/tree/#{params[:id]}" + } + end +end +# rubocop: enable Cop/PutProjectRoutesUnderScope diff --git a/config/routes/user.rb b/config/routes/user.rb index c7a5a56d9ed..63329277e33 100644 --- a/config/routes/user.rb +++ b/config/routes/user.rb @@ -55,7 +55,7 @@ end constraints(::Constraints::UserUrlConstrainer.new) do # Get all keys of user - get ':username.keys', controller: :users, action: :ssh_keys, constraints: { username: Gitlab::PathRegex.root_namespace_route_regex } + get ':username.keys' => 'profiles/keys#get_keys', constraints: { username: Gitlab::PathRegex.root_namespace_route_regex } scope(path: ':username', as: :user, |