diff options
Diffstat (limited to 'config/routes/project.rb')
-rw-r--r-- | config/routes/project.rb | 199 |
1 files changed, 101 insertions, 98 deletions
diff --git a/config/routes/project.rb b/config/routes/project.rb index fdc2a3c0086..1e94bdc245f 100644 --- a/config/routes/project.rb +++ b/config/routes/project.rb @@ -26,17 +26,106 @@ constraints(::Constraints::ProjectUrlConstrainer.new) do module: :projects, as: :project) do - resources :autocomplete_sources, only: [] do - collection do - get 'members' - get 'issues' - get 'merge_requests' - get 'labels' - get 'milestones' - get 'commands' - get 'snippets' + # Begin of the /-/ scope. + # 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' + + resources :jobs, only: [:index, :show], constraints: { id: /\d+/ } do + collection do + resources :artifacts, only: [] do + collection do + get :latest_succeeded, + path: '*ref_name_and_path', + format: false + end + end + end + + member do + get :status + post :cancel + post :unschedule + post :retry + post :play + post :erase + get :trace, defaults: { format: 'json' } + get :raw + get :terminal + get '/terminal.ws/authorize', to: 'jobs#terminal_websocket_authorize', constraints: { format: nil } + end + + resource :artifacts, only: [] do + get :download + get :browse, path: 'browse(/*path)', format: false + get :file, path: 'file/*path', format: false + get :raw, path: 'raw/*path', format: false + post :keep + end + end + + namespace :ci do + resource :lint, only: [:show, :create] + end + + namespace :settings do + get :members, to: redirect("%{namespace_id}/%{project_id}/project_members") + + resource :ci_cd, only: [:show, :update], controller: 'ci_cd' do + post :reset_cache + put :reset_registration_token + end + + resource :operations, only: [:show, :update] + resource :integrations, only: [:show] + + resource :repository, only: [:show], controller: :repository do + post :create_deploy_token, path: 'deploy_token/create' + post :cleanup + end + end + + resources :autocomplete_sources, only: [] do + collection do + get 'members' + get 'issues' + get 'merge_requests' + get 'labels' + get 'milestones' + get 'commands' + get 'snippets' + end + end + + resources :project_members, except: [:show, :new, :edit], constraints: { id: %r{[a-zA-Z./0-9_\-#%+]+} }, concerns: :access_requestable do + collection do + delete :leave + + # Used for import team + # from another project + get :import + post :apply_import + end + + member do + post :resend_invite + end + end + + resources :deploy_keys, constraints: { id: /\d+/ }, only: [:index, :new, :create, :edit, :update] do + member do + put :enable + put :disable + end + end + + resources :deploy_tokens, constraints: { id: /\d+/ }, only: [] do + member do + put :revoke + end end end + # End of the /-/ scope. # # Templates @@ -84,19 +173,6 @@ constraints(::Constraints::ProjectUrlConstrainer.new) do end end - resources :deploy_keys, constraints: { id: /\d+/ }, only: [:index, :new, :create, :edit, :update] do - member do - put :enable - put :disable - end - end - - resources :deploy_tokens, constraints: { id: /\d+/ }, only: [] do - member do - put :revoke - end - end - resources :releases, only: [:index] resources :forks, only: [:index, :new, :create] resource :import, only: [:new, :create, :show] @@ -267,47 +343,6 @@ constraints(::Constraints::ProjectUrlConstrainer.new) do resources :functions, only: [:index] end - scope '-' do - get 'archive/*id', constraints: { format: Gitlab::PathRegex.archive_formats_regex, id: /.+?/ }, to: 'repositories#archive', as: 'archive' - - resources :jobs, only: [:index, :show], constraints: { id: /\d+/ } do - collection do - resources :artifacts, only: [] do - collection do - get :latest_succeeded, - path: '*ref_name_and_path', - format: false - end - end - end - - member do - get :status - post :cancel - post :unschedule - post :retry - post :play - post :erase - get :trace, defaults: { format: 'json' } - get :raw - get :terminal - get '/terminal.ws/authorize', to: 'jobs#terminal_websocket_authorize', constraints: { format: nil } - end - - resource :artifacts, only: [] do - get :download - get :browse, path: 'browse(/*path)', format: false - get :file, path: 'file/*path', format: false - get :raw, path: 'raw/*path', format: false - post :keep - end - end - - namespace :ci do - resource :lint, only: [:show, :create] - end - end - draw :legacy_builds resources :hooks, only: [:index, :create, :edit, :update, :destroy], constraints: { id: /\d+/ } do @@ -379,21 +414,6 @@ constraints(::Constraints::ProjectUrlConstrainer.new) do end end - resources :project_members, except: [:show, :new, :edit], constraints: { id: %r{[a-zA-Z./0-9_\-#%+]+} }, concerns: :access_requestable do - collection do - delete :leave - - # Used for import team - # from another project - get :import - post :apply_import - end - - member do - post :resend_invite - end - end - resources :group_links, only: [:index, :create, :update, :destroy], constraints: { id: /\d+/ } resources :notes, only: [:create, :destroy, :update], concerns: :awardable, constraints: { id: /\d+/ } do @@ -443,25 +463,6 @@ constraints(::Constraints::ProjectUrlConstrainer.new) do end end - scope '-' do - namespace :settings do - get :members, to: redirect("%{namespace_id}/%{project_id}/project_members") - - resource :ci_cd, only: [:show, :update], controller: 'ci_cd' do - post :reset_cache - put :reset_registration_token - end - - resource :operations, only: [:show, :update] - resource :integrations, only: [:show] - - resource :repository, only: [:show], controller: :repository do - post :create_deploy_token, path: 'deploy_token/create' - post :cleanup - end - end - end - resources :error_tracking, only: [:index], controller: :error_tracking do collection do post :list_projects @@ -507,7 +508,9 @@ constraints(::Constraints::ProjectUrlConstrainer.new) do constraints: { project_id: Gitlab::PathRegex.project_route_regex }, module: :projects, as: :project) do - Gitlab::Routing.redirect_legacy_paths(self, :settings, :branches, :tags, :network, :graphs) + Gitlab::Routing.redirect_legacy_paths(self, :settings, :branches, :tags, + :network, :graphs, :autocomplete_sources, + :project_members, :deploy_keys, :deploy_tokens) end end end |