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/03/19 19:59:56 UTC

[incubator-dlab] branch v2.1-RC2-manage-roles-bugfix created (now 800594e)

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

ankovalyshyn pushed a change to branch v2.1-RC2-manage-roles-bugfix
in repository https://gitbox.apache.org/repos/asf/incubator-dlab.git.


      at 800594e  [DLAB-573]: fixed preemptible node validation

This branch includes the following new commits:

     new 800594e  [DLAB-573]: fixed preemptible node validation

The 1 revisions listed above as "new" are entirely new to this
repository and will be described in separate emails.  The revisions
listed as "add" were already present in the repository and have only
been added to this reference.



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


[incubator-dlab] 01/01: [DLAB-573]: fixed preemptible node validation

Posted by an...@apache.org.
This is an automated email from the ASF dual-hosted git repository.

ankovalyshyn pushed a commit to branch v2.1-RC2-manage-roles-bugfix
in repository https://gitbox.apache.org/repos/asf/incubator-dlab.git

commit 800594ed5987d8f14157fe8ecb265af90b9b9223
Author: Andriana Kovalyshyn <An...@epam.com>
AuthorDate: Tue Mar 19 21:59:42 2019 +0200

    [DLAB-573]: fixed preemptible node validation
---
 .../manage-roles-groups/group-name-validarion.directive.ts  |  4 ++--
 .../manage-roles-groups/manage-roles-groups.component.html  |  1 -
 .../computational-resource-create-dialog.component.html     |  8 ++++++--
 .../computational-resource-create-dialog.component.scss     |  3 +++
 .../computational-resource-create-dialog.component.ts       | 13 +++++++++++--
 5 files changed, 22 insertions(+), 7 deletions(-)

