From: Galen Charlton Date: Tue, 11 Jun 2019 23:08:51 +0000 (-0400) Subject: LP#1832897: improvements to the Angular admin-page component X-Git-Url: https://old-git.evergreen-ils.org/?a=commitdiff_plain;h=4739faf12e0fd9c11278e2839de1181c8facf10a;p=evergreen%2Fmasslnc.git LP#1832897: improvements to the Angular admin-page component * Make some of its services public so that it can be more easily subclassed. * Show toast on success or failure of record deletion actions. Signed-off-by: Galen Charlton Signed-off-by: Bill Erickson Signed-off-by: Jane Sandberg --- diff --git a/Open-ILS/src/eg2/src/app/staff/share/admin-page/admin-page.component.html b/Open-ILS/src/eg2/src/app/staff/share/admin-page/admin-page.component.html index bb39f8bbdd..c7479d62db 100644 --- a/Open-ILS/src/eg2/src/app/staff/share/admin-page/admin-page.component.html +++ b/Open-ILS/src/eg2/src/app/staff/share/admin-page/admin-page.component.html @@ -4,6 +4,11 @@ Update of {{idlClassDef.label}} failed +Delete of {{idlClassDef.label}} failed or was not allowed + + +{{idlClassDef.label}} Successfully Deleted + {{idlClassDef.label}} Succeessfully Created diff --git a/Open-ILS/src/eg2/src/app/staff/share/admin-page/admin-page.component.ts b/Open-ILS/src/eg2/src/app/staff/share/admin-page/admin-page.component.ts index 11913c8991..b853a6aef5 100644 --- a/Open-ILS/src/eg2/src/app/staff/share/admin-page/admin-page.component.ts +++ b/Open-ILS/src/eg2/src/app/staff/share/admin-page/admin-page.component.ts @@ -81,6 +81,8 @@ export class AdminPageComponent implements OnInit { @ViewChild('createString') createString: StringComponent; @ViewChild('createErrString') createErrString: StringComponent; @ViewChild('updateFailedString') updateFailedString: StringComponent; + @ViewChild('deleteFailedString') deleteFailedString: StringComponent; + @ViewChild('deleteSuccessString') deleteSuccessString: StringComponent; @ViewChild('translator') translator: TranslateComponent; idlClassDef: any; @@ -103,12 +105,12 @@ export class AdminPageComponent implements OnInit { constructor( private route: ActivatedRoute, - private idl: IdlService, + public idl: IdlService, private org: OrgService, - private auth: AuthService, - private pcrud: PcrudService, + public auth: AuthService, + public pcrud: PcrudService, private perm: PermService, - private toast: ToastService + public toast: ToastService ) { this.translatableFields = []; } @@ -278,8 +280,15 @@ export class AdminPageComponent implements OnInit { deleteSelected(idlThings: IdlObject[]) { idlThings.forEach(idlThing => idlThing.isdeleted(true)); this.pcrud.autoApply(idlThings).subscribe( - val => console.debug('deleted: ' + val), - err => {}, + val => { + console.debug('deleted: ' + val); + this.deleteSuccessString.current() + .then(str => this.toast.success(str)); + }, + err => { + this.deleteFailedString.current() + .then(str => this.toast.danger(str)); + }, () => this.grid.reload() ); }