From d03b205bdd898aca2966cace28bae117b7b257b4 Mon Sep 17 00:00:00 2001 From: Filipa Lacerda Date: Wed, 8 Nov 2017 11:05:10 +0000 Subject: [PATCH] Adds dropdown Fixed HTML --- .../projects/clusters/_dropdown.html.haml | 13 +++++ app/views/projects/clusters/_form.html.haml | 12 ++--- app/views/projects/clusters/_header.html.haml | 4 +- .../projects/clusters/gcp/_form.html.haml | 51 +++++++++---------- app/views/projects/clusters/gcp/new.html.haml | 4 +- .../clusters/kubernetes/_form.html.haml | 46 ++++++++--------- .../clusters/kubernetes/new.html.haml | 4 +- 7 files changed, 68 insertions(+), 66 deletions(-) create mode 100644 app/views/projects/clusters/_dropdown.html.haml diff --git a/app/views/projects/clusters/_dropdown.html.haml b/app/views/projects/clusters/_dropdown.html.haml new file mode 100644 index 00000000000..f34d0c05746 --- /dev/null +++ b/app/views/projects/clusters/_dropdown.html.haml @@ -0,0 +1,13 @@ +%h4.prepend-top-0= s_('ClusterIntegration|Choose how to set up cluster integration') + +.dropdown + %button.dropdown-toggle.form-control{ type: 'button', data: { toggle: 'dropdown' }, "aria-haspopup": true, "aria-expanded": false } + = dropdown_text + %span.caret + %ul.dropdown-menu + %li + %a{ href: providers_gcp_new_namespace_project_clusters_path(@project.namespace, @project) } + = s_('ClusterIntegration| Create cluster on Google Engine') + %li + %a{ href: platforms_kubernetes_new_namespace_project_clusters_path(@project.namespace, @project)} + = s_('ClusterIntegration| Add existing cluster') diff --git a/app/views/projects/clusters/_form.html.haml b/app/views/projects/clusters/_form.html.haml index acd4e5c058d..0f1f18b662b 100644 --- a/app/views/projects/clusters/_form.html.haml +++ b/app/views/projects/clusters/_form.html.haml @@ -10,12 +10,12 @@ = form_errors(@cluster) = field.fields_for :platform_kubernetes, @cluster.platform_kubernetes do |platform_kubernetes_field| .form-group - = platform_kubernetes_field.label :api_url, s_('ClusterIntegration|API URL') - = platform_kubernetes_field.text_field :api_url, class: 'form-control', disabled: @cluster.managed? + = platform_kubernetes_field.label :api_url, s_('ClusterIntegration|API URL') + = platform_kubernetes_field.text_field :api_url, class: 'form-control', disabled: @cluster.managed? .form-group - = platform_kubernetes_field.label :namespace, s_('ClusterIntegration|Project namespace (optional, unique)') - = platform_kubernetes_field.text_field :namespace, class: 'form-control', placeholder: Clusters::Platforms::Kubernetes.namespace_for_project(@project), disabled: @cluster.managed? + = platform_kubernetes_field.label :namespace, s_('ClusterIntegration|Project namespace (optional, unique)') + = platform_kubernetes_field.text_field :namespace, class: 'form-control', placeholder: Clusters::Platforms::Kubernetes.namespace_for_project(@project), disabled: @cluster.managed? - .form-group - = field.submit s_('ClusterIntegration|Save cluster'), class: 'btn btn-save' + .form-group + = field.submit s_('ClusterIntegration|Save cluster'), class: 'btn btn-save' diff --git a/app/views/projects/clusters/_header.html.haml b/app/views/projects/clusters/_header.html.haml index beb798e7154..36452381343 100644 --- a/app/views/projects/clusters/_header.html.haml +++ b/app/views/projects/clusters/_header.html.haml @@ -1,5 +1,5 @@ -%h4.prepend-top-0 - = s_('ClusterIntegration|Create new cluster on Google Container Engine') +%h4 + = s_('ClusterIntegration|Enter the details for your cluster') %p = s_('ClusterIntegration|Please make sure that your Google account meets the following requirements:') %ul diff --git a/app/views/projects/clusters/gcp/_form.html.haml b/app/views/projects/clusters/gcp/_form.html.haml index 139796cf798..214e2d1c693 100644 --- a/app/views/projects/clusters/gcp/_form.html.haml +++ b/app/views/projects/clusters/gcp/_form.html.haml @@ -1,34 +1,29 @@ -.row - .col-sm-8.col-sm-offset-4 - %p - - link_to_help_page = link_to(s_('ClusterIntegration|help page'), help_page_path('user/project/clusters/index'), target: '_blank', rel: 'noopener noreferrer') - = s_('ClusterIntegration|Read our %{link_to_help_page} on cluster integration.').html_safe % { link_to_help_page: link_to_help_page} - = form_for @cluster, url: providers_gcp_namespace_project_clusters_path(@project.namespace, @project), as: :cluster do |field| - = form_errors(@cluster) - .form-group - = field.label :name, s_('ClusterIntegration|Cluster name') - = field.text_field :name, class: 'form-control' += form_for @cluster, url: providers_gcp_namespace_project_clusters_path(@project.namespace, @project), as: :cluster do |field| + = form_errors(@cluster) + .form-group + = field.label :name, s_('ClusterIntegration|Cluster name') + = field.text_field :name, class: 'form-control' - = field.fields_for :provider_gcp, @cluster.provider_gcp do |provider_gcp_field| - .form-group - = provider_gcp_field.label :gcp_project_id, s_('ClusterIntegration|Google Cloud Platform project ID') - = link_to(s_('ClusterIntegration|See your projects'), 'https://console.cloud.google.com/home/dashboard', target: '_blank', rel: 'noopener noreferrer') - = provider_gcp_field.text_field :gcp_project_id, class: 'form-control' + = field.fields_for :provider_gcp, @cluster.provider_gcp do |provider_gcp_field| + .form-group + = provider_gcp_field.label :gcp_project_id, s_('ClusterIntegration|Google Cloud Platform project ID') + = link_to(s_('ClusterIntegration|See your projects'), 'https://console.cloud.google.com/home/dashboard', target: '_blank', rel: 'noopener noreferrer') + = provider_gcp_field.text_field :gcp_project_id, class: 'form-control' - .form-group - = provider_gcp_field.label :zone, s_('ClusterIntegration|Zone') - = link_to(s_('ClusterIntegration|See zones'), 'https://cloud.google.com/compute/docs/regions-zones/regions-zones', target: '_blank', rel: 'noopener noreferrer') - = provider_gcp_field.text_field :zone, class: 'form-control', placeholder: 'us-central1-a' + .form-group + = provider_gcp_field.label :zone, s_('ClusterIntegration|Zone') + = link_to(s_('ClusterIntegration|See zones'), 'https://cloud.google.com/compute/docs/regions-zones/regions-zones', target: '_blank', rel: 'noopener noreferrer') + = provider_gcp_field.text_field :zone, class: 'form-control', placeholder: 'us-central1-a' - .form-group - = provider_gcp_field.label :num_nodes, s_('ClusterIntegration|Number of nodes') - = provider_gcp_field.text_field :num_nodes, class: 'form-control', placeholder: '3' + .form-group + = provider_gcp_field.label :num_nodes, s_('ClusterIntegration|Number of nodes') + = provider_gcp_field.text_field :num_nodes, class: 'form-control', placeholder: '3' - .form-group - = provider_gcp_field.label :machine_type, s_('ClusterIntegration|Machine type') - = link_to(s_('ClusterIntegration|See machine types'), 'https://cloud.google.com/compute/docs/machine-types', target: '_blank', rel: 'noopener noreferrer') - = provider_gcp_field.text_field :machine_type, class: 'form-control', placeholder: 'n1-standard-4' + .form-group + = provider_gcp_field.label :machine_type, s_('ClusterIntegration|Machine type') + = link_to(s_('ClusterIntegration|See machine types'), 'https://cloud.google.com/compute/docs/machine-types', target: '_blank', rel: 'noopener noreferrer') + = provider_gcp_field.text_field :machine_type, class: 'form-control', placeholder: 'n1-standard-4' - .form-group - = field.submit s_('ClusterIntegration|Create cluster'), class: 'btn btn-save' + .form-group + = field.submit s_('ClusterIntegration|Create cluster'), class: 'btn btn-save' diff --git a/app/views/projects/clusters/gcp/new.html.haml b/app/views/projects/clusters/gcp/new.html.haml index 75a1ad6e4b2..7de53b24199 100644 --- a/app/views/projects/clusters/gcp/new.html.haml +++ b/app/views/projects/clusters/gcp/new.html.haml @@ -5,6 +5,6 @@ .col-sm-4 = render 'projects/clusters/sidebar' .col-sm-8 + = render 'projects/clusters/dropdown', dropdown_text: s_('ClusterIntegration|Create cluster on Google Container Engine') = render 'projects/clusters/header' - -= render 'form' + = render 'form' diff --git a/app/views/projects/clusters/kubernetes/_form.html.haml b/app/views/projects/clusters/kubernetes/_form.html.haml index e6c89513aa8..22a6a16540e 100644 --- a/app/views/projects/clusters/kubernetes/_form.html.haml +++ b/app/views/projects/clusters/kubernetes/_form.html.haml @@ -1,31 +1,25 @@ -.row - .col-sm-8.col-sm-offset-4 - %p - - link_to_help_page = link_to(s_('ClusterIntegration|help page'), help_page_path('user/project/clusters/index'), target: '_blank', rel: 'noopener noreferrer') - = s_('ClusterIntegration|Read our %{link_to_help_page} on cluster integration.').html_safe % { link_to_help_page: link_to_help_page} += form_for @cluster, url: platforms_kubernetes_namespace_project_clusters_path(@project.namespace, @project), as: :cluster do |field| + = form_errors(@cluster) + .form-group + = field.label :name, s_('ClusterIntegration|Cluster name') + = field.text_field :name, class: 'form-control' - = form_for @cluster, url: platforms_kubernetes_namespace_project_clusters_path(@project.namespace, @project), as: :cluster do |field| - = form_errors(@cluster) - .form-group - = field.label :name, s_('ClusterIntegration|Cluster name') - = field.text_field :name, class: 'form-control' + = field.fields_for :platform_kubernetes, @cluster.platform_kubernetes do |platform_kubernetes_field| + .form-group + = platform_kubernetes_field.label :api_url, s_('ClusterIntegration|API URL') + = platform_kubernetes_field.text_field :api_url, class: 'form-control' - = field.fields_for :platform_kubernetes, @cluster.platform_kubernetes do |platform_kubernetes_field| - .form-group - = platform_kubernetes_field.label :api_url, s_('ClusterIntegration|API URL') - = platform_kubernetes_field.text_field :api_url, class: 'form-control' + .form-group + = platform_kubernetes_field.label :token, s_('ClusterIntegration|Token') + = platform_kubernetes_field.text_field :token, class: 'form-control' - .form-group - = platform_kubernetes_field.label :token, s_('ClusterIntegration|Token') - = platform_kubernetes_field.text_field :token, class: 'form-control' + .form-group + = platform_kubernetes_field.label :ca_cert, s_('ClusterIntegration|Token') + = platform_kubernetes_field.text_field :ca_cert, class: 'form-control' - .form-group - = platform_kubernetes_field.label :ca_cert, s_('ClusterIntegration|Token') - = platform_kubernetes_field.text_field :ca_cert, class: 'form-control' + .form-group + = platform_kubernetes_field.label :namespace, s_('ClusterIntegration|Project namespace (optional, unique)') + = platform_kubernetes_field.text_field :namespace, class: 'form-control', placeholder: Clusters::Platforms::Kubernetes.namespace_for_project(@project) - .form-group - = platform_kubernetes_field.label :namespace, s_('ClusterIntegration|Project namespace (optional, unique)') - = platform_kubernetes_field.text_field :namespace, class: 'form-control', placeholder: Clusters::Platforms::Kubernetes.namespace_for_project(@project) - - .form-group - = field.submit s_('ClusterIntegration|Create cluster'), class: 'btn btn-save' + .form-group + = field.submit s_('ClusterIntegration|Create cluster'), class: 'btn btn-save' diff --git a/app/views/projects/clusters/kubernetes/new.html.haml b/app/views/projects/clusters/kubernetes/new.html.haml index 75a1ad6e4b2..72f0e772b9c 100644 --- a/app/views/projects/clusters/kubernetes/new.html.haml +++ b/app/views/projects/clusters/kubernetes/new.html.haml @@ -5,6 +5,6 @@ .col-sm-4 = render 'projects/clusters/sidebar' .col-sm-8 + = render 'projects/clusters/dropdown', dropdown_text: s_('ClusterIntegration|Add existing cluster') = render 'projects/clusters/header' - -= render 'form' + = render 'form'