From: Bill Erickson Date: Tue, 12 Dec 2017 15:28:41 +0000 (-0500) Subject: LP#626157 Ang2 experiments X-Git-Url: https://old-git.evergreen-ils.org/?a=commitdiff_plain;h=45409a1700f5a6f87e5d0b2442633be66e23a9f7;p=working%2FEvergreen.git LP#626157 Ang2 experiments Signed-off-by: Bill Erickson --- diff --git a/Open-ILS/web/js/ui/default/staff/services/hatch.js b/Open-ILS/web/js/ui/default/staff/services/hatch.js index 0a27b152e6..331ccafe75 100644 --- a/Open-ILS/web/js/ui/default/staff/services/hatch.js +++ b/Open-ILS/web/js/ui/default/staff/services/hatch.js @@ -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) { diff --git a/Open-ILS/webby-src/src/app/share/catalog/catalog-url.service.ts b/Open-ILS/webby-src/src/app/share/catalog/catalog-url.service.ts index 68c33c5db4..27a05a0900 100644 --- a/Open-ILS/webby-src/src/app/share/catalog/catalog-url.service.ts +++ b/Open-ILS/webby-src/src/app/share/catalog/catalog-url.service.ts @@ -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); }); diff --git a/Open-ILS/webby-src/src/app/share/catalog/catalog.service.ts b/Open-ILS/webby-src/src/app/share/catalog/catalog.service.ts index 7e3d8d644f..96f8d24ab4 100644 --- a/Open-ILS/webby-src/src/app/share/catalog/catalog.service.ts +++ b/Open-ILS/webby-src/src/app/share/catalog/catalog.service.ts @@ -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 => { diff --git a/Open-ILS/webby-src/src/app/share/catalog/search-context.ts b/Open-ILS/webby-src/src/app/share/catalog/search-context.ts index 4b1914e851..61ea37ce02 100644 --- a/Open-ILS/webby-src/src/app/share/catalog/search-context.ts +++ b/Open-ILS/webby-src/src/app/share/catalog/search-context.ts @@ -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 { diff --git a/Open-ILS/webby-src/src/app/staff/catalog/staff-catalog.service.ts b/Open-ILS/webby-src/src/app/staff/catalog/staff-catalog.service.ts index 31512d5f31..625206e7f4 100644 --- a/Open-ILS/webby-src/src/app/staff/catalog/staff-catalog.service.ts +++ b/Open-ILS/webby-src/src/app/staff/catalog/staff-catalog.service.ts @@ -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; } diff --git a/Open-ILS/webby-src/src/app/staff/resolver.service.ts b/Open-ILS/webby-src/src/app/staff/resolver.service.ts index 66903db6f1..3f33fafb40 100644 --- a/Open-ILS/webby-src/src/app/staff/resolver.service.ts +++ b/Open-ILS/webby-src/src/app/staff/resolver.service.ts @@ -33,8 +33,8 @@ export class EgStaffResolver implements Resolve> { 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);