diff --git a/app/controllers/projects/clusters_controller.rb b/app/controllers/projects/clusters_controller.rb index 95e2f6a1257c25defc891dbf608234e43a96c4a0..23613b98e8c1a285c6e99c2da300058e3e7bcea7 100644 --- a/app/controllers/projects/clusters_controller.rb +++ b/app/controllers/projects/clusters_controller.rb @@ -1,8 +1,8 @@ class Projects::ClustersController < Projects::ApplicationController - before_action :cluster, except: [:login, :index, :new, :create] + before_action :cluster, except: [:login, :index, :new, :new_gcp, :create] before_action :authorize_read_cluster! - before_action :authorize_create_cluster!, only: [:new, :create] - before_action :authorize_google_api, only: [:new, :create] + before_action :authorize_create_cluster!, only: [:new, :new_gcp, :create] + before_action :authorize_google_api, only: [:new_gcp, :create] before_action :authorize_update_cluster!, only: [:update] before_action :authorize_admin_cluster!, only: [:destroy] @@ -16,7 +16,7 @@ class Projects::ClustersController < Projects::ApplicationController def login begin - state = generate_session_key_redirect(namespace_project_clusters_url.to_s) + state = generate_session_key_redirect(providers_gcp_new_namespace_project_clusters_url.to_s) @authorize_url = GoogleApi::CloudPlatform::Client.new( nil, callback_google_api_auth_url, @@ -26,13 +26,11 @@ class Projects::ClustersController < Projects::ApplicationController end end - # TODO fix this - def new_kubernetes_form - @cluster = project.build_cluster + def new end - def new - # First page! + def new_gcp + @cluster = project.build_cluster end def create diff --git a/app/views/projects/clusters/new.html.haml b/app/views/projects/clusters/new.html.haml index 3963e4741f368228ff1b2884cc47371be1f84f6b..b11202a498570451443a73230c3f5334cb5bd3c9 100644 --- a/app/views/projects/clusters/new.html.haml +++ b/app/views/projects/clusters/new.html.haml @@ -8,9 +8,6 @@ %h4= s_('ClusterIntegration|Choose how to set up cluster integration') %p= s_('ClusterIntegration| Create a new cluster on Google Engine right from GitLab') - -# TODO FIX PATH - = link_to s_('ClusterIntegration|Create on GKE'), providers_gcp_login_project_clusters_path(@project), class: 'btn append-bottom-20' - -# TODO FIX PATH + = 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'), project_settings_integrations_path(@project), class: 'btn append-bottom-20' - + = link_to s_('ClusterIntegration|Add an existing cluster'), edit_project_service_path(@project, :kubernetes), class: 'btn append-bottom-20' diff --git a/app/views/projects/clusters/new_kubernetes_form.html.haml b/app/views/projects/clusters/new_gcp.html.haml similarity index 97% rename from app/views/projects/clusters/new_kubernetes_form.html.haml rename to app/views/projects/clusters/new_gcp.html.haml index c538d41ffadc1b5ab220a28814502e8319aeafb2..ad4b250db356179826f4aa7e8137d1dc7029596b 100644 --- a/app/views/projects/clusters/new_kubernetes_form.html.haml +++ b/app/views/projects/clusters/new_gcp.html.haml @@ -6,4 +6,5 @@ = render 'sidebar' .col-sm-8 = render 'header' + = render 'form' diff --git a/config/routes/project.rb b/config/routes/project.rb index d05fe11f233532739390b3960da7c67f9f9599b7..764f794f369957521d377923fe90f9802e852c4b 100644 --- a/config/routes/project.rb +++ b/config/routes/project.rb @@ -186,6 +186,7 @@ constraints(ProjectUrlConstrainer.new) do resources :clusters, except: [:edit] do collection do get :login + get '/providers/gcp/new', to: :new_gcp end member do