LP1889113 Staff catalog record holds sticky org select
authorBill Erickson <berickxx@gmail.com>
Mon, 27 Jul 2020 18:21:09 +0000 (14:21 -0400)
committerJane Sandberg <sandbej@linnbenton.edu>
Sun, 23 Aug 2020 19:42:02 +0000 (12:42 -0700)
Teaches the record holds grid to use a persistkey for making the pickup
lib selector sticky.  Additionaly, teach the holds retrieval code to
wait until the org select has settled on a value before collecting any
data.

Also adds the new workstation setting type
'eg.orgselect.cat.catalog.wide_holds'

Signed-off-by: Bill Erickson <berickxx@gmail.com>
Signed-off-by: Terran McCanna <tmccanna@georgialibraries.org>
Signed-off-by: Jane Sandberg <sandbej@linnbenton.edu>
Open-ILS/src/eg2/src/app/staff/share/holds/grid.component.html
Open-ILS/src/eg2/src/app/staff/share/holds/grid.component.ts
Open-ILS/src/sql/Pg/950.data.seed-values.sql
Open-ILS/src/sql/Pg/upgrade/XXXX.data.holds-for-bib-org-select.sql [new file with mode: 0644]

index 898048b..7a9aceb 100644 (file)
@@ -24,7 +24,8 @@
           <div class="input-group-prepend">
             <div class="input-group-text" i18n>Pickup Library</div>
           </div>
-          <eg-org-select [initialOrg]="pickupLib" (onChange)="pickupLibChanged($event)">
+          <eg-org-select [persistKey]="persistKey" [fallbackOrg]="pickupLib"
+            (componentLoaded)="plCompLoaded = true" (onChange)="pickupLibChanged($event)">
           </eg-org-select>
         </div>
       </div>
index ff25149..01b44bf 100644 (file)
@@ -53,6 +53,7 @@ export class HoldsGridComponent implements OnInit {
     initDone = false;
     holdsCount: number;
     pickupLib: IdlObject;
+    plCompLoaded = false;
     gridDataSource: GridDataSource;
     detailHold: any;
     editHolds: number[];
@@ -129,11 +130,9 @@ export class HoldsGridComponent implements OnInit {
         this.pickupLib = this.org.get(this.initialPickupLib);
 
         if (this.preFetchSetting) {
-
-                this.store.getItem(this.preFetchSetting).then(
-                    applied => this.enablePreFetch = Boolean(applied)
-                );
-
+            this.store.getItem(this.preFetchSetting).then(
+                applied => this.enablePreFetch = Boolean(applied)
+            );
         }
 
         if (!this.defaultSort) {
@@ -141,6 +140,15 @@ export class HoldsGridComponent implements OnInit {
         }
 
         this.gridDataSource.getRows = (pager: Pager, sort: any[]) => {
+
+            if (!this.hidePickupLibFilter && !this.plCompLoaded) {
+                // When the pickup lib selector is active, avoid any
+                // data fetches until it has settled on a default value.
+                // Once the final value is applied, its onchange will
+                // fire and we'll be back here with plCompLoaded=true.
+                return of([]);
+            }
+
             sort = sort.length > 0 ? sort : this.defaultSort;
             return this.fetchHolds(pager, sort);
         };
index 18086b3..19398d4 100644 (file)
@@ -20439,4 +20439,13 @@ VALUES (
     )
 );
 
+INSERT INTO config.workstation_setting_type (name, grp, datatype, label)
+VALUES (
+    'eg.orgselect.cat.catalog.wide_holds', 'gui', 'integer',
+    oils_i18n_gettext(
+        'eg.orgselect.cat.catalog.wide_holds',
+        'Default org unit for catalog holds org unit selector',
+        'cwst', 'label'
+    )
+);
 
diff --git a/Open-ILS/src/sql/Pg/upgrade/XXXX.data.holds-for-bib-org-select.sql b/Open-ILS/src/sql/Pg/upgrade/XXXX.data.holds-for-bib-org-select.sql
new file mode 100644 (file)
index 0000000..ba516b5
--- /dev/null
@@ -0,0 +1,17 @@
+BEGIN;
+
+-- SELECT evergreen.upgrade_deps_block_check('TODO', :eg_version);
+
+INSERT INTO config.workstation_setting_type (name, grp, datatype, label)
+VALUES (
+    'eg.orgselect.cat.catalog.wide_holds', 'gui', 'integer',
+    oils_i18n_gettext(
+        'eg.orgselect.cat.catalog.wide_holds',
+        'Default org unit for catalog holds org unit selector',
+        'cwst', 'label'
+    )
+);
+
+COMMIT;
+
+