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/08/13 12:20:15 UTC

[incubator-dlab] 02/02: [DLAB-934]: extended group name validation on roles widget

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

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

commit 6408ba2a7fb1fec1b29ddcd94e383269e945c92b
Author: Andriana Kovalyshyn <An...@epam.com>
AuthorDate: Tue Aug 13 14:19:57 2019 +0200

    [DLAB-934]: extended group name validation on roles widget
---
 .../src/app/administration/roles/roles.component.html   | 17 +++++++++--------
 .../src/app/administration/roles/roles.component.ts     |  2 +-
 2 files changed, 10 insertions(+), 9 deletions(-)

diff --git a/services/self-service/src/main/resources/webapp/src/app/administration/roles/roles.component.html b/services/self-service/src/main/resources/webapp/src/app/administration/roles/roles.component.html
index fe499ae..fcba45d 100644
--- a/services/self-service/src/main/resources/webapp/src/app/administration/roles/roles.component.html
+++ b/services/self-service/src/main/resources/webapp/src/app/administration/roles/roles.component.html
@@ -28,15 +28,15 @@
   </div>
 
   <mat-card *ngIf="stepperView" class="m-top-10">
-    <mat-horizontal-stepper #stepper  class="stepper ani">
+    <mat-horizontal-stepper #stepper class="stepper ani">
       <mat-step>
         <ng-template matStepLabel>Groups</ng-template>
         <div class="inner-step mat-reset">
           <input [validator]="groupValidarion()" type="text" placeholder="Enter group name" [(ngModel)]="setupGroup"
             #setupGroupName="ngModel">
-          <div class="danger_color" *ngIf="setupGroupName.errors?.patterns && setupGroupName.dirty">Group name can only
+          <div class="error" *ngIf="setupGroupName.errors?.patterns && setupGroupName.dirty">Group name can only
             contain letters, numbers, hyphens and '_'</div>
-          <div class="danger_color" *ngIf="setupGroupName.errors?.duplicate && setupGroupName.dirty">Group name already
+          <div class="error" *ngIf="setupGroupName.errors?.duplicate && setupGroupName.dirty">Group name already
             exists</div>
         </div>
         <div class="text-center m-bott-10">
@@ -88,7 +88,7 @@
               class="material-icons">keyboard_arrow_left</i>Back</button>
           <button mat-raised-button (click)="resetDialog()" class="butt">Cancel</button>
           <button mat-raised-button (click)="manageAction('create', 'group')" class="butt butt-success"
-            [disabled]="!setupGroup || setupGroupName.errors?.pattern || !setupRoles.length > 0">Create</button>
+            [disabled]="!setupGroup || setupGroupName.errors?.patterns || setupGroupName.errors?.duplicate || !setupRoles.length > 0">Create</button>
         </div>
       </mat-step>
     </mat-horizontal-stepper>
@@ -107,8 +107,8 @@
         <td mat-cell *matCellDef="let element" class="roles mat-reset">
           <div class="selector-wrapper-edit">
             <mat-form-field>
-              <mat-select multiple [compareWith]="compareObjects" name="selected_roles" [(value)]="element.selected_roles"
-                placeholder="Select roles">
+              <mat-select multiple [compareWith]="compareObjects" name="selected_roles"
+                [(value)]="element.selected_roles" placeholder="Select roles">
                 <mat-option class="multiple-select" disabled>
                   <a class="select ani" (click)="selectAllOptions(element, rolesList, 'selected_roles')">
                     <i class="material-icons">playlist_add_check</i>&nbsp;All
@@ -157,8 +157,9 @@
             <mat-icon>delete_forever</mat-icon>
           </span>
           <span class="apply ani" matTooltip="Group cannot be updated without any selected role"
-                matTooltipPosition="above" [matTooltipDisabled]="element.selected_roles.length > 0"
-                [ngClass]="{ 'not-allowed' : !element.selected_roles.length }" (click)="manageAction('update', 'group', element)">
+            matTooltipPosition="above" [matTooltipDisabled]="element.selected_roles.length > 0"
+            [ngClass]="{ 'not-allowed' : !element.selected_roles.length }"
+            (click)="manageAction('update', 'group', element)">
             <mat-icon>done</mat-icon>
           </span>
         </td>
diff --git a/services/self-service/src/main/resources/webapp/src/app/administration/roles/roles.component.ts b/services/self-service/src/main/resources/webapp/src/app/administration/roles/roles.component.ts
index 2e94b25..95bd233 100644
--- a/services/self-service/src/main/resources/webapp/src/app/administration/roles/roles.component.ts
+++ b/services/self-service/src/main/resources/webapp/src/app/administration/roles/roles.component.ts
@@ -176,7 +176,7 @@ export class RolesComponent implements OnInit {
   public groupValidarion(): ValidatorFn {
     const duplicateList: any = this.groupsData.map(item => item.group);
     return <ValidatorFn>((control: FormControl) => {
-      if (control.value && duplicateList.includes(CheckUtils.delimitersFiltering(control.value))) {
+      if (control.value && duplicateList.includes(CheckUtils.delimitersFiltering(control.value.trim()))) {
         return { duplicate: true };
       }
 


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