LP#1807461 FM-editor show danger toasts when create/update fails user/sandbergja/lp1807461-admin-grid-warn-errors-signedoff
authorBill Erickson <berickxx@gmail.com>
Mon, 10 Dec 2018 20:06:23 +0000 (15:06 -0500)
committerJane Sandberg <sandbej@linnbenton.edu>
Wed, 23 Jan 2019 03:00:04 +0000 (19:00 -0800)
Display a danger toast when update or create attempts fail in the
Angular fieldmapper editor dialog.

Signed-off-by: Bill Erickson <berickxx@gmail.com>
Signed-off-by: Jane Sandberg <sandbej@linnbenton.edu>
Open-ILS/src/eg2/src/app/staff/share/admin-page/admin-page.component.html
Open-ILS/src/eg2/src/app/staff/share/admin-page/admin-page.component.ts

index ee9a175..695a549 100644 (file)
@@ -1,9 +1,16 @@
 <ng-template #successStrTmpl i18n>{{idlClassDef.label}} Update Succeeded</ng-template>
 <eg-string #successString [template]="successStrTmpl"></eg-string>
 
+<ng-template #updateFailedStrTmpl i18n>Update of {{idlClassDef.label}} failed</ng-template>
+<eg-string #updateFailedString [template]="updateFailedStrTmpl"></eg-string>
+
+
 <ng-template #createStrTmpl i18n>{{idlClassDef.label}} Succeessfully Created</ng-template>
 <eg-string #createString [template]="createStrTmpl"></eg-string>
 
+<ng-template #createErrStrTmpl i18n>Failed to create new {{idlClassDef.label}}</ng-template>
+<eg-string #createErrString [template]="createErrStrTmpl"></eg-string>
+
 <ng-container *ngIf="orgField">
   <div class="d-flex">
     <div>
index 6e865f1..2ffcfa7 100644 (file)
@@ -66,6 +66,8 @@ export class AdminPageComponent implements OnInit {
     @ViewChild('editDialog') editDialog: FmRecordEditorComponent;
     @ViewChild('successString') successString: StringComponent;
     @ViewChild('createString') createString: StringComponent;
+    @ViewChild('createErrString') createErrString: StringComponent;
+    @ViewChild('updateFailedString') updateFailedString: StringComponent;
     @ViewChild('translator') translator: TranslateComponent;
 
     idlClassDef: any;
@@ -174,7 +176,10 @@ export class AdminPageComponent implements OnInit {
                         .then(str => this.toast.success(str));
                     this.grid.reload();
                 },
-                err => {}
+                err => {
+                    this.createErrString.current()
+                        .then(str => this.toast.danger(str));
+                }
             );
         };
 
@@ -317,7 +322,10 @@ export class AdminPageComponent implements OnInit {
                     .then(str => this.toast.success(str));
                 this.grid.reload();
             },
-            err => {}
+            err => {
+                this.updateFailedString.current()
+                    .then(str => this.toast.danger(str));
+            }
         );
     }