diff options
Diffstat (limited to 'config/routes')
-rw-r--r-- | config/routes/admin.rb | 3 | ||||
-rw-r--r-- | config/routes/project.rb | 43 | ||||
-rw-r--r-- | config/routes/repository.rb | 139 | ||||
-rw-r--r-- | config/routes/wiki.rb | 4 |
4 files changed, 85 insertions, 104 deletions
diff --git a/config/routes/admin.rb b/config/routes/admin.rb index 486ce3c5c87..52ba10604d4 100644 --- a/config/routes/admin.rb +++ b/config/routes/admin.rb @@ -91,6 +91,7 @@ namespace :admin do resource :application_settings, only: [:show, :update] do resources :services, only: [:index, :edit, :update] + get :usage_data put :reset_runners_token put :reset_health_check_token put :clear_repository_check_states @@ -105,6 +106,8 @@ namespace :admin do end end + resources :cohorts, only: :index + resources :builds, only: :index do collection do post :cancel_all diff --git a/config/routes/project.rb b/config/routes/project.rb index 39144b74629..120eccf5418 100644 --- a/config/routes/project.rb +++ b/config/routes/project.rb @@ -42,29 +42,6 @@ constraints(ProjectUrlConstrainer.new) do resources :domains, only: [:show, :new, :create, :destroy], controller: 'pages_domains', constraints: { id: /[^\/]+/ } end - resources :compare, only: [:index, :create] do - collection do - get :diff_for_path - end - end - - get '/compare/:from...:to', to: 'compare#show', as: 'compare', constraints: { from: /.+/, to: /.+/ } - - # Don't use format parameter as file extension (old 3.0.x behavior) - # See http://guides.rubyonrails.org/routing.html#route-globbing-and-wildcard-segments - scope format: false do - resources :network, only: [:show], constraints: { id: Gitlab::Regex.git_reference_regex } - - resources :graphs, only: [:show], constraints: { id: Gitlab::Regex.git_reference_regex } do - member do - get :charts - get :commits - get :ci - get :languages - end - end - end - resources :snippets, concerns: :awardable, constraints: { id: /\d+/ } do member do get 'raw' @@ -128,13 +105,6 @@ constraints(ProjectUrlConstrainer.new) do end end - resources :branches, only: [:index, :new, :create, :destroy], constraints: { id: Gitlab::Regex.git_reference_regex } - delete :merged_branches, controller: 'branches', action: :destroy_all_merged - resources :tags, only: [:index, :show, :new, :create, :destroy], constraints: { id: Gitlab::Regex.git_reference_regex } do - resource :release, only: [:edit, :update] - end - - resources :protected_branches, only: [:index, :show, :create, :update, :destroy], constraints: { id: Gitlab::Regex.git_reference_regex } resources :variables, only: [:index, :show, :update, :create, :destroy] resources :triggers, only: [:index, :create, :edit, :update, :destroy] do member do @@ -166,7 +136,7 @@ constraints(ProjectUrlConstrainer.new) do end collection do - get :folder, path: 'folders/:id' + get :folder, path: 'folders/*id', constraints: { format: /(html|json)/ } end resources :deployments, only: [:index] @@ -223,7 +193,15 @@ constraints(ProjectUrlConstrainer.new) do end end - resources :container_registry, only: [:index, :destroy], constraints: { id: Gitlab::Regex.container_registry_reference_regex } + resources :container_registry, only: [:index, :destroy], + controller: 'registry/repositories' + + namespace :registry do + resources :repository, only: [] do + resources :tags, only: [:destroy], + constraints: { id: Gitlab::Regex.container_registry_reference_regex } + end + end resources :milestones, constraints: { id: /\d+/ } do member do @@ -252,6 +230,7 @@ constraints(ProjectUrlConstrainer.new) do get :referenced_merge_requests get :related_branches get :can_create_branch + get :rendered_title end collection do post :bulk_update diff --git a/config/routes/repository.rb b/config/routes/repository.rb index f8966c5ae75..5cf37a06e97 100644 --- a/config/routes/repository.rb +++ b/config/routes/repository.rb @@ -1,4 +1,4 @@ -# All routing related to repositoty browsing +# All routing related to repository browsing resource :repository, only: [:create] do member do @@ -6,83 +6,84 @@ resource :repository, only: [:create] do end end -resources :refs, only: [] do - collection do - get 'switch' +# Don't use format parameter as file extension (old 3.0.x behavior) +# See http://guides.rubyonrails.org/routing.html#route-globbing-and-wildcard-segments +scope format: false do + get '/compare/:from...:to', to: 'compare#show', as: 'compare', constraints: { from: /.+/, to: /.+/ } + + resources :compare, only: [:index, :create] do + collection do + get :diff_for_path + end end - member do - # tree viewer logs - get 'logs_tree', constraints: { id: Gitlab::Regex.git_reference_regex } - # Directories with leading dots erroneously get rejected if git - # ref regex used in constraints. Regex verification now done in controller. - get 'logs_tree/*path' => 'refs#logs_tree', as: :logs_file, constraints: { - id: /.*/, - path: /.*/ - } + resources :refs, only: [] do + collection do + get 'switch' + end + + member do + # tree viewer logs + get 'logs_tree', constraints: { id: Gitlab::Regex.git_reference_regex } + # Directories with leading dots erroneously get rejected if git + # ref regex used in constraints. Regex verification now done in controller. + get 'logs_tree/*path', action: :logs_tree, as: :logs_file, format: false, constraints: { + id: /.*/, + path: /.*/ + } + end end -end -get '/new/*id', to: 'blob#new', constraints: { id: /.+/ }, as: 'new_blob' -post '/create/*id', to: 'blob#create', constraints: { id: /.+/ }, as: 'create_blob' -get '/edit/*id', to: 'blob#edit', constraints: { id: /.+/ }, as: 'edit_blob' -put '/update/*id', to: 'blob#update', constraints: { id: /.+/ }, as: 'update_blob' -post '/preview/*id', to: 'blob#preview', constraints: { id: /.+/ }, as: 'preview_blob' + scope constraints: { id: Gitlab::Regex.git_reference_regex } do + resources :network, only: [:show] -scope('/blob/*id', as: :blob, controller: :blob, constraints: { id: /.+/, format: false }) do - get :diff - get '/', action: :show - delete '/', action: :destroy - post '/', action: :create - put '/', action: :update -end + resources :graphs, only: [:show] do + member do + get :charts + get :commits + get :ci + get :languages + end + end -get( - '/raw/*id', - to: 'raw#show', - constraints: { id: /.+/, format: /(html|js)/ }, - as: :raw -) + resources :branches, only: [:index, :new, :create, :destroy] + delete :merged_branches, controller: 'branches', action: :destroy_all_merged + resources :tags, only: [:index, :show, :new, :create, :destroy] do + resource :release, only: [:edit, :update] + end -get( - '/tree/*id', - to: 'tree#show', - constraints: { id: /.+/, format: /(html|js)/ }, - as: :tree -) + resources :protected_branches, only: [:index, :show, :create, :update, :destroy] + resources :protected_tags, only: [:index, :show, :create, :update, :destroy] + end + + scope constraints: { id: /.+/ } do + scope controller: :blob do + get '/new/*id', action: :new, as: :new_blob + post '/create/*id', action: :create, as: :create_blob + get '/edit/*id', action: :edit, as: :edit_blob + put '/update/*id', action: :update, as: :update_blob + post '/preview/*id', action: :preview, as: :preview_blob -get( - '/find_file/*id', - to: 'find_file#show', - constraints: { id: /.+/, format: /html/ }, - as: :find_file -) + scope path: '/blob/*id', as: :blob do + get :diff + get '/', action: :show + delete '/', action: :destroy + post '/', action: :create + put '/', action: :update + end + end -get( - '/files/*id', - to: 'find_file#list', - constraints: { id: /(?:[^.]|\.(?!json$))+/, format: /json/ }, - as: :files -) + get '/tree/*id', to: 'tree#show', as: :tree + get '/raw/*id', to: 'raw#show', as: :raw + get '/blame/*id', to: 'blame#show', as: :blame + get '/commits/*id', to: 'commits#show', as: :commits -post( - '/create_dir/*id', - to: 'tree#create_dir', - constraints: { id: /.+/ }, - as: 'create_dir' -) + post '/create_dir/*id', to: 'tree#create_dir', as: :create_dir -get( - '/blame/*id', - to: 'blame#show', - constraints: { id: /.+/, format: /(html|js)/ }, - as: :blame -) + scope controller: :find_file do + get '/find_file/*id', action: :show, as: :find_file -# File/dir history -get( - '/commits/*id', - to: 'commits#show', - constraints: { id: /.+/, format: false }, - as: :commits -) + get '/files/*id', action: :list, as: :files + end + end +end diff --git a/config/routes/wiki.rb b/config/routes/wiki.rb index a6b3f5d4693..c2da84ff6f2 100644 --- a/config/routes/wiki.rb +++ b/config/routes/wiki.rb @@ -1,5 +1,3 @@ -WIKI_SLUG_ID = { id: /\S+/ }.freeze unless defined? WIKI_SLUG_ID - scope(controller: :wikis) do scope(path: 'wikis', as: :wikis) do get :git_access @@ -8,7 +6,7 @@ scope(controller: :wikis) do post '/', to: 'wikis#create' end - scope(path: 'wikis/*id', as: :wiki, constraints: WIKI_SLUG_ID, format: false) do + scope(path: 'wikis/*id', as: :wiki, format: false) do get :edit get :history post :preview_markdown |