From: Bill Erickson Date: Fri, 15 Jun 2018 21:57:45 +0000 (-0400) Subject: LP#1775466 Ang catalog supports most identifier query types X-Git-Url: https://old-git.evergreen-ils.org/?a=commitdiff_plain;h=b55a658dd6812784592843c96337fa96779e3bfe;p=working%2FEvergreen.git LP#1775466 Ang catalog supports most identifier query types Signed-off-by: Bill Erickson --- diff --git a/Open-ILS/src/eg2/src/app/share/catalog/catalog-url.service.ts b/Open-ILS/src/eg2/src/app/share/catalog/catalog-url.service.ts index b39f3cad95..0974cb19ea 100644 --- a/Open-ILS/src/eg2/src/app/share/catalog/catalog-url.service.ts +++ b/Open-ILS/src/eg2/src/app/share/catalog/catalog-url.service.ts @@ -25,6 +25,8 @@ export class CatalogUrlService { joinOp: [], matchOp: [], facets: [], + identQuery: null, + identQueryType: null, org: null, limit: null, offset: null @@ -36,7 +38,7 @@ export class CatalogUrlService { } // These fields can be copied directly into place - ['format', 'sort', 'available', 'global'] + ['format', 'sort', 'available', 'global', 'identQuery', 'identQueryType'] .forEach(field => { if (context[field]) { // Only propagate applied values to the URL. @@ -92,7 +94,7 @@ export class CatalogUrlService { context.reset(); // These fields can be copied directly into place - ['format', 'sort', 'available', 'global'] + ['format', 'sort', 'available', 'global', 'identQuery', 'identQueryType'] .forEach(field => { const val = params.get(field); if (val !== null) { diff --git a/Open-ILS/src/eg2/src/app/share/catalog/search-context.ts b/Open-ILS/src/eg2/src/app/share/catalog/search-context.ts index 7b8908c8f0..17789df872 100644 --- a/Open-ILS/src/eg2/src/app/share/catalog/search-context.ts +++ b/Open-ILS/src/eg2/src/app/share/catalog/search-context.ts @@ -39,6 +39,8 @@ export class CatalogSearchContext { sort: string; fieldClass: string[]; query: string[]; + identQuery: string; + identQueryType: string; // isbn, issn, etc. joinOp: string[]; matchOp: string[]; format: string; @@ -106,6 +108,8 @@ export class CatalogSearchContext { this.format = ''; this.sort = ''; this.query = ['']; + this.identQuery = null; + this.identQueryType = 'isbn'; this.fieldClass = ['keyword']; this.matchOp = ['contains']; this.joinOp = ['']; @@ -117,6 +121,11 @@ export class CatalogSearchContext { } isSearchable(): boolean { + + if (this.identQuery && this.identQueryType) { + return true; + } + return this.query.length && this.query[0] !== '' && this.searchOrg !== null; @@ -136,18 +145,25 @@ export class CatalogSearchContext { str += ' sort(' + parts[0] + ')'; } - // ------- - // Compile boolean sub-query components - if (str.length) { str += ' '; } - const qcount = this.query.length; + if (this.identQuery && this.identQueryType) { + if (str) { str += ' '; } + str += this.identQueryType + ':' + this.identQuery; - // if we multiple boolean query components, wrap them in parens. - if (qcount > 1) { str += '('; } - this.query.forEach((q, idx) => { - str += this.compileBoolQuerySet(idx); - }); - if (qcount > 1) { str += ')'; } - // ------- + } else { + + // ------- + // Compile boolean sub-query components + if (str.length) { str += ' '; } + const qcount = this.query.length; + + // if we multiple boolean query components, wrap them in parens. + if (qcount > 1) { str += '('; } + this.query.forEach((q, idx) => { + str += this.compileBoolQuerySet(idx); + }); + if (qcount > 1) { str += ')'; } + // ------- + } if (this.format) { str += ' format(' + this.format + ')'; diff --git a/Open-ILS/src/eg2/src/app/staff/catalog/search-form.component.html b/Open-ILS/src/eg2/src/app/staff/catalog/search-form.component.html index 24ec4e6ba3..ae9170c8c5 100644 --- a/Open-ILS/src/eg2/src/app/staff/catalog/search-form.component.html +++ b/Open-ILS/src/eg2/src/app/staff/catalog/search-form.component.html @@ -8,7 +8,7 @@ TODO focus search input
@@ -16,30 +16,30 @@ TODO focus search input
@@ -193,6 +193,23 @@ TODO focus search input value="{{audience.code()}}">{{audience.value()}}
+
+ +
+
+ +
diff --git a/Open-ILS/src/eg2/src/app/staff/catalog/search-form.component.ts b/Open-ILS/src/eg2/src/app/staff/catalog/search-form.component.ts index b679160f85..dbffe9c7f1 100644 --- a/Open-ILS/src/eg2/src/app/staff/catalog/search-form.component.ts +++ b/Open-ILS/src/eg2/src/app/staff/catalog/search-form.component.ts @@ -39,7 +39,14 @@ export class SearchFormComponent implements OnInit, AfterViewInit { // Query inputs are generated from search context data, // so they are not available until after the first render. // Search context data is extracted synchronously from the URL. - this.renderer.selectRootElement('#first-query-input').focus(); + + if (this.searchContext.identQuery) { + // Focus identifier query input if identQuery is in progress + this.renderer.selectRootElement('#ident-query-input').focus(); + } else { + // Otherwise focus the main query input + this.renderer.selectRootElement('#first-query-input').focus(); + } } /** @@ -60,6 +67,10 @@ export class SearchFormComponent implements OnInit, AfterViewInit { } }); + if (this.searchContext.identQuery) { + show = true; + } + return show; }