summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorKamil Trzcinski <ayufan@ayufan.eu>2017-10-05 21:33:29 +0200
committerKamil Trzcinski <ayufan@ayufan.eu>2017-10-05 21:33:29 +0200
commit4cda11585c75ce923d357b0dbb91fb393ed8e303 (patch)
treef67a5375db33a4dc8d774732ae9514b540b4fb95
parent6712762b9d6e0391b1a38ca17cc3d982a336bbf9 (diff)
downloadgitlab-ce-4cda11585c75ce923d357b0dbb91fb393ed8e303.tar.gz
Fix almost all unresolved comments from Docs and UX review
-rw-r--r--app/controllers/projects/clusters_controller.rb4
-rw-r--r--app/services/ci/create_cluster_service.rb6
-rw-r--r--app/views/projects/clusters/_form.html.haml12
-rw-r--r--app/views/projects/clusters/_header.html.haml2
-rw-r--r--app/views/projects/clusters/_sidebar.html.haml2
-rw-r--r--app/views/projects/clusters/login.html.haml3
-rw-r--r--app/views/projects/clusters/new.html.haml3
-rw-r--r--app/views/projects/clusters/show.html.haml13
-rw-r--r--app/workers/wait_for_cluster_creation_worker.rb2
-rw-r--r--locale/gitlab.pot10
-rw-r--r--spec/controllers/projects/clusters_controller_spec.rb2
-rw-r--r--spec/features/projects/clusters_spec.rb4
12 files changed, 37 insertions, 26 deletions
diff --git a/app/controllers/projects/clusters_controller.rb b/app/controllers/projects/clusters_controller.rb
index 77644602b72..ce8e73392b8 100644
--- a/app/controllers/projects/clusters_controller.rb
+++ b/app/controllers/projects/clusters_controller.rb
@@ -70,10 +70,10 @@ class Projects::ClustersController < Projects::ApplicationController
def destroy
if cluster.destroy
- flash[:notice] = "Cluster was successfully removed."
+ flash[:notice] = "Cluster integration was successfully removed."
redirect_to project_clusters_path(project), status: 302
else
- flash[:notice] = "Cluster was not removed."
+ flash[:notice] = "Cluster integration was not removed."
render :show
end
end
diff --git a/app/services/ci/create_cluster_service.rb b/app/services/ci/create_cluster_service.rb
index d01e167ecc3..f7ee0e468e2 100644
--- a/app/services/ci/create_cluster_service.rb
+++ b/app/services/ci/create_cluster_service.rb
@@ -3,9 +3,11 @@ module Ci
def execute(access_token)
params['gcp_machine_type'] ||= GoogleApi::CloudPlatform::Client::DEFAULT_MACHINE_TYPE
- project.create_cluster(
+ cluster_params =
params.merge(user: current_user,
- gcp_token: access_token)).tap do |cluster|
+ gcp_token: access_token)
+
+ project.create_cluster(cluster_params).tap do |cluster|
ClusterProvisionWorker.perform_async(cluster.id) if cluster.persisted?
end
end
diff --git a/app/views/projects/clusters/_form.html.haml b/app/views/projects/clusters/_form.html.haml
index b5c4942f528..371cdb1e403 100644
--- a/app/views/projects/clusters/_form.html.haml
+++ b/app/views/projects/clusters/_form.html.haml
@@ -1,8 +1,8 @@
.row
.col-sm-8.col-sm-offset-4
%p
- -link_to_help_page = link_to(s_('ClusterIntegration|help page'), help_page_path('TODO'), target: '_blank', rel: 'noopener noreferrer')
- = s_('ClusterIntegration|Use our %{link_to_help_page} on cluster integration.').html_safe % { link_to_help_page: link_to_help_page}
+ - 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 [@project.namespace.becomes(Namespace), @project, @cluster] do |field|
= form_errors(@cluster)
@@ -18,16 +18,16 @@
.form-group
= field.label :gcp_cluster_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')
- = field.text_field :gcp_cluster_zone, class: 'form-control'
+ = field.text_field :gcp_cluster_zone, class: 'form-control', placeholder: 'us-central1-a'
.form-group
= field.label :gcp_cluster_size, s_('ClusterIntegration|Number of nodes')
- = field.text_field :gcp_cluster_size, class: 'form-control'
+ = field.text_field :gcp_cluster_size, class: 'form-control', placeholder: '3'
.form-group
= field.label :gcp_machine_type, s_('ClusterIntegration|Machine type')
- = link_to(s_('ClusterIntegration|Machine type'), 'https://cloud.google.com/compute/docs/machine-types', target: '_blank', rel: 'noopener noreferrer')
- = field.text_field :gcp_machine_type, class: 'form-control'
+ = link_to(s_('ClusterIntegration|See machine types'), 'https://cloud.google.com/compute/docs/machine-types', target: '_blank', rel: 'noopener noreferrer')
+ = field.text_field :gcp_machine_type, class: 'form-control', placeholder: 'n1-standard-4'
.form-group
= field.label :project_namespace, s_('ClusterIntegration|Project namespace (optional, unique)')
diff --git a/app/views/projects/clusters/_header.html.haml b/app/views/projects/clusters/_header.html.haml
index b3b98ea04f6..0134d46491c 100644
--- a/app/views/projects/clusters/_header.html.haml
+++ b/app/views/projects/clusters/_header.html.haml
@@ -1,7 +1,7 @@
%h4.prepend-top-0
= s_('ClusterIntegration|Create new cluster on Google Container Engine')
%p
- = s_('ClusterIntegration|To create a new cluster on Google Container Engine, please sign in with your Google account:')
+ = s_('ClusterIntegration|Please make sure that your Google account meets the following requirements:')
%ul
%li
- link_to_container_engine = link_to(s_('ClusterIntegration|access to Google Container Engine'), 'https://console.cloud.google.com', target: '_blank', rel: 'noopener noreferrer')
diff --git a/app/views/projects/clusters/_sidebar.html.haml b/app/views/projects/clusters/_sidebar.html.haml
index 0d744f1b028..761879db32b 100644
--- a/app/views/projects/clusters/_sidebar.html.haml
+++ b/app/views/projects/clusters/_sidebar.html.haml
@@ -3,5 +3,5 @@
%p
= s_('ClusterIntegration|With a cluster associated to this project, you can use review apps, deploy your applications, run your pipelines, and much more in an easy way.')
%p
- - link = link_to(s_('ClusterIntegration|cluster'), help_page_path('TODO'), target: '_blank', rel: 'noopener noreferrer')
+ - link = link_to(s_('ClusterIntegration|cluster'), help_page_path('user/project/clusters/index'), target: '_blank', rel: 'noopener noreferrer')
= s_('ClusterIntegration|Learn more about %{link_to_documentation}').html_safe % { link_to_documentation: link }
diff --git a/app/views/projects/clusters/login.html.haml b/app/views/projects/clusters/login.html.haml
index 5023abc5aa0..ae132672b7e 100644
--- a/app/views/projects/clusters/login.html.haml
+++ b/app/views/projects/clusters/login.html.haml
@@ -1,3 +1,6 @@
+- breadcrumb_title "Cluster"
+- page_title _("Login")
+
.row.prepend-top-default
.col-sm-4
= render 'sidebar'
diff --git a/app/views/projects/clusters/new.html.haml b/app/views/projects/clusters/new.html.haml
index 4b7214b3c62..c538d41ffad 100644
--- a/app/views/projects/clusters/new.html.haml
+++ b/app/views/projects/clusters/new.html.haml
@@ -1,3 +1,6 @@
+- breadcrumb_title "Cluster"
+- page_title _("New Cluster")
+
.row.prepend-top-default
.col-sm-4
= render 'sidebar'
diff --git a/app/views/projects/clusters/show.html.haml b/app/views/projects/clusters/show.html.haml
index b7b4c3c389c..651388ebde7 100644
--- a/app/views/projects/clusters/show.html.haml
+++ b/app/views/projects/clusters/show.html.haml
@@ -1,8 +1,11 @@
+- breadcrumb_title "Cluster"
+- page_title _("Cluster")
+
- status_path = status_namespace_project_cluster_path(@cluster.project.namespace, @cluster.project, @cluster.id, format: :json) if can?(current_user, :admin_cluster, @cluster) && @cluster.on_creation?
.row.prepend-top-default.edit-cluster-form.js-edit-cluster-form{ data: { status_path: status_path,
toggle_status: @cluster.enabled? ? 'true': 'false',
cluster_status: @cluster.status_name,
- cluster_status_reason: @cluster.status_reason }}
+ cluster_status_reason: @cluster.status_reason } }
.col-sm-4
= render 'sidebar'
.col-sm-8
@@ -35,26 +38,26 @@
- if can?(current_user, :admin_cluster, @cluster)
%label
- = s_('ClusterIntegration|Google container engine')
+ = s_('ClusterIntegration|Google Container Engine')
%p
- link_gke = link_to(s_('ClusterIntegration|Google Container Engine'), @cluster.gke_cluster_url, target: '_blank', rel: 'noopener noreferrer')
= s_('ClusterIntegration|Manage your cluster by visiting %{link_gke}').html_safe % { link_gke: link_gke }
.hidden.js-cluster-error.alert.alert-danger{ role: 'alert' }
- = s_('ClusterIntegration|Something went wrong while creating your cluster on Google Container Engine.')
+ = s_('ClusterIntegration|Something went wrong while creating your cluster on Google Container Engine')
%p.js-error-reason
.hidden.js-cluster-creating.alert.alert-info{ role: 'alert' }
= s_('ClusterIntegration|Cluster is being created on Google Container Engine...')
.hidden.js-cluster-success.alert.alert-info{ role: 'alert' }
- = s_('ClusterIntegration|Cluster was successfully created on Google Container Engine.')
+ = s_('ClusterIntegration|Cluster was successfully created on Google Container Engine')
.form_group
%label{ for: 'cluter_name' }
= s_('ClusterIntegration|Cluster name')
.input-group
- %input.form-control.cluster-name{ value: @cluster.gcp_cluster_name, disabled: true}
+ %input.form-control.cluster-name{ value: @cluster.gcp_cluster_name, disabled: true }
%span.input-group-addon.clipboard-addon
= clipboard_button(text: @cluster.gcp_cluster_name, title: s_('ClusterIntegration|Copy cluster name'))
diff --git a/app/workers/wait_for_cluster_creation_worker.rb b/app/workers/wait_for_cluster_creation_worker.rb
index f72bf409b20..eab340070e1 100644
--- a/app/workers/wait_for_cluster_creation_worker.rb
+++ b/app/workers/wait_for_cluster_creation_worker.rb
@@ -7,7 +7,7 @@ class WaitForClusterCreationWorker
TIMEOUT = 20.minutes
def perform(cluster_id)
- Gcp::Cluster.find_by_id(cluster_id).tap do |cluster|
+ Gcp::Cluster.find_by_id(cluster_id).try do |cluster|
Ci::FetchGcpOperationService.new.execute(cluster) do |operation|
case operation.status
when 'RUNNING'
diff --git a/locale/gitlab.pot b/locale/gitlab.pot
index 5c26f942b02..7569af9d175 100644
--- a/locale/gitlab.pot
+++ b/locale/gitlab.pot
@@ -388,7 +388,7 @@ msgstr ""
msgid "ClusterIntegration|Cluster name"
msgstr ""
-msgid "ClusterIntegration|Cluster was successfully created on Google Container Engine."
+msgid "ClusterIntegration|Cluster was successfully created on Google Container Engine"
msgstr ""
msgid "ClusterIntegration|Copy cluster name"
@@ -412,13 +412,13 @@ msgstr ""
msgid "ClusterIntegration|Google Container Engine project"
msgstr ""
-msgid "ClusterIntegration|Google container engine"
+msgid "ClusterIntegration|Google Container Engine"
msgstr ""
msgid "ClusterIntegration|Learn more about %{link_to_documentation}"
msgstr ""
-msgid "ClusterIntegration|Machine type"
+msgid "ClusterIntegration|See machine types"
msgstr ""
msgid "ClusterIntegration|Make sure your account %{link_to_requirements} to create clusters"
@@ -457,13 +457,13 @@ msgstr ""
msgid "ClusterIntegration|Something went wrong while creating your cluster on Google Container Engine."
msgstr ""
-msgid "ClusterIntegration|To create a new cluster on Google Container Engine, please sign in with your Google account:"
+msgid "ClusterIntegration|Please make sure that your Google account meets the following requirements:"
msgstr ""
msgid "ClusterIntegration|Toggle Cluster"
msgstr ""
-msgid "ClusterIntegration|Use our %{link_to_help_page} on cluster integration."
+msgid "ClusterIntegration|Read our %{link_to_help_page} on cluster integration."
msgstr ""
msgid "ClusterIntegration|With a cluster associated to this project, you can use review apps, deploy your applications, run your pipelines, and much more in an easy way."
diff --git a/spec/controllers/projects/clusters_controller_spec.rb b/spec/controllers/projects/clusters_controller_spec.rb
index 604b92caca6..b34702370e8 100644
--- a/spec/controllers/projects/clusters_controller_spec.rb
+++ b/spec/controllers/projects/clusters_controller_spec.rb
@@ -282,7 +282,7 @@ describe Projects::ClustersController do
subject
expect(response).to redirect_to(project_clusters_path(project))
- expect(flash[:notice]).to eq('Cluster was successfully removed.')
+ expect(flash[:notice]).to eq('Cluster integration was successfully removed.')
end
end
diff --git a/spec/features/projects/clusters_spec.rb b/spec/features/projects/clusters_spec.rb
index b836427513d..7f33629c938 100644
--- a/spec/features/projects/clusters_spec.rb
+++ b/spec/features/projects/clusters_spec.rb
@@ -46,7 +46,7 @@ feature 'Clusters', :js do
Gcp::Cluster.last.make_created!
- expect(page).to have_content('Cluster was successfully created on Google Container Engine.')
+ expect(page).to have_content('Cluster was successfully created on Google Container Engine')
end
end
@@ -92,7 +92,7 @@ feature 'Clusters', :js do
end
it 'user sees creation form with the succeccful message' do
- expect(page).to have_content('Cluster was successfully removed.')
+ expect(page).to have_content('Cluster integration was successfully removed.')
expect(page).to have_button('Create cluster')
end
end