LP1812670 Angular grid shows selector labels
[evergreen-equinox.git] / Open-ILS / src / eg2 / src / app / staff / share / admin-page / admin-page.component.ts
index 03ba326..4561a04 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;
@@ -161,13 +163,14 @@ export class AdminPageComponent implements OnInit {
 
             // Edit each IDL thing one at a time
             const editOneThing = (thing: IdlObject) => {
-                if (!thing) return;
+                if (!thing) { return; }
 
                 this.showEditDialog(thing).then(
                     () => editOneThing(idlThings.shift()));
-            }
+            };
 
-            editOneThing(idlThings.shift()); };
+            editOneThing(idlThings.shift());
+        };
 
         this.createNew = () => {
             this.editDialog.mode = 'create';
@@ -177,7 +180,12 @@ export class AdminPageComponent implements OnInit {
                         .then(str => this.toast.success(str));
                     this.grid.reload();
                 },
-                err => {}
+                rejection => {
+                    if (!rejection.dismissed) {
+                        this.createErrString.current()
+                            .then(str => this.toast.danger(str));
+                    }
+                }
             );
         };
 
@@ -294,11 +302,13 @@ export class AdminPageComponent implements OnInit {
 
                 const search = {};
                 search[this.orgField] = orgs;
-                return this.pcrud.search(this.idlClass, search, searchOps);
+                return this.pcrud.search(
+                    this.idlClass, search, searchOps, {fleshSelectors: true});
             }
 
             // No org filter -- fetch all rows
-            return this.pcrud.retrieveAll(this.idlClass, searchOps);
+            return this.pcrud.retrieveAll(
+                this.idlClass, searchOps, {fleshSelectors: true});
         };
     }
 
@@ -320,7 +330,12 @@ export class AdminPageComponent implements OnInit {
                     .then(str => this.toast.success(str));
                 this.grid.reload();
             },
-            err => {}
+            rejection => {
+                if (!rejection.dismissed) {
+                    this.updateFailedString.current()
+                        .then(str => this.toast.danger(str));
+                }
+            }
         );
     }