You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@dlab.apache.org by an...@apache.org on 2019/11/15 09:00:16 UTC

[incubator-dlab] branch develop updated: fix validation DLabDLAB-1258

This is an automated email from the ASF dual-hosted git repository.

ankovalyshyn pushed a commit to branch develop
in repository https://gitbox.apache.org/repos/asf/incubator-dlab.git


The following commit(s) were added to refs/heads/develop by this push:
     new 98ca15c  fix validation DLabDLAB-1258
     new 7a519af  Merge pull request #416 from DG1202/DLAB-1258
98ca15c is described below

commit 98ca15c70ea8ce1c48d371086ab0f966cd390034
Author: Dmytro Gnatyshyn <di...@ukr.net>
AuthorDate: Thu Nov 14 17:31:32 2019 +0200

    fix validation DLabDLAB-1258
---
 .../computational-resource-create-dialog.component.html       |  6 +++---
 .../computational-resource-create-dialog.component.ts         | 11 +++--------
 .../main/resources/webapp/src/dictionary/aws.dictionary.ts    |  2 +-
 .../main/resources/webapp/src/dictionary/gcp.dictionary.ts    |  2 +-
 4 files changed, 8 insertions(+), 13 deletions(-)

diff --git a/services/self-service/src/main/resources/webapp/src/app/resources/computational/computational-resource-create-dialog/computational-resource-create-dialog.component.html b/services/self-service/src/main/resources/webapp/src/app/resources/computational/computational-resource-create-dialog/computational-resource-create-dialog.component.html
index cf41f0c..22b13ab 100644
--- a/services/self-service/src/main/resources/webapp/src/app/resources/computational/computational-resource-create-dialog/computational-resource-create-dialog.component.html
+++ b/services/self-service/src/main/resources/webapp/src/app/resources/computational/computational-resource-create-dialog/computational-resource-create-dialog.component.html
@@ -78,8 +78,8 @@
                 <span class="error" *ngIf="!resourceForm?.controls.cluster_alias_name.valid
                                             && resourceForm?.controls['cluster_alias_name'].dirty
                                             && !resourceForm?.controls['cluster_alias_name'].hasError('duplication')">
-                  Cluster name <span *ngIf="DICTIONARY.cloud_provider !== 'aws'">cannot be longer than 10 characters
-                    and</span> can only contain letters, numbers, hyphens and '_' but can not end with special
+                  Cluster name cannot be longer than {{DICTIONARY.max_cluster_name_length}} characters
+                    and can only contain letters, numbers, hyphens and '_' but can not end with special
                   characters
                 </span>
               </div>
@@ -219,7 +219,7 @@
         </div>
         <div class="text-center m-top-30">
           <button mat-raised-button type="button" (click)="dialogRef.close()" class="butt action">Cancel</button>
-          <button mat-raised-button type="button" [disabled]="!resourceForm?.valid || 
+          <button mat-raised-button type="button" [disabled]="!resourceForm?.valid ||
               (selectedImage?.image === 'docker.dlab-dataengine-service' && !resourceForm.value.shape_slave) ||
               (selectedImage?.image === 'docker.dlab-dataengine-service' && !resourceForm.value.version)"
             (click)="createComputationalResource(resourceForm.value)" class="butt butt-success action"
diff --git a/services/self-service/src/main/resources/webapp/src/app/resources/computational/computational-resource-create-dialog/computational-resource-create-dialog.component.ts b/services/self-service/src/main/resources/webapp/src/app/resources/computational/computational-resource-create-dialog/computational-resource-create-dialog.component.ts
index bcb5d61..24b9baf 100644
--- a/services/self-service/src/main/resources/webapp/src/app/resources/computational/computational-resource-create-dialog/computational-resource-create-dialog.component.ts
+++ b/services/self-service/src/main/resources/webapp/src/app/resources/computational/computational-resource-create-dialog/computational-resource-create-dialog.component.ts
@@ -85,7 +85,7 @@ export class ComputationalResourceCreateDialogComponent implements OnInit {
     this.getComputationalResourceLimits();
 
     if ($event.templates && $event.templates.length)
-      this.resourceForm.controls['version'].setValue($event.templates[0].version)
+      this.resourceForm.controls['version'].setValue($event.templates[0].version);
   }
 
   public selectSpotInstances($event?): void {
@@ -142,8 +142,8 @@ export class ComputationalResourceCreateDialogComponent implements OnInit {
       version: [''],
       shape_master: ['', Validators.required],
       shape_slave: [''],
-      cluster_alias_name: ['', [Validators.required, Validators.pattern(PATTERNS.namePattern),
-      this.providerMaxLength, this.checkDuplication.bind(this)]],
+      cluster_alias_name: ['', [Validators.required, Validators.pattern(PATTERNS.namePattern), Validators.maxLength(DICTIONARY.max_cluster_name_length),
+      this.checkDuplication.bind(this)]],
       instance_number: ['', [Validators.required, Validators.pattern(PATTERNS.nodeCountPattern), this.validInstanceNumberRange.bind(this)]],
       preemptible_instance_number: [0, Validators.compose([Validators.pattern(PATTERNS.integerRegex), this.validPreemptibleRange.bind(this)])],
       instance_price: [0, [this.validInstanceSpotRange.bind(this)]],
@@ -232,11 +232,6 @@ export class ComputationalResourceCreateDialogComponent implements OnInit {
       return { duplication: true };
   }
 
-  private providerMaxLength(control) {
-    if (DICTIONARY.cloud_provider !== 'aws')
-      return control.value.length <= DICTIONARY.max_cluster_name_length ? null : { valid: false };
-  }
-
   private getTemplates(project, endpoint) {
     this.userResourceService.getComputationalTemplates(project, endpoint).subscribe(
       clusterTypes => {
diff --git a/services/self-service/src/main/resources/webapp/src/dictionary/aws.dictionary.ts b/services/self-service/src/main/resources/webapp/src/dictionary/aws.dictionary.ts
index fd767e7..64c1b6c 100644
--- a/services/self-service/src/main/resources/webapp/src/dictionary/aws.dictionary.ts
+++ b/services/self-service/src/main/resources/webapp/src/dictionary/aws.dictionary.ts
@@ -34,7 +34,7 @@ export const NAMING_CONVENTION = {
     'total_instance_number': 'total_instance_number',
     'spot_instance': 'Spot instance',
     'cluster_version': 'emr_version',
-    'max_cluster_name_length': 64,
+    'max_cluster_name_length': 10,
     'billing': {
         'resourceName': 'resource_name',
         'cost': 'cost',
diff --git a/services/self-service/src/main/resources/webapp/src/dictionary/gcp.dictionary.ts b/services/self-service/src/main/resources/webapp/src/dictionary/gcp.dictionary.ts
index 3d6f26e..554e5ee 100644
--- a/services/self-service/src/main/resources/webapp/src/dictionary/gcp.dictionary.ts
+++ b/services/self-service/src/main/resources/webapp/src/dictionary/gcp.dictionary.ts
@@ -36,7 +36,7 @@ export const NAMING_CONVENTION = {
 
     'spot_instance': 'Preemptible worker nodes',
     'cluster_version': 'dataproc_version',
-    'max_cluster_name_length': 9,
+    'max_cluster_name_length': 7,
     'billing': {
         'resourceName': 'resource_name',
         'cost': 'cost',


---------------------------------------------------------------------
To unsubscribe, e-mail: commits-unsubscribe@dlab.apache.org
For additional commands, e-mail: commits-help@dlab.apache.org