LP#1807461 FM-editor show danger toasts when create/update fails
authorBill Erickson <berickxx@gmail.com>
Mon, 10 Dec 2018 20:06:23 +0000 (15:06 -0500)
committerDan Wells <dbw2@calvin.edu>
Fri, 22 Mar 2019 19:42:17 +0000 (15:42 -0400)
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>
Signed-off-by: Dan Wells <dbw2@calvin.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 8cf5070..44e407b 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 03ba326..001836d 100644 (file)
@@ -69,6 +69,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;
@@ -177,7 +179,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));
+                }
             );
         };
 
@@ -320,7 +325,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));
+            }
         );
     }