From 90e3a4919fd977c1615a5270fd49146140159f6c Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Enrique=20Alc=C3=A1ntara?= Date: Mon, 9 Sep 2019 20:27:51 +0000 Subject: Create new feature flagged UI for cloud providers - Create HAML UI select a cloud provider to create a cluster. - Add query param to :new cluster view to display a specific cluster provider form depending on the value of the provider query param. - Update unit tests and e2e tests to reflect these changes --- app/controllers/clusters/clusters_controller.rb | 13 ++++++++++--- 1 file changed, 10 insertions(+), 3 deletions(-) (limited to 'app/controllers') diff --git a/app/controllers/clusters/clusters_controller.rb b/app/controllers/clusters/clusters_controller.rb index ec8077d18e3..bcd771dafcf 100644 --- a/app/controllers/clusters/clusters_controller.rb +++ b/app/controllers/clusters/clusters_controller.rb @@ -35,6 +35,12 @@ class Clusters::ClustersController < Clusters::BaseController end def new + return unless Feature.enabled?(:create_eks_clusters) + + @gke_selected = params[:provider] == 'gke' + @eks_selected = params[:provider] == 'eks' + + return redirect_to @authorize_url if @gke_selected && @authorize_url && !@valid_gcp_token end # Overridding ActionController::Metal#status is NOT a good idea @@ -99,7 +105,7 @@ class Clusters::ClustersController < Clusters::BaseController validate_gcp_token user_cluster - render :new, locals: { active_tab: 'gcp' } + render :new, locals: { active_tab: 'create' } end end @@ -116,7 +122,7 @@ class Clusters::ClustersController < Clusters::BaseController validate_gcp_token gcp_cluster - render :new, locals: { active_tab: 'user' } + render :new, locals: { active_tab: 'add' } end end @@ -189,7 +195,8 @@ class Clusters::ClustersController < Clusters::BaseController end def generate_gcp_authorize_url - state = generate_session_key_redirect(clusterable.new_path.to_s) + params = Feature.enabled?(:create_eks_clusters) ? { provider: :gke } : {} + state = generate_session_key_redirect(clusterable.new_path(params).to_s) @authorize_url = GoogleApi::CloudPlatform::Client.new( nil, callback_google_api_auth_url, -- cgit v1.2.1