LP#626157 Ang2 experiments
authorBill Erickson <berickxx@gmail.com>
Tue, 12 Dec 2017 15:28:41 +0000 (10:28 -0500)
committerBill Erickson <berickxx@gmail.com>
Tue, 12 Dec 2017 15:28:41 +0000 (10:28 -0500)
Signed-off-by: Bill Erickson <berickxx@gmail.com>
Open-ILS/web/js/ui/default/staff/services/hatch.js
Open-ILS/webby-src/src/app/share/catalog/catalog-url.service.ts
Open-ILS/webby-src/src/app/share/catalog/catalog.service.ts
Open-ILS/webby-src/src/app/share/catalog/search-context.ts
Open-ILS/webby-src/src/app/staff/catalog/staff-catalog.service.ts
Open-ILS/webby-src/src/app/staff/resolver.service.ts

index 0a27b15..331ccaf 100644 (file)
@@ -355,7 +355,7 @@ angular.module('egCoreMod')
         service.addLoginSessionKey(key);
         if (jsonified === undefined ) 
             jsonified = JSON.stringify(value);
-        $cookies.put(key, jsonified);
+        $cookies.put(key, jsonified, {path: '/'});
     }
 
     // Set the value for the given key.  
@@ -402,7 +402,7 @@ angular.module('egCoreMod')
 
     service.removeLoginSessionItem = function(key) {
         service.removeLoginSessionKey(key);
-        $cookies.remove(key);
+        $cookies.remove(key, {path: '/'});
     }
 
     service.removeSessionItem = function(key) {
index 68c33c5..27a05a0 100644 (file)
@@ -83,6 +83,9 @@ export class EgCatalogUrlService {
 
     applyUrlParams(context: CatalogSearchContext, params: ParamMap): void {
 
+        // Reset query/filter args.  The will be reconstructed below.
+        context.reset();
+
         // These fields can be copied directly into place
         ['format','sort','available','global']
         .forEach(field => {
@@ -111,7 +114,7 @@ export class EgCatalogUrlService {
         });
 
         params.getAll('facets').forEach(blob => {
-            let facet: FacetFilter = JSON.parse(blob)
+            let facet: FacetFilter = JSON.parse(blob);
             context.addFacet(facet);
         });
 
index 7e3d8d6..96f8d24 100644 (file)
@@ -68,15 +68,10 @@ export class EgCatalogService {
         let method = 'open-ils.search.biblio.multiclass.query';
         if (ctx.isStaff) method += '.staff';
 
-        // Grab a few pages worth of IDs
-        let limit = Math.max(ctx.pager.limit, 100);
-
-        // TODO: reset context result IDs for all searches except for paging
-
         return new Promise((resolve, reject) => {
             this.net.request(
                 'open-ils.search', method, {
-                    limit : ctx.pager.limit, 
+                    limit : ctx.pager.limit + 1
                     offset : ctx.pager.offset
                 }, fullQuery, true
             ).subscribe(result => {
index 4b1914e..61ea37c 100644 (file)
@@ -98,19 +98,24 @@ export class CatalogSearchContext {
     }
 
     /**
-     * Reset search parameters.  This does not reset global filters
-     * like limit-to-available and search-global.
+     * Return search context to its default state, resetting search
+     * parameters and clearing any cached result data.
+     * This does not reset global filters like limit-to-available 
+     * or search-global.
      */
     reset(): void {
-        this.pager.offset = 0,
-        this.format = '',
-        this.sort = '',
+        this.pager.offset = 0;
+        this.format = '';
+        this.sort = '';
         this.query  = [''];
         this.fieldClass   = ['keyword'];
         this.matchOp  = ['contains'];
         this.joinOp = [''];
         this.ccvmFilters = {};
         this.facetFilters = [];
+        this.result= {};
+        this.resultIds = [];
+        this.searchState = CatalogSearchState.PENDING;
     }
 
     isSearchable(): boolean {
index 31512d5..625206e 100644 (file)
@@ -33,6 +33,8 @@ export class StaffCatalogService {
 
         this.searchContext.org = this.org;
         this.searchContext.isStaff = true;
+
+        // TODO: UI / settings
         if (!this.searchContext.pager.limit)
           this.searchContext.pager.limit = 20;
     }
index 66903db..3f33faf 100644 (file)
@@ -33,8 +33,8 @@ export class EgStaffResolver implements Resolve<Observable<any>> {
         console.debug('EgStaffResolver:resolve()');
 
         // Staff cookies stay in /$base/staff/
-        this.store.loginSessionBasePath = 
-            this.ngLocation.prepareExternalUrl('/staff');
+        this.store.loginSessionBasePath = '/';
+            //this.ngLocation.prepareExternalUrl('/staff');
 
         // Login resets everything.  No need to load data.
         if (state.url == '/staff/login') return Observable.of(true);