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 5964de8d291223db18c71614d8c1b94cb185deff Author: Dmytro_Gnatyshyn <di1...@ukr.net> AuthorDate: Fri Aug 14 16:08:57 2020 +0300 Added add user validation --- .../webapp/src/app/administration/roles/roles.component.html | 6 +++--- .../webapp/src/app/administration/roles/roles.component.ts | 8 ++++++++ 2 files changed, 11 insertions(+), 3 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 5c73329..3212876 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 = ''"> - <button mat-icon-button matSuffix (click)="addUser(user.value, element); user.value = ''"> - <mat-icon>person_add</mat-icon> + (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> </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 884e1e2..6b4fe02 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 @@ -276,6 +276,10 @@ export class RolesComponent implements OnInit { } public addUser(value: string, item): void { + if (item.users.includes(value)) { + return; + } + if (value && value.trim()) { item.users instanceof Array ? item.users.push(value.trim()) : item.users = [value.trim()]; } @@ -301,6 +305,10 @@ export class RolesComponent implements OnInit { this.setupRoles = $event.model; } } + + checkIfUserAdded(users: any, value: string) { + + } } --------------------------------------------------------------------- To unsubscribe, e-mail: commits-unsubscr...@dlab.apache.org For additional commands, e-mail: commits-h...@dlab.apache.org