[AAE-1975] Add no results template when searching in People/Group clo… (#5479)

* [AAE-1975] Add no results template when searching in People/Group cloud component

* [AAE-1975] Add timeout for check no results e2e method

* [AAE-1975] Adapt unit tests, add no results checks

* [AAE-1975] Fix styling, remove error icon and red colour

* [AAE-1975] Remove timeout
This commit is contained in:
arditdomi
2020-02-24 15:37:55 +00:00
committed by GitHub
parent 536e2587ea
commit 56474bc96e
10 changed files with 119 additions and 65 deletions

View File

@@ -138,7 +138,8 @@ export class PeopleCloudComponent implements OnInit, OnChanges, OnDestroy {
validateUsersMessage: string;
searchedValue = '';
isLoading = false;
validationLoading = false;
searchLoading = false;
constructor(
private identityUserService: IdentityUserService,
@@ -183,6 +184,7 @@ export class PeopleCloudComponent implements OnInit, OnChanges, OnDestroy {
private initSearch(): void {
this.searchUserCtrl.valueChanges.pipe(
filter((value) => {
this.searchLoading = true;
return typeof value === 'string';
}),
tap((value: string) => {
@@ -207,6 +209,7 @@ export class PeopleCloudComponent implements OnInit, OnChanges, OnDestroy {
this.identityUserService.findUsersByName(search.trim())),
mergeMap((users) => {
this.resetSearchUsers();
this.searchLoading = false;
return users;
}),
filter(user => !this.isUserAlreadySelected(user)),
@@ -283,9 +286,9 @@ export class PeopleCloudComponent implements OnInit, OnChanges, OnDestroy {
}
this.userChipsCtrl.setValue(this.selectedUsers[0].username);
if (this.isValidationEnabled()) {
this.isLoading = true;
this.validationLoading = true;
await this.validatePreselectUsers();
this.isLoading = false;
this.validationLoading = false;
}
}
@@ -381,23 +384,25 @@ export class PeopleCloudComponent implements OnInit, OnChanges, OnDestroy {
}
onSelect(user: IdentityUserModel): void {
this.selectUser.emit(user);
if (user) {
this.selectUser.emit(user);
if (this.isMultipleMode()) {
if (!this.isUserAlreadySelected(user)) {
this.selectedUsers.push(user);
if (this.isMultipleMode()) {
if (!this.isUserAlreadySelected(user)) {
this.selectedUsers.push(user);
}
} else {
this.invalidUsers = [];
this.selectedUsers = [user];
}
} else {
this.invalidUsers = [];
this.selectedUsers = [user];
this.userInput.nativeElement.value = '';
this.searchUserCtrl.setValue('');
this.userChipsCtrlValue(this.selectedUsers[0].username);
this.changedUsers.emit(this.selectedUsers);
this.resetSearchUsers();
}
this.userInput.nativeElement.value = '';
this.searchUserCtrl.setValue('');
this.userChipsCtrlValue(this.selectedUsers[0].username);
this.changedUsers.emit(this.selectedUsers);
this.resetSearchUsers();
}
onRemove(userToRemove: IdentityUserModel): void {
@@ -522,7 +527,7 @@ export class PeopleCloudComponent implements OnInit, OnChanges, OnDestroy {
}
isValidationLoading(): boolean {
return this.isValidationEnabled() && this.isLoading;
return this.isValidationEnabled() && this.validationLoading;
}
setFocus(isFocused: boolean) {