From 882cf2e409ce2ea798fce7f3082083fcdf143baf Mon Sep 17 00:00:00 2001 From: Kamil Trzcinski Date: Wed, 1 Nov 2017 12:11:47 +0100 Subject: [PATCH] Fix paths to the first page --- app/controllers/projects/clusters_controller.rb | 16 +++++++--------- app/views/projects/clusters/new.html.haml | 7 ++----- ...bernetes_form.html.haml => new_gcp.html.haml} | 1 + config/routes/project.rb | 1 + 4 files changed, 11 insertions(+), 14 deletions(-) rename app/views/projects/clusters/{new_kubernetes_form.html.haml => new_gcp.html.haml} (97%) diff --git a/app/controllers/projects/clusters_controller.rb b/app/controllers/projects/clusters_controller.rb index 95e2f6a1257..23613b98e8c 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 3963e4741f3..b11202a4985 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 c538d41ffad..ad4b250db35 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 d05fe11f233..764f794f369 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