summaryrefslogtreecommitdiff
path: root/config
diff options
context:
space:
mode:
authorThong Kuah <tkuah@gitlab.com>2018-10-15 16:37:51 +1300
committerThong Kuah <tkuah@gitlab.com>2018-11-01 18:38:36 +1300
commit5b3c096c9e0c9e8e7e1cb35c1b9e347995b948f5 (patch)
treef0e4934cd4bbf59d670ff8911e64d94602907259 /config
parent5a953741820b78492333e1543062a5c222694d8c (diff)
downloadgitlab-ce-5b3c096c9e0c9e8e7e1cb35c1b9e347995b948f5.tar.gz
Convert clusters to use a top-level controller
In preparation so that we can create both cluster attached to project and cluster attached to group. - Move ClustersController to top level - Move Clusters::ApplicationsController to top-level too - Creates a Clusters::BaseController to share common functions - Do not rely on @project ivar. Anything could set the ivar. - Fix Vue page components due to new data-page value Because of the controller change we have gone from `projects:clusters:new` to `clusters:new`, so we need to update the file location of the page components. There is somewhere a function that will convert data-page to a file location. On that note, projects/clusters/gcp/new/, translate to Projects::Clusters::Gcp#new doesn't exist so replace that with clusters/create_gcp/ and clusters/create_user/
Diffstat (limited to 'config')
-rw-r--r--config/routes.rb17
-rw-r--r--config/routes/project.rb15
2 files changed, 18 insertions, 14 deletions
diff --git a/config/routes.rb b/config/routes.rb
index 37c7f98ec98..cfb81cabfe4 100644
--- a/config/routes.rb
+++ b/config/routes.rb
@@ -84,6 +84,23 @@ Rails.application.routes.draw do
draw :instance_statistics
end
+ concern :clusterable do
+ resources :clusters, except: [:edit, :create], controller: '/clusters' do
+ collection do
+ post :create_gcp
+ post :create_user
+ end
+
+ member do
+ get :status, format: :json
+
+ scope :applications do
+ post '/:application', to: '/clusters/applications#create', as: :install_applications
+ end
+ end
+ end
+ end
+
draw :api
draw :sidekiq
draw :help
diff --git a/config/routes/project.rb b/config/routes/project.rb
index 73c46f72168..387d2363552 100644
--- a/config/routes/project.rb
+++ b/config/routes/project.rb
@@ -206,20 +206,7 @@ constraints(::Constraints::ProjectUrlConstrainer.new) do
end
end
- resources :clusters, except: [:edit, :create] do
- collection do
- post :create_gcp
- post :create_user
- end
-
- member do
- get :status, format: :json
-
- scope :applications do
- post '/:application', to: 'clusters/applications#create', as: :install_applications
- end
- end
- end
+ concerns :clusterable
resources :environments, except: [:destroy] do
member do