This is an automated email from the ASF dual-hosted git repository. dgnatyshyn pushed a commit to branch DLAB-1942 in repository https://gitbox.apache.org/repos/asf/incubator-dlab.git
commit a15bff83d46a2e685499430a60513c145cdd6e08 Author: Dmytro_Gnatyshyn <di1...@ukr.net> AuthorDate: Fri Aug 14 16:46:28 2020 +0300 [DLAB-1942]: Added validation for user adding to group --- .../webapp/src/app/administration/roles/roles.component.html | 6 +++--- .../webapp/src/app/administration/roles/roles.component.ts | 4 ++-- 2 files changed, 5 insertions(+), 5 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 3212876..31199dc 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 @@ -119,9 +119,9 @@ <td mat-cell *matCellDef="let element" class="users-list ani"> <mat-form-field class="chip-list"> <input #user matInput placeholder="Enter user login" pattern="[@.-_0-9a-zA-Z]" - (keydown.enter)="addUser(user.value, element); user.value = ''" (keyup)="checkIfUserAdded(element.users, user.value)"> - <button mat-icon-button matSuffix (click)="addUser(user.value, element); user.value = ''" [disabled]="element.users.includes(user.value)"> - <mat-icon matTooltip="User allready added to this group" matTooltipPosition="above" matTooltipDisabled="!(element.users.includes(user.value))">person_add</mat-icon> + (keydown.enter)="addUser(user.value, element); user.value = ''" (keyup)="checkIfUserAdded(element, user.value)"> + <button mat-icon-button matSuffix (click)="addUser(user.value, element); user.value = ''" [disabled]="element.isUserAdded"> + <mat-icon matTooltip="User allready added to this group" matTooltipPosition="above" [matTooltipDisabled]="!element.isUserAdded">person_add</mat-icon> </button> </mat-form-field> <div class="list-selected list-container ani"> 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 6b4fe02..a80aae6 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 @@ -306,8 +306,8 @@ export class RolesComponent implements OnInit { } } - checkIfUserAdded(users: any, value: string) { - + public checkIfUserAdded(element: any, value: string) { + element.isUserAdded = element.users.map(v => v.toLowerCase()).includes(value.toLowerCase()); } } --------------------------------------------------------------------- To unsubscribe, e-mail: commits-unsubscr...@dlab.apache.org For additional commands, e-mail: commits-h...@dlab.apache.org