[Library | Trunk]: Roles users fix filter form on role change
git-svn-id: https://svn.driver.research-infrastructures.eu/driver/dnet40/modules/uoa-services-library/trunk/ng-openaire-library/src/app@60734 d315682c-612b-4755-9ff5-7f18f6832af3
This commit is contained in:
parent
b9d46c5bd9
commit
1f643b347c
|
@ -69,16 +69,7 @@ export class RoleUsersComponent implements OnInit, OnDestroy, OnChanges {
|
|||
}
|
||||
|
||||
ngOnInit() {
|
||||
this.filterForm = this.fb.group({
|
||||
active: this.fb.control(''),
|
||||
pending: this.fb.control('')
|
||||
});
|
||||
this.subs.push(this.filterForm.get('active').valueChanges.subscribe(value => {
|
||||
this.filterActiveBySearch(value);
|
||||
}));
|
||||
this.subs.push(this.filterForm.get('pending').valueChanges.subscribe(value => {
|
||||
this.filterPendingBySearch(value);
|
||||
}));
|
||||
this.initForm();
|
||||
this.updateLists();
|
||||
this.userManagementService.getUserInfo().subscribe(user => {
|
||||
this.user = user;
|
||||
|
@ -88,6 +79,7 @@ export class RoleUsersComponent implements OnInit, OnDestroy, OnChanges {
|
|||
ngOnChanges(changes: SimpleChanges) {
|
||||
if (changes.role) {
|
||||
this.unsubscribe();
|
||||
this.initForm();
|
||||
this.updateLists();
|
||||
}
|
||||
}
|
||||
|
@ -104,6 +96,19 @@ export class RoleUsersComponent implements OnInit, OnDestroy, OnChanges {
|
|||
});
|
||||
}
|
||||
|
||||
initForm() {
|
||||
this.filterForm = this.fb.group({
|
||||
active: this.fb.control(''),
|
||||
pending: this.fb.control('')
|
||||
});
|
||||
this.subs.push(this.filterForm.get('active').valueChanges.subscribe(value => {
|
||||
this.filterActiveBySearch(value);
|
||||
}));
|
||||
this.subs.push(this.filterForm.get('pending').valueChanges.subscribe(value => {
|
||||
this.filterPendingBySearch(value);
|
||||
}));
|
||||
}
|
||||
|
||||
updateLists() {
|
||||
this.loadActive = true;
|
||||
this.loadPending = true;
|
||||
|
|
Loading…
Reference in New Issue