Split views
This commit is contained in:
parent
83346192ce
commit
34d8694f1f
|
@ -0,0 +1,21 @@
|
|||
%h4= s_('ClusterIntegration|Enable cluster integration')
|
||||
.settings-content
|
||||
|
||||
.hidden.js-cluster-error.alert.alert-danger.alert-block.append-bottom-10{ role: 'alert' }
|
||||
= s_('ClusterIntegration|Something went wrong while creating your cluster on Google Container Engine')
|
||||
%p.js-error-reason
|
||||
|
||||
.hidden.js-cluster-creating.alert.alert-info.alert-block.append-bottom-10{ role: 'alert' }
|
||||
= s_('ClusterIntegration|Cluster is being created on Google Container Engine...')
|
||||
|
||||
.hidden.js-cluster-success.alert.alert-success.alert-block.append-bottom-10{ role: 'alert' }
|
||||
= s_('ClusterIntegration|Cluster was successfully created on Google Container Engine. Refresh the page to see cluster\'s details')
|
||||
|
||||
%p
|
||||
- if @cluster.enabled?
|
||||
- if can?(current_user, :update_cluster, @cluster)
|
||||
= s_('ClusterIntegration|Cluster integration is enabled for this project. Disabling this integration will not affect your cluster, it will only temporarily turn off GitLab\'s connection to it.')
|
||||
- else
|
||||
= s_('ClusterIntegration|Cluster integration is enabled for this project.')
|
||||
- else
|
||||
= s_('ClusterIntegration|Cluster integration is disabled for this project.')
|
|
@ -0,0 +1,16 @@
|
|||
= form_for @cluster, url: namespace_project_cluster_path(@project.namespace, @project, @cluster), as: :cluster do |field|
|
||||
= form_errors(@cluster)
|
||||
.form-group.append-bottom-20
|
||||
%label.append-bottom-10
|
||||
= field.hidden_field :enabled, { class: 'js-toggle-input'}
|
||||
|
||||
%button{ type: 'button',
|
||||
class: "js-toggle-cluster project-feature-toggle #{'checked' unless !@cluster.enabled?} #{'disabled' unless can?(current_user, :update_cluster, @cluster)}",
|
||||
'aria-label': s_('ClusterIntegration|Toggle Cluster'),
|
||||
disabled: !can?(current_user, :update_cluster, @cluster),
|
||||
data: { 'enabled-text': 'Enabled', 'disabled-text': 'Disabled' } }
|
||||
|
||||
- if can?(current_user, :update_cluster, @cluster)
|
||||
.form-group
|
||||
= field.submit _('Save'), class: 'btn btn-success'
|
||||
|
|
@ -1,4 +1,3 @@
|
|||
|
||||
%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}
|
||||
|
|
|
@ -13,48 +13,12 @@
|
|||
cluster_status_reason: @cluster.status_reason,
|
||||
help_path: help_page_path('user/project/clusters/index.md', anchor: 'installing-applications') } }
|
||||
|
||||
|
||||
.js-cluster-application-notice
|
||||
.flash-container
|
||||
|
||||
%section.settings.no-animate.expanded
|
||||
%h4= s_('ClusterIntegration|Enable cluster integration')
|
||||
.settings-content
|
||||
|
||||
.hidden.js-cluster-error.alert.alert-danger.alert-block.append-bottom-10{ role: 'alert' }
|
||||
= s_('ClusterIntegration|Something went wrong while creating your cluster on Google Container Engine')
|
||||
%p.js-error-reason
|
||||
|
||||
.hidden.js-cluster-creating.alert.alert-info.alert-block.append-bottom-10{ role: 'alert' }
|
||||
= s_('ClusterIntegration|Cluster is being created on Google Container Engine...')
|
||||
|
||||
.hidden.js-cluster-success.alert.alert-success.alert-block.append-bottom-10{ role: 'alert' }
|
||||
= s_('ClusterIntegration|Cluster was successfully created on Google Container Engine. Refresh the page to see cluster\'s details')
|
||||
|
||||
%p
|
||||
- if @cluster.enabled?
|
||||
- if can?(current_user, :update_cluster, @cluster)
|
||||
= s_('ClusterIntegration|Cluster integration is enabled for this project. Disabling this integration will not affect your cluster, it will only temporarily turn off GitLab\'s connection to it.')
|
||||
- else
|
||||
= s_('ClusterIntegration|Cluster integration is enabled for this project.')
|
||||
- else
|
||||
= s_('ClusterIntegration|Cluster integration is disabled for this project.')
|
||||
|
||||
= form_for @cluster, url: namespace_project_cluster_path(@project.namespace, @project, @cluster), as: :cluster do |field|
|
||||
= form_errors(@cluster)
|
||||
.form-group.append-bottom-20
|
||||
%label.append-bottom-10
|
||||
= field.hidden_field :enabled, { class: 'js-toggle-input'}
|
||||
|
||||
%button{ type: 'button',
|
||||
class: "js-toggle-cluster project-feature-toggle #{'checked' unless !@cluster.enabled?} #{'disabled' unless can?(current_user, :update_cluster, @cluster)}",
|
||||
'aria-label': s_('ClusterIntegration|Toggle Cluster'),
|
||||
disabled: !can?(current_user, :update_cluster, @cluster),
|
||||
data: { 'enabled-text': 'Enabled', 'disabled-text': 'Disabled' } }
|
||||
|
||||
- if can?(current_user, :update_cluster, @cluster)
|
||||
.form-group
|
||||
= field.submit _('Save'), class: 'btn btn-success'
|
||||
= render 'banner'
|
||||
= render 'enabled'
|
||||
|
||||
.cluster-applications-table#js-cluster-applications
|
||||
|
||||
|
|
|
@ -1,6 +1,5 @@
|
|||
= form_for @cluster, url: namespace_project_cluster_path(@project.namespace, @project, @cluster), as: :cluster do |field|
|
||||
= form_errors(@cluster)
|
||||
|
||||
.form-group
|
||||
= field.label :name, s_('ClusterIntegration|Cluster name')
|
||||
= field.text_field :name, class: 'form-control', placeholder: s_('ClusterIntegration|Cluster name')
|
||||
|
|
|
@ -13,27 +13,20 @@ FactoryGirl.define do
|
|||
provider_type :user
|
||||
platform_type :kubernetes
|
||||
|
||||
platform_kubernetes do
|
||||
create(:cluster_platform_kubernetes, :configured)
|
||||
end
|
||||
platform_kubernetes factory: [:cluster_platform_kubernetes, :configured]
|
||||
end
|
||||
|
||||
trait :provided_by_gcp do
|
||||
provider_type :gcp
|
||||
platform_type :kubernetes
|
||||
|
||||
before(:create) do |cluster, evaluator|
|
||||
cluster.platform_kubernetes = build(:cluster_platform_kubernetes, :configured)
|
||||
cluster.provider_gcp = build(:cluster_provider_gcp, :created)
|
||||
end
|
||||
provider_gcp factory: [:cluster_provider_gcp, :created]
|
||||
platform_kubernetes factory: [:cluster_platform_kubernetes, :configured]
|
||||
end
|
||||
|
||||
trait :providing_by_gcp do
|
||||
provider_type :gcp
|
||||
|
||||
provider_gcp do
|
||||
create(:cluster_provider_gcp, :creating)
|
||||
end
|
||||
provider_gcp factory: [:cluster_provider_gcp, :creating]
|
||||
end
|
||||
end
|
||||
end
|
||||
|
|
|
@ -21,11 +21,10 @@ feature 'User Cluster', :js do
|
|||
|
||||
context 'when user filled form with valid parameters' do
|
||||
before do
|
||||
fill_in 'cluster_provider_gcp_attributes_gcp_project_id', with: 'gcp-project-123'
|
||||
fill_in 'cluster_platform_kubernetes_attributes_api_url', with: 'http://example.com'
|
||||
fill_in 'cluster_platform_kubernetes_attributes_token', with: 'my-token'
|
||||
fill_in 'cluster_name', with: 'dev-cluster'
|
||||
click_button 'Create cluster'
|
||||
click_button 'Add cluster'
|
||||
end
|
||||
|
||||
it 'user sees a cluster details page and creation status' do
|
||||
|
@ -35,7 +34,7 @@ feature 'User Cluster', :js do
|
|||
|
||||
context 'when user filled form with invalid parameters' do
|
||||
before do
|
||||
click_button 'Create cluster'
|
||||
click_button 'Add cluster'
|
||||
end
|
||||
|
||||
it 'user sees a validation error' do
|
||||
|
@ -76,7 +75,7 @@ feature 'User Cluster', :js do
|
|||
|
||||
it 'user sees the successful message' do
|
||||
expect(page).to have_content('Cluster was successfully updated.')
|
||||
expect(cluster.reload.cluster_name).to eq('my-dev-cluster')
|
||||
expect(cluster.reload.name).to eq('my-dev-cluster')
|
||||
end
|
||||
end
|
||||
|
||||
|
@ -89,7 +88,7 @@ feature 'User Cluster', :js do
|
|||
|
||||
it 'user sees creation form with the successful message' do
|
||||
expect(page).to have_content('Cluster integration was successfully removed.')
|
||||
expect(page).to have_link('Create on GKE')
|
||||
expect(page).to have_link('Add an existing cluster')
|
||||
end
|
||||
end
|
||||
end
|
||||
|
|
Loading…
Reference in New Issue