diff options
Diffstat (limited to 'app/assets/javascripts/create_cluster/eks_cluster/components/eks_cluster_configuration_form.vue')
-rw-r--r-- | app/assets/javascripts/create_cluster/eks_cluster/components/eks_cluster_configuration_form.vue | 23 |
1 files changed, 17 insertions, 6 deletions
diff --git a/app/assets/javascripts/create_cluster/eks_cluster/components/eks_cluster_configuration_form.vue b/app/assets/javascripts/create_cluster/eks_cluster/components/eks_cluster_configuration_form.vue index aefb31fe3d5..74b5a62f754 100644 --- a/app/assets/javascripts/create_cluster/eks_cluster/components/eks_cluster_configuration_form.vue +++ b/app/assets/javascripts/create_cluster/eks_cluster/components/eks_cluster_configuration_form.vue @@ -1,5 +1,5 @@ <script> -import { createNamespacedHelpers, mapState, mapActions } from 'vuex'; +import { createNamespacedHelpers, mapState, mapActions, mapGetters } from 'vuex'; import { escape as esc } from 'lodash'; import { GlFormInput, GlFormCheckbox } from '@gitlab/ui'; import { sprintf, s__ } from '~/locale'; @@ -61,6 +61,7 @@ export default { 'gitlabManagedCluster', 'isCreatingCluster', ]), + ...mapGetters(['subnetValid']), ...mapRolesState({ roles: 'items', isLoadingRoles: 'isLoadingItems', @@ -119,7 +120,7 @@ export default { !this.selectedRegion || !this.selectedKeyPair || !this.selectedVpc || - !this.selectedSubnet || + !this.subnetValid || !this.selectedRole || !this.selectedSecurityGroup || !this.selectedInstanceType || @@ -127,6 +128,9 @@ export default { this.isCreatingCluster ); }, + displaySubnetError() { + return Boolean(this.loadingSubnetsError) || this.selectedSubnet?.length === 1; + }, createClusterButtonLabel() { return this.isCreatingCluster ? s__('ClusterIntegration|Creating Kubernetes cluster') @@ -216,6 +220,13 @@ export default { false, ); }, + subnetValidationErrorText() { + if (this.loadingSubnetsError) { + return s__('ClusterIntegration|Could not load subnets for the selected VPC'); + } + + return s__('ClusterIntegration|You should select at least two subnets'); + }, securityGroupDropdownHelpText() { return sprintf( s__( @@ -289,14 +300,14 @@ export default { this.setRegion({ region }); this.setVpc({ vpc: null }); this.setKeyPair({ keyPair: null }); - this.setSubnet({ subnet: null }); + this.setSubnet({ subnet: [] }); this.setSecurityGroup({ securityGroup: null }); this.fetchVpcs({ region }); this.fetchKeyPairs({ region }); }, setVpcAndFetchSubnets(vpc) { this.setVpc({ vpc }); - this.setSubnet({ subnet: null }); + this.setSubnet({ subnet: [] }); this.setSecurityGroup({ securityGroup: null }); this.fetchSubnets({ vpc, region: this.selectedRegion }); this.fetchSecurityGroups({ vpc, region: this.selectedRegion }); @@ -436,8 +447,8 @@ export default { :placeholder="s__('ClusterIntergation|Select a subnet')" :search-field-placeholder="s__('ClusterIntegration|Search subnets')" :empty-text="s__('ClusterIntegration|No subnet found')" - :has-errors="Boolean(loadingSubnetsError)" - :error-message="s__('ClusterIntegration|Could not load subnets for the selected VPC')" + :has-errors="displaySubnetError" + :error-message="subnetValidationErrorText" @input="setSubnet({ subnet: $event })" /> <p class="form-text text-muted" v-html="subnetDropdownHelpText"></p> |