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.
service.removeLoginSessionItem = function(key) {
service.removeLoginSessionKey(key);
- $cookies.remove(key);
+ $cookies.remove(key, {path: '/'});
}
service.removeSessionItem = function(key) {
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 => {
});
params.getAll('facets').forEach(blob => {
- let facet: FacetFilter = JSON.parse(blob)
+ let facet: FacetFilter = JSON.parse(blob);
context.addFacet(facet);
});
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 => {
}
/**
- * 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 {
this.searchContext.org = this.org;
this.searchContext.isStaff = true;
+
+ // TODO: UI / settings
if (!this.searchContext.pager.limit)
this.searchContext.pager.limit = 20;
}
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);