LP#1857150: eg-fm-record-editor: add remainOpenOnError option
authorGalen Charlton <gmc@equinoxinitiative.org>
Fri, 17 Apr 2020 21:11:29 +0000 (17:11 -0400)
committerJason Etheridge <jason@EquinoxInitiative.org>
Thu, 10 Sep 2020 20:35:31 +0000 (16:35 -0400)
Give eg-fm-record-editor an option controlled by the boolean
remainOpenOnError attribute to, when used as a dialog, keep
the dialog open if an error is encountered upon saving the
record.

Sponsored-by: Evergreen Community Development Initiative
Signed-off-by: Galen Charlton <gmc@equinoxinitiative.org>
Signed-off-by: Ruth Frasur <rfrasur@library.in.gov>
Signed-off-by: Bill Erickson <berickxx@gmail.com>
Signed-off-by: Jason Etheridge <jason@EquinoxInitiative.org>
Open-ILS/src/eg2/src/app/share/fm-editor/fm-editor.component.ts

index e809b7d..a396fd4 100644 (file)
@@ -139,6 +139,9 @@ export class FmRecordEditorComponent
     // for displayMode === 'inline'
     @Input() hideBanner: boolean;
 
+    // do not close dialog on error saving record
+    @Input() remainOpenOnError: false;
+
     // Emit the modified object when the save action completes.
     @Output() recordSaved = new EventEmitter<IdlObject>();
 
@@ -621,7 +624,7 @@ export class FmRecordEditorComponent
             error => {
                 this.recordError.emit(error);
                 this.failStr.current().then(msg => this.toast.warning(msg));
-                if (this.isDialog()) { this.error(error); }
+                if (this.isDialog() && !this.remainOpenOnError) { this.error(error); }
             }
         );
     }
@@ -639,7 +642,7 @@ export class FmRecordEditorComponent
                 error => {
                     this.recordError.emit(error);
                     this.failStr.current().then(msg => this.toast.warning(msg));
-                    if (this.isDialog()) { this.error(error); }
+                    if (this.isDialog() && !this.remainOpenOnError) { this.error(error); }
                 }
             );
         });