diff options
author | Enrique Alcántara <ealcantara@gitlab.com> | 2019-09-09 20:27:51 +0000 |
---|---|---|
committer | Douglas Barbosa Alexandre <dbalexandre@gmail.com> | 2019-09-09 20:27:51 +0000 |
commit | 90e3a4919fd977c1615a5270fd49146140159f6c (patch) | |
tree | a6a304f25a361037a94d4dcb3468344feeda5d78 /app/controllers/clusters/clusters_controller.rb | |
parent | 56342d8895da85f71900ec7be171d7a2daea5ee0 (diff) | |
download | gitlab-ce-90e3a4919fd977c1615a5270fd49146140159f6c.tar.gz |
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
Diffstat (limited to 'app/controllers/clusters/clusters_controller.rb')
-rw-r--r-- | app/controllers/clusters/clusters_controller.rb | 13 |
1 files changed, 10 insertions, 3 deletions
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, |