summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorKamil Trzcinski <ayufan@ayufan.eu>2017-12-03 13:50:45 +0100
committerKamil Trzcinski <ayufan@ayufan.eu>2017-12-03 13:50:45 +0100
commit1385d700265a12c0fba344ff606feaea56538641 (patch)
tree74d300f3ad09391748d73cdf019fe35d87fa52be
parentd502ce59a36cfc1b815b7c6b7d7151d7aa3fc62b (diff)
downloadgitlab-ce-1385d700265a12c0fba344ff606feaea56538641.tar.gz
Fix routes
-rw-r--r--app/controllers/projects/clusters/gcp_controller.rb2
-rw-r--r--app/controllers/projects/clusters/user_controller.rb (renamed from app/controllers/projects/clusters/kubernetes_controller.rb)2
-rw-r--r--app/views/projects/clusters/_dropdown.html.haml4
-rw-r--r--app/views/projects/clusters/gcp/_form.html.haml2
-rw-r--r--app/views/projects/clusters/new.html.haml17
-rw-r--r--app/views/projects/clusters/user/_form.html.haml (renamed from app/views/projects/clusters/kubernetes/_form.html.haml)2
-rw-r--r--app/views/projects/clusters/user/_header.html.haml (renamed from app/views/projects/clusters/kubernetes/_header.html.haml)0
-rw-r--r--app/views/projects/clusters/user/_show.html.haml (renamed from app/views/projects/clusters/kubernetes/_show.html.haml)0
-rw-r--r--app/views/projects/clusters/user/new.html.haml (renamed from app/views/projects/clusters/kubernetes/new.html.haml)0
-rw-r--r--config/routes/project.rb12
10 files changed, 17 insertions, 24 deletions
diff --git a/app/controllers/projects/clusters/gcp_controller.rb b/app/controllers/projects/clusters/gcp_controller.rb
index d798801e5d0..54eef2426a5 100644
--- a/app/controllers/projects/clusters/gcp_controller.rb
+++ b/app/controllers/projects/clusters/gcp_controller.rb
@@ -7,7 +7,7 @@ class Projects::Clusters::GcpController < Projects::ApplicationController
def login
begin
- state = generate_session_key_redirect(providers_gcp_new_namespace_project_clusters_url.to_s)
+ state = generate_session_key_redirect(new_namespace_project_gcp_url.to_s)
@authorize_url = GoogleApi::CloudPlatform::Client.new(
nil, callback_google_api_auth_url,
diff --git a/app/controllers/projects/clusters/kubernetes_controller.rb b/app/controllers/projects/clusters/user_controller.rb
index 0a1d0a912e6..7f108c54b19 100644
--- a/app/controllers/projects/clusters/kubernetes_controller.rb
+++ b/app/controllers/projects/clusters/user_controller.rb
@@ -1,4 +1,4 @@
-class Projects::Clusters::KubernetesController < Projects::ApplicationController
+class Projects::Clusters::UserController < Projects::ApplicationController
before_action :authorize_read_cluster!
before_action :authorize_create_cluster!, only: [:new, :create]
diff --git a/app/views/projects/clusters/_dropdown.html.haml b/app/views/projects/clusters/_dropdown.html.haml
index 46b5fb79fce..12d68ea98ea 100644
--- a/app/views/projects/clusters/_dropdown.html.haml
+++ b/app/views/projects/clusters/_dropdown.html.haml
@@ -7,6 +7,6 @@
= icon('chevron-down')
%ul.dropdown-menu.clusters-dropdown-menu.dropdown-menu-full-width
%li
- = link_to(s_('ClusterIntegration|Create cluster on Google Container Engine'), providers_gcp_new_namespace_project_clusters_path(@project.namespace, @project))
+ = link_to(s_('ClusterIntegration|Create cluster on Google Container Engine'), new_namespace_project_gcp_path(@project.namespace, @project))
%li
- = link_to(s_('ClusterIntegration|Add an existing cluster'), platforms_kubernetes_new_namespace_project_clusters_path(@project.namespace, @project))
+ = link_to(s_('ClusterIntegration|Add an existing cluster'), new_namespace_project_user_path(@project.namespace, @project))
diff --git a/app/views/projects/clusters/gcp/_form.html.haml b/app/views/projects/clusters/gcp/_form.html.haml
index 69d02afb79b..6085a4c0e28 100644
--- a/app/views/projects/clusters/gcp/_form.html.haml
+++ b/app/views/projects/clusters/gcp/_form.html.haml
@@ -3,7 +3,7 @@
- link_to_help_page = link_to(s_('ClusterIntegration|help page'), help_page_path('user/project/clusters/index'), target: '_blank', rel: 'noopener noreferrer')
= s_('ClusterIntegration|Read our %{link_to_help_page} on cluster integration.').html_safe % { link_to_help_page: link_to_help_page}
-= form_for @cluster, html: { class: 'prepend-top-20' }, url: providers_gcp_namespace_project_clusters_path(@project.namespace, @project), as: :cluster do |field|
+= form_for @cluster, html: { class: 'prepend-top-20' }, url: namespace_project_gcp_path(@project.namespace, @project), as: :cluster do |field|
= form_errors(@cluster)
.form-group
= field.label :name, s_('ClusterIntegration|Cluster name')
diff --git a/app/views/projects/clusters/new.html.haml b/app/views/projects/clusters/new.html.haml
index f7ddfe9d693..47b5180ee39 100644
--- a/app/views/projects/clusters/new.html.haml
+++ b/app/views/projects/clusters/new.html.haml
@@ -5,16 +5,9 @@
.col-sm-4
= render 'sidebar'
.col-sm-8
- - if @project.deployment_platform&.active?
- %h4.prepend-top-0= s_('ClusterIntegration|Cluster management')
+ %h4.prepend-top-0= s_('ClusterIntegration|Choose how to set up cluster integration')
- %p= s_('ClusterIntegration|A cluster has been set up on this project through the Kubernetes integration page')
- = link_to s_('ClusterIntegration|Manage Kubernetes integration'), edit_project_service_path(@project, :kubernetes), class: 'btn append-bottom-20'
-
- - else
- %h4.prepend-top-0= s_('ClusterIntegration|Choose how to set up cluster integration')
-
- %p= s_('ClusterIntegration|Create a new cluster on Google Engine right from GitLab')
- = link_to s_('ClusterIntegration|Create on GKE'), providers_gcp_new_namespace_project_clusters_path(@project.namespace, @project), class: 'btn append-bottom-20'
- %p= s_('ClusterIntegration|Enter the details for an existing Kubernetes cluster')
- = link_to s_('ClusterIntegration|Add an existing cluster'), platforms_kubernetes_new_namespace_project_clusters_path(@project.namespace, @project), class: 'btn append-bottom-20'
+ %p= s_('ClusterIntegration|Create a new cluster on Google Engine right from GitLab')
+ = link_to s_('ClusterIntegration|Create on GKE'), new_namespace_project_gcp_path(@project.namespace, @project), class: 'btn append-bottom-20'
+ %p= s_('ClusterIntegration|Enter the details for an existing Kubernetes cluster')
+ = link_to s_('ClusterIntegration|Add an existing cluster'), new_namespace_project_user_path(@project.namespace, @project), class: 'btn append-bottom-20'
diff --git a/app/views/projects/clusters/kubernetes/_form.html.haml b/app/views/projects/clusters/user/_form.html.haml
index 238b29a81cb..0884cc0b4c3 100644
--- a/app/views/projects/clusters/kubernetes/_form.html.haml
+++ b/app/views/projects/clusters/user/_form.html.haml
@@ -1,4 +1,4 @@
-= form_for @cluster, url: platforms_kubernetes_namespace_project_clusters_path(@project.namespace, @project), as: :cluster do |field|
+= form_for @cluster, url: namespace_project_user_path(@project.namespace, @project), as: :cluster do |field|
= form_errors(@cluster)
.form-group
= field.label :name, s_('ClusterIntegration|Cluster name')
diff --git a/app/views/projects/clusters/kubernetes/_header.html.haml b/app/views/projects/clusters/user/_header.html.haml
index 06ac210a06d..06ac210a06d 100644
--- a/app/views/projects/clusters/kubernetes/_header.html.haml
+++ b/app/views/projects/clusters/user/_header.html.haml
diff --git a/app/views/projects/clusters/kubernetes/_show.html.haml b/app/views/projects/clusters/user/_show.html.haml
index 72c5417e9b2..72c5417e9b2 100644
--- a/app/views/projects/clusters/kubernetes/_show.html.haml
+++ b/app/views/projects/clusters/user/_show.html.haml
diff --git a/app/views/projects/clusters/kubernetes/new.html.haml b/app/views/projects/clusters/user/new.html.haml
index 68f38f83453..68f38f83453 100644
--- a/app/views/projects/clusters/kubernetes/new.html.haml
+++ b/app/views/projects/clusters/user/new.html.haml
diff --git a/config/routes/project.rb b/config/routes/project.rb
index d2fb0c3ee12..2ca5bfca1e7 100644
--- a/config/routes/project.rb
+++ b/config/routes/project.rb
@@ -185,12 +185,12 @@ constraints(ProjectUrlConstrainer.new) do
resources :clusters, except: [:edit, :create] do
collection do
- get '/platforms/kubernetes/new', to: 'clusters/kubernetes#new'
- post '/platforms/kubernetes', to: 'clusters/kubernetes#create'
-
- get '/providers/gcp/new', to: 'clusters/gcp#new'
- get '/providers/gcp/login', to: 'clusters/gcp#login'
- post '/providers/gcp', to: 'clusters/gcp#create'
+ scope :providers do
+ resource :user, only: [:new, :create], controller: 'clusters/user'
+ resource :gcp, only: [:new, :create], controller: 'clusters/gcp' do
+ get :login
+ end
+ end
end
member do