diff --git a/services/self-service/src/main/resources/webapp/src/app/health-status/manage-roles-groups/group-name-validarion.directive.ts b/services/self-service/src/main/resources/webapp/src/app/health-status/manage-roles-groups/group-name-validarion.directive.ts
index cb19b94..879e3e2 100644
--- a/services/self-service/src/main/resources/webapp/src/app/health-status/manage-roles-groups/group-name-validarion.directive.ts
+++ b/services/self-service/src/main/resources/webapp/src/app/health-status/manage-roles-groups/group-name-validarion.directive.ts
@@ -25,14 +25,14 @@ import { AbstractControl, NG_VALIDATORS, Validator } from '@angular/forms';
   selector: '[validator][ngModel],[group-dir][ngFormControl]',
   providers: [{
     multi: true,
-    provide: NG_VALIDATORS, 
+    provide: NG_VALIDATORS,
     useExisting: forwardRef(() => GroupNameValidationDirective)
   }]
 })
 export class GroupNameValidationDirective implements Validator {
   @Input() validator: Function;
 
-  validate(control: AbstractControl):{ [key: string]: any; } {
+  validate(control: AbstractControl): { [key: string]: any; } {
     return this.validator(control);
   }
 }
diff --git a/services/self-service/src/main/resources/webapp/src/app/health-status/manage-roles-groups/manage-roles-groups.component.html b/services/self-service/src/main/resources/webapp/src/app/health-status/manage-roles-groups/manage-roles-groups.component.html
index 85b751b..d977662 100644
--- a/services/self-service/src/main/resources/webapp/src/app/health-status/manage-roles-groups/manage-roles-groups.component.html
+++ b/services/self-service/src/main/resources/webapp/src/app/health-status/manage-roles-groups/manage-roles-groups.component.html
@@ -151,4 +151,3 @@
     </div>
   </modal-content>
 </modal-dialog>
-
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 e92d45a..d51eea3 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
@@ -91,7 +91,7 @@
           </div>
         </div>
 
-        <div class="checkbox-group m-top-30" *ngIf="PROVIDER === 'gcp' && model.selectedImage?.image === 'docker.dlab-dataengine-service'">
+        <div class="checkbox-group m-top-30 m-bott-10" *ngIf="PROVIDER === 'gcp' && model.selectedImage?.image === 'docker.dlab-dataengine-service'">
           <label>
             <input #preemptibleNode type="checkbox" (change)="selectPreemptibleNodes($event)" /> Preemptible nodes
           </label>
@@ -99,7 +99,11 @@
             <div *ngIf="preemptible?.nativeElement['checked']" class="control-group">
               <label class="label">Preemptible node count</label>
               <div class="control">
-                <input type="number" class="form-control" min="{{minPreemptibleInstanceNumber}}" max="{{maxPreemptibleInstanceNumber}}" formControlName="preemptible_instance_number" (keypress)="isNumberKey($event)" />
+                <input type="text" class="form-control"
+                  formControlName="preemptible_instance_number"
+                  (keypress)="isNumberKey($event)"
+                  (keydown.arrowup)="preemptibleCounter($event, 'increment')"
+                  (keydown.arrowdown)="preemptibleCounter($event, 'decrement')" />
                 <span class="danger_color" *ngIf="!resourceForm?.controls.preemptible_instance_number.valid">
                   <span *ngIf="minPreemptibleInstanceNumber !== maxPreemptibleInstanceNumber; else equal">
                     Only integer values greater than or equal to {{ minPreemptibleInstanceNumber }} and less than {{ maxPreemptibleInstanceNumber }} are allowed
diff --git a/services/self-service/src/main/resources/webapp/src/app/resources/computational/computational-resource-create-dialog/computational-resource-create-dialog.component.scss b/services/self-service/src/main/resources/webapp/src/app/resources/computational/computational-resource-create-dialog/computational-resource-create-dialog.component.scss
index 5eef8c3..52135e5 100644
--- a/services/self-service/src/main/resources/webapp/src/app/resources/computational/computational-resource-create-dialog/computational-resource-create-dialog.component.scss
+++ b/services/self-service/src/main/resources/webapp/src/app/resources/computational/computational-resource-create-dialog/computational-resource-create-dialog.component.scss
@@ -73,6 +73,9 @@
     }
   }
   .preemptible-details {
+    .label {
+      padding-left: 10px;
+    }
     .control {
       position: relative;
     }
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 c5635e7..f6b3cf4 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
@@ -48,6 +48,7 @@ export class ComputationalResourceCreateDialogComponent implements OnInit {
   clusterNamePattern: string = '[-_a-zA-Z0-9]*[_-]*[a-zA-Z0-9]+';
   nodeCountPattern: string = '^[1-9]\\d*$';
   delimitersRegex = /[-_]?/g;
+  integerRegex = '^[0-9]*$';
 
   public minInstanceNumber: number;
   public maxInstanceNumber: number;
@@ -179,7 +180,7 @@ export class ComputationalResourceCreateDialogComponent implements OnInit {
   }
 
   public selectConfiguration() {
-    if (this.configuration.nativeElement.checked) {
+    if (this.configuration && this.configuration.nativeElement.checked) {
       const template = (this.model.selectedImage.image === 'docker.dlab-dataengine-service')
         ? CLUSTER_CONFIGURATION.EMR
         : CLUSTER_CONFIGURATION.SPARK;
@@ -235,6 +236,14 @@ export class ComputationalResourceCreateDialogComponent implements OnInit {
     }
   }
 
+  public preemptibleCounter($event, action): void {
+    $event.preventDefault();
+
+    const value = this.resourceForm.controls['preemptible_instance_number'].value;
+    const newValue = (action === 'increment' ? Number(value) + 1 : Number(value) - 1);
+    this.resourceForm.controls.preemptible_instance_number.setValue(newValue);
+  }
+
   public close(): void {
     if (this.bindDialog.isOpened)
       this.bindDialog.close();
@@ -245,7 +254,7 @@ export class ComputationalResourceCreateDialogComponent implements OnInit {
       cluster_alias_name: ['', [Validators.required, Validators.pattern(this.clusterNamePattern),
                                 this.providerMaxLength, this.checkDuplication.bind(this)]],
       instance_number: ['', [Validators.required, Validators.pattern(this.nodeCountPattern), this.validInstanceNumberRange.bind(this)]],
-      preemptible_instance_number: [0, [this.validPreemptibleRange.bind(this)]],
+      preemptible_instance_number: [0, Validators.compose([Validators.pattern(this.integerRegex), this.validPreemptibleRange.bind(this)])],
       instance_price: [0, [this.validInstanceSpotRange.bind(this)]],
       configuration_parameters: ['', [this.validConfiguration.bind(this)]]
     });


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