LP#1831788: (follow-up) update sandbox example
authorGalen Charlton <gmc@equinoxinitiative.org>
Tue, 30 Jul 2019 20:02:49 +0000 (16:02 -0400)
committerGalen Charlton <gmc@equinoxinitiative.org>
Thu, 1 Aug 2019 13:49:48 +0000 (09:49 -0400)
- dialog adjusted for LP#1823041 changes
- typo fixed

Signed-off-by: Galen Charlton <gmc@equinoxinitiative.org>
Signed-off-by: Bill Erickson <berickxx@gmail.com>
Signed-off-by: Jane Sandberg <sandbej@linnbenton.edu>
Open-ILS/src/eg2/src/app/staff/sandbox/sandbox.component.html
Open-ILS/src/eg2/src/app/staff/sandbox/sandbox.component.ts

index 92c0e84..37e46d9 100644 (file)
 <eg-fm-record-editor #acpEditDialog idlClass="acp" hiddenFields="call_number,creator,create_date,editor,edit_time,loan_duration,fine_level,dummy_author,dummy_isbn,ref,floating,holdable,circ_as_type,active_date,mint_condition,cost,deleted,deposit,deposit_amount,circulate,status_changed_time,copy_number">
 </eg-fm-record-editor>
 <eg-string #successString text="Updated succeeded!" i18n-text></eg-string>
-<eg-string #updatedFailedString text="Updated failed!" i18n-text></eg-string>
+<eg-string #updateFailedString text="Updated failed!" i18n-text></eg-string>
 
 <h4>PCRUD auto flesh and FormatService detection</h4>
 <div *ngIf="aMetarecord">Fingerprint: {{aMetarecord}}</div>
index 0fd1664..0c637b5 100644 (file)
@@ -339,22 +339,26 @@ export class SandboxComponent implements OnInit {
       this.numConfirmDialog.open();
     }
 
-    showEditDialog(idlThing: IdlObject) {
+    showEditDialog(idlThing: IdlObject): Promise<any> {
         this.editDialog.mode = 'update';
         this.editDialog.recId = idlThing['id']();
-        return this.editDialog.open({size: 'lg'}).then(
-            ok => {
-                this.successString.current()
-                    .then(str => this.toast.success(str));
-                this.acpGrid.reloadSansPagerReset();
-            },
-            rejection => {
-                if (!rejection.dismissed) {
-                    this.updateFailedString.current()
-                        .then(str => this.toast.danger(str));
+        return new Promise((resolve, reject) => {
+            this.editDialog.open({size: 'lg'}).subscribe(
+                ok => {
+                    this.successString.current()
+                        .then(str => this.toast.success(str));
+                    this.acpGrid.reloadSansPagerReset();
+                    resolve(ok);
+                },
+                rejection => {
+                    if (!rejection.dismissed) {
+                        this.updateFailedString.current()
+                            .then(str => this.toast.danger(str));
+                        reject(rejection);
+                    }
                 }
-            }
-        );
+            )
+        });
     }
 }