[AAE-1594][AAE-1631] Fix not able to search for specific users, valid… (#5429)

* [AAE-1594][AAE-1631] Fix not able to search for specific users, validation not working for partial username

* [AAE-1594][AAE-1631] Fix unit tests

* [AAE-1594] Refactor comparing preselcted user with keycloak user, add unit tests for search

* [AAE-1594] Add missing undefined check

* [AAE-1594] Ignore blank space user/groups search
This commit is contained in:
arditdomi
2020-02-03 10:15:18 +00:00
committed by GitHub
parent 0a25254691
commit d9e0847b18
4 changed files with 113 additions and 25 deletions

View File

@@ -190,9 +190,12 @@ export class GroupCloudComponent implements OnInit, OnChanges, OnDestroy {
return typeof value === 'string';
}),
tap((value) => {
this.searchedValue = value;
if (value) {
if (value.trim()) {
this.searchedValue = value;
this.setTypingError();
} else {
this.searchGroupsControl.markAsPristine();
this.searchGroupsControl.markAsUntouched();
}
}),
tap(() => {
@@ -238,7 +241,7 @@ export class GroupCloudComponent implements OnInit, OnChanges, OnDestroy {
}
private isGroupAlreadySelected(group: IdentityGroupModel): boolean {
if (this.selectedGroups && this.selectedGroups.length > 0 && this.isMultipleMode()) {
if (this.selectedGroups && this.selectedGroups.length > 0) {
const result = this.selectedGroups.find((selectedGroup: IdentityGroupModel) => {
return selectedGroup.name === group.name;
});
@@ -440,7 +443,7 @@ export class GroupCloudComponent implements OnInit, OnChanges, OnDestroy {
}
private createSearchParam(value: string): IdentityGroupSearchParam {
const queryParams: IdentityGroupSearchParam = { name: value };
const queryParams: IdentityGroupSearchParam = { name: value.trim() };
return queryParams;
}