|
|
|
|
@ -5,7 +5,13 @@ import { FormBuilder, FormGroup, Validators, FormControl } from '@angular/forms'
|
|
|
|
|
import { Select, Store } from '@ngxs/store';
|
|
|
|
|
import { Observable } from 'rxjs';
|
|
|
|
|
import { finalize, pluck } from 'rxjs/operators';
|
|
|
|
|
import { CreateRole, DeleteRole, GetRoleById, GetRoles, UpdateRole } from '../../actions/identity.actions';
|
|
|
|
|
import {
|
|
|
|
|
CreateRole,
|
|
|
|
|
DeleteRole,
|
|
|
|
|
GetRoleById,
|
|
|
|
|
GetRoles,
|
|
|
|
|
UpdateRole,
|
|
|
|
|
} from '../../actions/identity.actions';
|
|
|
|
|
import { Identity } from '../../models/identity';
|
|
|
|
|
import { IdentityState } from '../../states/identity.state';
|
|
|
|
|
|
|
|
|
|
@ -43,7 +49,11 @@ export class RolesComponent implements OnInit {
|
|
|
|
|
@ViewChild('formRef', { static: false, read: ElementRef })
|
|
|
|
|
formRef: ElementRef<HTMLFormElement>;
|
|
|
|
|
|
|
|
|
|
constructor(private confirmationService: ConfirmationService, private fb: FormBuilder, private store: Store) {}
|
|
|
|
|
constructor(
|
|
|
|
|
private confirmationService: ConfirmationService,
|
|
|
|
|
private fb: FormBuilder,
|
|
|
|
|
private store: Store,
|
|
|
|
|
) {}
|
|
|
|
|
|
|
|
|
|
ngOnInit() {
|
|
|
|
|
this.get();
|
|
|
|
|
@ -93,6 +103,7 @@ export class RolesComponent implements OnInit {
|
|
|
|
|
.pipe(finalize(() => (this.modalBusy = false)))
|
|
|
|
|
.subscribe(() => {
|
|
|
|
|
this.isModalVisible = false;
|
|
|
|
|
this.get();
|
|
|
|
|
});
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
@ -103,7 +114,7 @@ export class RolesComponent implements OnInit {
|
|
|
|
|
})
|
|
|
|
|
.subscribe((status: Toaster.Status) => {
|
|
|
|
|
if (status === Toaster.Status.confirm) {
|
|
|
|
|
this.store.dispatch(new DeleteRole(id));
|
|
|
|
|
this.store.dispatch(new DeleteRole(id)).subscribe(() => this.get());
|
|
|
|
|
}
|
|
|
|
|
});
|
|
|
|
|
}
|
|
|
|
|
@ -124,6 +135,8 @@ export class RolesComponent implements OnInit {
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
onClickSaveButton() {
|
|
|
|
|
this.formRef.nativeElement.dispatchEvent(new Event('submit', { bubbles: true, cancelable: true }));
|
|
|
|
|
this.formRef.nativeElement.dispatchEvent(
|
|
|
|
|
new Event('submit', { bubbles: true, cancelable: true }),
|
|
|
|
|
);
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|