From 882cf2e409ce2ea798fce7f3082083fcdf143baf Mon Sep 17 00:00:00 2001 From: Kamil Trzcinski Date: Wed, 1 Nov 2017 12:11:47 +0100 Subject: Fix paths to the first page --- app/controllers/projects/clusters_controller.rb | 16 +++++++--------- app/views/projects/clusters/new.html.haml | 7 ++----- app/views/projects/clusters/new_gcp.html.haml | 10 ++++++++++ .../projects/clusters/new_kubernetes_form.html.haml | 9 --------- config/routes/project.rb | 1 + 5 files changed, 20 insertions(+), 23 deletions(-) create mode 100644 app/views/projects/clusters/new_gcp.html.haml delete mode 100644 app/views/projects/clusters/new_kubernetes_form.html.haml 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_gcp.html.haml b/app/views/projects/clusters/new_gcp.html.haml new file mode 100644 index 00000000000..ad4b250db35 --- /dev/null +++ b/app/views/projects/clusters/new_gcp.html.haml @@ -0,0 +1,10 @@ +- breadcrumb_title "Cluster" +- page_title _("New Cluster") + +.row.prepend-top-default + .col-sm-4 + = render 'sidebar' + .col-sm-8 + = render 'header' + += render 'form' diff --git a/app/views/projects/clusters/new_kubernetes_form.html.haml b/app/views/projects/clusters/new_kubernetes_form.html.haml deleted file mode 100644 index c538d41ffad..00000000000 --- a/app/views/projects/clusters/new_kubernetes_form.html.haml +++ /dev/null @@ -1,9 +0,0 @@ -- breadcrumb_title "Cluster" -- page_title _("New Cluster") - -.row.prepend-top-default - .col-sm-4 - = 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 -- cgit v1.2.1