From 582bb8924e1801aaee40e73e79c3ebd312dc8a2e Mon Sep 17 00:00:00 2001 From: Bill Erickson Date: Thu, 31 Jan 2019 10:42:57 -0500 Subject: [PATCH] LP1806087 Angular catalog Ang7 & lint repairs Update rxjs imports to work with Angular7. Add ng-lint repairs. Signed-off-by: Bill Erickson Signed-off-by: Dan Wells --- Open-ILS/src/eg2/src/app/core/org.service.ts | 2 +- .../src/app/share/catalog/basket.service.ts | 16 +++--- .../app/share/catalog/bib-record.service.ts | 20 +++---- .../share/catalog/catalog-common.module.ts | 2 +- .../app/share/catalog/catalog-url.service.ts | 16 +++--- .../src/app/share/catalog/catalog.service.ts | 22 ++++---- .../src/app/share/catalog/search-context.ts | 17 +++--- .../src/app/share/util/anon-cache.service.ts | 12 ++--- .../staff/catalog/basket-actions.component.ts | 12 ++--- .../staff/catalog/browse/results.component.ts | 15 +++--- .../app/staff/catalog/hold/hold.component.ts | 52 +++++++++---------- .../staff/catalog/record/parts.component.ts | 2 +- .../staff/catalog/record/record.component.ts | 6 +-- .../src/app/staff/catalog/resolver.service.ts | 8 +-- .../staff/catalog/result/record.component.ts | 6 +-- .../staff/catalog/result/results.component.ts | 6 +-- .../staff/catalog/search-form.component.ts | 9 ++-- .../src/eg2/src/app/staff/nav.component.ts | 4 +- .../eg2/src/app/staff/share/hold.service.ts | 19 ++++--- 19 files changed, 121 insertions(+), 125 deletions(-) diff --git a/Open-ILS/src/eg2/src/app/core/org.service.ts b/Open-ILS/src/eg2/src/app/core/org.service.ts index 0acb2279e9..c666957d2c 100644 --- a/Open-ILS/src/eg2/src/app/core/org.service.ts +++ b/Open-ILS/src/eg2/src/app/core/org.service.ts @@ -253,7 +253,7 @@ export class OrgService { } } else if (!anonymous) { - console.warn('Attempt to fetch org setting(s)', + console.warn('Attempt to fetch org setting(s)', name, 'in non-anonymous mode without an authtoken'); return Promise.resolve({}); } diff --git a/Open-ILS/src/eg2/src/app/share/catalog/basket.service.ts b/Open-ILS/src/eg2/src/app/share/catalog/basket.service.ts index 99c8c24ca0..0d97220c80 100644 --- a/Open-ILS/src/eg2/src/app/share/catalog/basket.service.ts +++ b/Open-ILS/src/eg2/src/app/share/catalog/basket.service.ts @@ -1,5 +1,5 @@ import {Injectable, EventEmitter} from '@angular/core'; -import {Observable} from 'rxjs/Observable'; +import {Observable} from 'rxjs'; import {StoreService} from '@eg/core/store.service'; import {NetService} from '@eg/core/net.service'; import {PcrudService} from '@eg/core/pcrud.service'; @@ -27,8 +27,8 @@ export class BasketService { private pcrud: PcrudService, private store: StoreService, private anonCache: AnonCacheService - ) { - this.idList = []; + ) { + this.idList = []; this.onChange = new EventEmitter(); } @@ -50,7 +50,7 @@ export class BasketService { return this.anonCache.getItem(cacheKey, BASKET_CACHE_ATTR).then( list => { - if (!list) {return this.idList}; + if (!list) { return this.idList; } this.idList = list.map(id => Number(id)); return this.idList; } @@ -66,8 +66,8 @@ export class BasketService { const cacheKey = this.store.getLoginSessionItem(BASKET_CACHE_KEY_COOKIE); return this.anonCache.setItem(cacheKey, BASKET_CACHE_ATTR, this.idList) - .then(cacheKey => { - this.store.setLoginSessionItem(BASKET_CACHE_KEY_COOKIE, cacheKey); + .then(key => { + this.store.setLoginSessionItem(BASKET_CACHE_KEY_COOKIE, key); this.onChange.emit(this.idList); return this.idList; }); @@ -76,8 +76,8 @@ export class BasketService { addRecordIds(ids: number[]): Promise { ids = ids.filter(id => !this.hasRecordId(id)); // avoid dupes - if (ids.length === 0) { - return Promise.resolve(this.idList); + if (ids.length === 0) { + return Promise.resolve(this.idList); } return this.setRecordIds( this.idList.concat(ids.map(id => Number(id)))); diff --git a/Open-ILS/src/eg2/src/app/share/catalog/bib-record.service.ts b/Open-ILS/src/eg2/src/app/share/catalog/bib-record.service.ts index 5602bbb192..d536c8beb5 100644 --- a/Open-ILS/src/eg2/src/app/share/catalog/bib-record.service.ts +++ b/Open-ILS/src/eg2/src/app/share/catalog/bib-record.service.ts @@ -180,10 +180,10 @@ export class BibRecordService { })); } - // A Metabib Summary is a BibRecordSummary with the lead record as - // its core bib record plus attributes (e.g. formats) from related + // A Metabib Summary is a BibRecordSummary with the lead record as + // its core bib record plus attributes (e.g. formats) from related // records. - getMetabibSummary(metabibIds: number | number[], + getMetabibSummary(metabibIds: number | number[], orgId?: number, orgDepth?: number): Observable { const ids = [].concat(metabibIds); @@ -192,16 +192,16 @@ export class BibRecordService { return from([]); } - return this.pcrud.search('mmr', {id: ids}, - {flesh: 1, flesh_fields: {mmr: ['source_maps']}}, + return this.pcrud.search('mmr', {id: ids}, + {flesh: 1, flesh_fields: {mmr: ['source_maps']}}, {anonymous: true} ).pipe(mergeMap(mmr => this.compileMetabib(mmr, orgId, orgDepth))); } // 'metabib' must have its "source_maps" field fleshed. - // Get bib summaries for all related bib records so we can + // Get bib summaries for all related bib records so we can // extract data that must be appended to the master record summary. - compileMetabib(metabib: IdlObject, + compileMetabib(metabib: IdlObject, orgId?: number, orgDepth?: number): Observable { // TODO: Create an API similar to the one that builds a combined @@ -210,7 +210,7 @@ export class BibRecordService { // Non-master records const relatedBibIds = metabib.source_maps() - .map(map => map.source()) + .map(m => m.source()) .filter(id => id !== metabib.master_record()); let observer; @@ -222,8 +222,8 @@ export class BibRecordService { this.getBibSummary(metabib.master_record(), orgId, orgDepth) .subscribe(summary => { summary.metabibId = metabib.id(); - summary.metabibRecords = - metabib.source_maps().map(map => Number(map.source())) + summary.metabibRecords = + metabib.source_maps().map(m => Number(m.source())); let promise; diff --git a/Open-ILS/src/eg2/src/app/share/catalog/catalog-common.module.ts b/Open-ILS/src/eg2/src/app/share/catalog/catalog-common.module.ts index eeaf38af29..5b45d00a60 100644 --- a/Open-ILS/src/eg2/src/app/share/catalog/catalog-common.module.ts +++ b/Open-ILS/src/eg2/src/app/share/catalog/catalog-common.module.ts @@ -1,7 +1,7 @@ import {NgModule} from '@angular/core'; import {EgCommonModule} from '@eg/common.module'; import {CatalogService} from './catalog.service'; -import {AnonCacheService} from '@eg/share/util/anon-cache.service' +import {AnonCacheService} from '@eg/share/util/anon-cache.service'; import {BasketService} from './basket.service'; import {CatalogUrlService} from './catalog-url.service'; import {BibRecordService} from './bib-record.service'; 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 0f07070656..8f326adead 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 @@ -1,7 +1,7 @@ import {Injectable} from '@angular/core'; import {ParamMap} from '@angular/router'; import {OrgService} from '@eg/core/org.service'; -import {CatalogSearchContext, CatalogBrowseContext, CatalogMarcContext, +import {CatalogSearchContext, CatalogBrowseContext, CatalogMarcContext, CatalogTermContext, FacetFilter} from './search-context'; import {CATALOG_CCVM_FILTERS} from './search-context'; @@ -80,7 +80,7 @@ export class CatalogUrlService { params.joinOp = []; params.matchOp = []; - ['format', 'available', 'hasBrowseEntry', 'date1', + ['format', 'available', 'hasBrowseEntry', 'date1', 'date2', 'dateOp', 'groupByMetarecord', 'fromMetarecord'] .forEach(field => { if (ts[field]) { @@ -116,7 +116,7 @@ export class CatalogUrlService { })); }); } - + if (ts.copyLocations.length && ts.copyLocations[0] !== '') { params.copyLocations = ts.copyLocations.join(','); } @@ -200,7 +200,7 @@ export class CatalogUrlService { } else if (params.has('query')) { // Scalars - ['format', 'available', 'date1', 'date2', + ['format', 'available', 'date1', 'date2', 'dateOp', 'groupByMetarecord', 'fromMetarecord'] .forEach(field => { if (params.has(field)) { @@ -212,14 +212,14 @@ export class CatalogUrlService { ['query', 'fieldClass', 'joinOp', 'matchOp'].forEach(field => { const arr = params.getAll(field); if (params.has(field)) { - ts[field] = params.getAll(field); + ts[field] = params.getAll(field); } }); CATALOG_CCVM_FILTERS.forEach(code => { - const val = params.get(code); - if (val) { - ts.ccvmFilters[code] = val.split(/,/); + const ccvmVal = params.get(code); + if (ccvmVal) { + ts.ccvmFilters[code] = ccvmVal.split(/,/); } else { ts.ccvmFilters[code] = ['']; } diff --git a/Open-ILS/src/eg2/src/app/share/catalog/catalog.service.ts b/Open-ILS/src/eg2/src/app/share/catalog/catalog.service.ts index b8ffb857d4..90a959975a 100644 --- a/Open-ILS/src/eg2/src/app/share/catalog/catalog.service.ts +++ b/Open-ILS/src/eg2/src/app/share/catalog/catalog.service.ts @@ -37,7 +37,7 @@ export class CatalogService { private basket: BasketService ) { this.onSearchComplete = new EventEmitter(); - + } search(ctx: CatalogSearchContext): Promise { @@ -47,7 +47,7 @@ export class CatalogService { return this.basketSearch(ctx); } else if (ctx.marcSearch.isSearchable()) { return this.marcSearch(ctx); - } else if (ctx.identSearch.isSearchable() && + } else if (ctx.identSearch.isSearchable() && ctx.identSearch.queryType === 'item_barcode') { return this.barcodeSearch(ctx); } else { @@ -119,7 +119,7 @@ export class CatalogService { } else { fullQuery = ctx.compileTermSearchQuery(); - if (ctx.termSearch.groupByMetarecord + if (ctx.termSearch.groupByMetarecord && !ctx.termSearch.fromMetarecord) { method = 'open-ils.search.metabib.multiclass.query'; } @@ -134,7 +134,7 @@ export class CatalogService { if (ctx.isStaff) { method += '.staff'; } - + return new Promise((resolve, reject) => { this.net.request( 'open-ils.search', method, { @@ -151,7 +151,7 @@ export class CatalogService { } - // When showing titles linked to a browse entry, fetch + // When showing titles linked to a browse entry, fetch // the entry data as well so the UI can display it. fetchBrowseEntry(ctx: CatalogSearchContext) { const ts = ctx.termSearch; @@ -190,7 +190,7 @@ export class CatalogService { const isMeta = ctx.termSearch.isMetarecordSearch(); let observable: Observable; - + if (isMeta) { observable = this.bibService.getMetabibSummary( ctx.currentResultIds(), ctx.searchOrg.id(), depth); @@ -307,9 +307,9 @@ export class CatalogService { format => format.code() === code)[0]; if (ccvm) { return ccvm.search_label(); - } - } - } + } + } + } fetchCmfs(): Promise { // At the moment, we only need facet CMFs. @@ -333,11 +333,11 @@ export class CatalogService { const orgIds = this.org.fullPath(contextOrg, true); this.copyLocations = []; - return this.pcrud.search('acpl', + return this.pcrud.search('acpl', {deleted: 'f', opac_visible: 't', owning_lib: orgIds}, {order_by: {acpl: 'name'}}, {anonymous: true} - ).pipe(tap(loc => this.copyLocations.push(loc))).toPromise() + ).pipe(tap(loc => this.copyLocations.push(loc))).toPromise(); } browse(ctx: CatalogSearchContext): Observable { 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 d34d71105d..7e5f8109e6 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 @@ -96,7 +96,7 @@ export class CatalogMarcContext { export class CatalogIdentContext { value: string; - queryType: string; + queryType: string; reset() { this.value = ''; @@ -105,7 +105,7 @@ export class CatalogIdentContext { isSearchable() { return ( - this.value !== '' + this.value !== '' && this.queryType !== '' ); } @@ -158,8 +158,8 @@ export class CatalogTermContext { // contents of a metarecord. isMetarecordSearch(): boolean { return ( - this.isSearchable() && - this.groupByMetarecord && + this.isSearchable() && + this.groupByMetarecord && this.fromMetarecord === null ); } @@ -321,16 +321,15 @@ export class CatalogSearchContext { if (this.sort) { const parts = this.sort.split(/\./); args.sort = parts[0]; // title, author, etc. - if (parts[1]) { args.sort_dir = 'descending' }; + if (parts[1]) { args.sort_dir = 'descending'; } } return args; } compileIdentSearchQuery(): string { - - let str = ' site(' + this.searchOrg.shortname() + ')'; - return str + ' ' + + const str = ' site(' + this.searchOrg.shortname() + ')'; + return str + ' ' + this.identSearch.queryType + ':' + this.identSearch.value; } @@ -430,7 +429,7 @@ export class CatalogSearchContext { if (qcount > 1) { str += ')'; } // ------- - if (ts.hasBrowseEntry) { + if (ts.hasBrowseEntry) { // stored as a comma-separated string of "entryId,fieldId" str += ` has_browse_entry(${ts.hasBrowseEntry})`; } diff --git a/Open-ILS/src/eg2/src/app/share/util/anon-cache.service.ts b/Open-ILS/src/eg2/src/app/share/util/anon-cache.service.ts index 29c168dc71..6431160d5f 100644 --- a/Open-ILS/src/eg2/src/app/share/util/anon-cache.service.ts +++ b/Open-ILS/src/eg2/src/app/share/util/anon-cache.service.ts @@ -2,7 +2,7 @@ * Service for communicating with the server-side "anonymous" cache. */ import {Injectable} from '@angular/core'; -import {Observable} from 'rxjs/Observable'; +import {Observable} from 'rxjs'; import {StoreService} from '@eg/core/store.service'; import {NetService} from '@eg/core/net.service'; @@ -30,14 +30,14 @@ export class AnonCacheService { 'open-ils.actor', 'open-ils.actor.anon_cache.set_value', cacheKey, attr, value - ).toPromise().then(cacheKey => { - if (cacheKey) { - return cacheKey; + ).toPromise().then(key => { + if (key) { + return key; } else { return Promise.reject( - `Could not apply a value for attr=${attr} cacheKey=${cacheKey}`); + `Could not apply a value for attr=${attr} cacheKey=${key}`); } - }) + }); } removeItem(cacheKey: string, attr: string): Promise { diff --git a/Open-ILS/src/eg2/src/app/staff/catalog/basket-actions.component.ts b/Open-ILS/src/eg2/src/app/staff/catalog/basket-actions.component.ts index 08d02bcc63..e00a396d17 100644 --- a/Open-ILS/src/eg2/src/app/staff/catalog/basket-actions.component.ts +++ b/Open-ILS/src/eg2/src/app/staff/catalog/basket-actions.component.ts @@ -1,12 +1,12 @@ import {Component, OnInit, ViewChild} from '@angular/core'; import {BasketService} from '@eg/share/catalog/basket.service'; -import {Subscription} from 'rxjs/Subscription'; +import {Subscription} from 'rxjs'; import {Router} from '@angular/router'; import {NetService} from '@eg/core/net.service'; import {AuthService} from '@eg/core/auth.service'; import {PrintService} from '@eg/share/print/print.service'; -import {RecordBucketDialogComponent} - from '@eg/staff/share/buckets/record-bucket-dialog.component'; +import {RecordBucketDialogComponent + } from '@eg/staff/share/buckets/record-bucket-dialog.component'; @Component({ selector: 'eg-catalog-basket-actions', @@ -41,10 +41,10 @@ export class BasketActionsComponent implements OnInit { applyAction() { console.debug('Performing basket action', this.basketAction); - switch(this.basketAction) { + switch (this.basketAction) { case 'view': // This does not propagate search params -- unclear if needed. - this.router.navigate(['/staff/catalog/search'], + this.router.navigate(['/staff/catalog/search'], {queryParams: {showBasket: true}}); break; @@ -57,7 +57,7 @@ export class BasketActionsComponent implements OnInit { this.router.navigate(['/staff/catalog/hold/T'], {queryParams: {target: ids}}); }); - break; + break; case 'print': this.basket.getRecordIds().then(ids => { diff --git a/Open-ILS/src/eg2/src/app/staff/catalog/browse/results.component.ts b/Open-ILS/src/eg2/src/app/staff/catalog/browse/results.component.ts index 8fcbce1e65..65d02e5342 100644 --- a/Open-ILS/src/eg2/src/app/staff/catalog/browse/results.component.ts +++ b/Open-ILS/src/eg2/src/app/staff/catalog/browse/results.component.ts @@ -1,6 +1,5 @@ import {Component, OnInit, Input} from '@angular/core'; -import {Observable} from 'rxjs/Observable'; -import {Subscription} from 'rxjs/Subscription'; +import {Observable, Subscription} from 'rxjs'; import {map, switchMap, distinctUntilChanged} from 'rxjs/operators'; import {ActivatedRoute, ParamMap} from '@angular/router'; import {CatalogService} from '@eg/share/catalog/catalog.service'; @@ -49,7 +48,7 @@ export class BrowseResultsComponent implements OnInit { if (bs.isSearchable()) { this.results = []; this.cat.browse(this.searchContext) - .subscribe(result => this.addResult(result)) + .subscribe(result => this.addResult(result)); } } @@ -68,11 +67,11 @@ export class BrowseResultsComponent implements OnInit { const heading = headingStruct[fieldId][0]; const inList = result.list_authorities.filter( - id => Number(id) === Number(heading.target))[0] + id => Number(id) === Number(heading.target))[0]; - if ( heading.target + if ( heading.target && heading.main_entry - && heading.target_count + && heading.target_count && !inList && !seen[heading.target]) { @@ -119,12 +118,12 @@ export class BrowseResultsComponent implements OnInit { } } - searchByBrowseEntry(result) { + searchByBrowseEntry(result) { // Avoid propagating browse values to term search. this.searchContext.browseSearch.reset(); - this.searchContext.termSearch.hasBrowseEntry = + this.searchContext.termSearch.hasBrowseEntry = result.browse_entry + ',' + result.fields; this.staffCat.search(); } diff --git a/Open-ILS/src/eg2/src/app/staff/catalog/hold/hold.component.ts b/Open-ILS/src/eg2/src/app/staff/catalog/hold/hold.component.ts index a0a0dc24f4..3cfbb19ba9 100644 --- a/Open-ILS/src/eg2/src/app/staff/catalog/hold/hold.component.ts +++ b/Open-ILS/src/eg2/src/app/staff/catalog/hold/hold.component.ts @@ -1,7 +1,7 @@ import {Component, OnInit, Input, ViewChild, Renderer2} from '@angular/core'; -import {Observable} from 'rxjs/Observable'; import {Router, ActivatedRoute, ParamMap} from '@angular/router'; -import {tap} from 'rxjs/operators/tap'; +import {Observable} from 'rxjs'; +import {tap} from 'rxjs/operators'; import {EventService} from '@eg/core/event.service'; import {NetService} from '@eg/core/net.service'; import {AuthService} from '@eg/core/auth.service'; @@ -13,8 +13,8 @@ import {BibRecordService, BibRecordSummary} from '@eg/share/catalog/bib-record.s import {CatalogSearchContext, CatalogSearchState} from '@eg/share/catalog/search-context'; import {CatalogService} from '@eg/share/catalog/catalog.service'; import {StaffCatalogService} from '../catalog.service'; -import {HoldService, HoldRequest, HoldRequestTarget} - from '@eg/staff/share/hold.service'; +import {HoldService, HoldRequest, + HoldRequestTarget} from '@eg/staff/share/hold.service'; import {ComboboxEntry} from '@eg/share/combobox/combobox.component'; class HoldContext { @@ -32,7 +32,7 @@ class HoldContext { // code => selected-boolean formats: {}, langs: {} - } + }; } } @@ -40,7 +40,7 @@ class HoldContext { templateUrl: 'hold.component.html' }) export class HoldComponent implements OnInit { - + holdType: string; holdTargets: number[]; user: IdlObject; // @@ -107,15 +107,15 @@ export class HoldComponent implements OnInit { this.getTargetMeta(); this.org.settings('sms.enable').then(sets => { - this.smsEnabled = sets['sms.enable'] + this.smsEnabled = sets['sms.enable']; if (!this.smsEnabled) { return; } this.pcrud.search('csc', {active: 't'}, {order_by: {csc: 'name'}}) .subscribe(carrier => { this.smsCarriers.push({ - id: carrier.id(), + id: carrier.id(), label: carrier.name() - }) + }); }); }); @@ -154,7 +154,7 @@ export class HoldComponent implements OnInit { // Map the selected metarecord filters optoins to a JSON-encoded // list of attr filters as required by the API. - // Compiles a blob of + // Compiles a blob of // {target: JSON({"0": [{_attr: ctype, _val: code}, ...], "1": [...]})} // TODO: this should live in the hold service, not in the UI code. mrSelectorsToFilters(ctx: HoldContext): {[target: number]: string} { @@ -196,9 +196,9 @@ export class HoldComponent implements OnInit { } if (Object.keys(compiled).length > 0) { - const result = {}; - result[ctx.holdTarget] = JSON.stringify(compiled); - return result; + const res = {}; + res[ctx.holdTarget] = JSON.stringify(compiled); + return res; } return null; @@ -225,15 +225,15 @@ export class HoldComponent implements OnInit { userBarcodeChanged() { // Avoid simultaneous or duplicate lookups - if (this.userBarcode === this.currentUserBarcode) { - return; + if (this.userBarcode === this.currentUserBarcode) { + return; } this.resetForm(); - if (!this.userBarcode) { + if (!this.userBarcode) { this.user = null; - return; + return; } this.user = null; @@ -242,7 +242,7 @@ export class HoldComponent implements OnInit { this.net.request( 'open-ils.actor', 'open-ils.actor.get_barcodes', - this.auth.token(), this.auth.user().ws_ou(), + this.auth.token(), this.auth.user().ws_ou(), 'actor', this.userBarcode ).subscribe(barcodes => { @@ -292,7 +292,7 @@ export class HoldComponent implements OnInit { if (value === '' || value === null) { return; } - switch(name) { + switch (name) { case 'opac.hold_notify': this.notifyPhone = Boolean(value.match(/phone/)); this.notifyEmail = Boolean(value.match(/email/)); @@ -300,7 +300,7 @@ export class HoldComponent implements OnInit { break; case 'opac.default_pickup_location': - this.pickupLib = value; + this.pickupLib = value; break; } }); @@ -322,7 +322,7 @@ export class HoldComponent implements OnInit { const target = this.holdTargets[idx]; const ctx = this.holdContexts.filter( - ctx => ctx.holdTarget === target)[0]; + c => c.holdTarget === target)[0]; this.placeOneHold(ctx).then(() => this.placeHolds(idx + 1)); } @@ -352,15 +352,15 @@ export class HoldComponent implements OnInit { console.log('hold returned: ', request); ctx.lastRequest = request; ctx.processing = false; - + // If this request failed and was not already an override, // see of this user has permission to override. - if (!request.override && + if (!request.override && !request.result.success && request.result.evt) { - + const txtcode = request.result.evt.textcode; const perm = txtcode + '.override'; - + return this.perm.hasWorkPermHere(perm).then( permResult => ctx.canOverride = permResult[perm]); } @@ -377,7 +377,7 @@ export class HoldComponent implements OnInit { } canOverride(ctx: HoldContext): boolean { - return ctx.lastRequest && + return ctx.lastRequest && !ctx.lastRequest.result.success && ctx.canOverride; } diff --git a/Open-ILS/src/eg2/src/app/staff/catalog/record/parts.component.ts b/Open-ILS/src/eg2/src/app/staff/catalog/record/parts.component.ts index e74fc12d42..3ab8e8f8e9 100644 --- a/Open-ILS/src/eg2/src/app/staff/catalog/record/parts.component.ts +++ b/Open-ILS/src/eg2/src/app/staff/catalog/record/parts.component.ts @@ -73,7 +73,7 @@ export class PartsComponent implements OnInit { order_by: orderBy }; - return this.pcrud.search('bmp', + return this.pcrud.search('bmp', {record: this.recId, deleted: 'f'}, searchOps); }; diff --git a/Open-ILS/src/eg2/src/app/staff/catalog/record/record.component.ts b/Open-ILS/src/eg2/src/app/staff/catalog/record/record.component.ts index 0414a076b4..e6832f1ab9 100644 --- a/Open-ILS/src/eg2/src/app/staff/catalog/record/record.component.ts +++ b/Open-ILS/src/eg2/src/app/staff/catalog/record/record.component.ts @@ -43,7 +43,7 @@ export class RecordComponent implements OnInit { ngOnInit() { this.searchContext = this.staffCat.searchContext; - this.defaultTab = + this.defaultTab = this.store.getLocalItem('eg.cat.default_record_tab') || 'catalog'; @@ -96,12 +96,12 @@ export class RecordComponent implements OnInit { if (this.recordTab in ANGJS_TABS) { const angjsBase = '/eg/staff/cat/catalog/record'; - window.location.href = + window.location.href = `${angjsBase}/${this.recordId}/${this.recordTab}`; return; } - const url = + const url = `/staff/catalog/record/${this.recordId}/${this.recordTab}`; // Retain search parameters diff --git a/Open-ILS/src/eg2/src/app/staff/catalog/resolver.service.ts b/Open-ILS/src/eg2/src/app/staff/catalog/resolver.service.ts index 02b44c90df..7dde4b4635 100644 --- a/Open-ILS/src/eg2/src/app/staff/catalog/resolver.service.ts +++ b/Open-ILS/src/eg2/src/app/staff/catalog/resolver.service.ts @@ -39,14 +39,14 @@ export class CatalogResolver implements Resolve> { fetchSettings(): Promise { return this.store.getItemBatch([ - 'eg.search.search_lib', + 'eg.search.search_lib', 'eg.search.pref_lib' ]).then(settings => { - this.staffCat.defaultSearchOrg = + this.staffCat.defaultSearchOrg = this.org.get(settings['eg.search.search_lib']); - this.staffCat.prefOrg = + this.staffCat.prefOrg = this.org.get(settings['eg.search.pref_lib']); - }) + }); } } diff --git a/Open-ILS/src/eg2/src/app/staff/catalog/result/record.component.ts b/Open-ILS/src/eg2/src/app/staff/catalog/result/record.component.ts index 7510b3d108..dd13b9d8f6 100644 --- a/Open-ILS/src/eg2/src/app/staff/catalog/result/record.component.ts +++ b/Open-ILS/src/eg2/src/app/staff/catalog/result/record.component.ts @@ -1,5 +1,5 @@ import {Component, OnInit, OnDestroy, Input} from '@angular/core'; -import {Subscription} from 'rxjs/Subscription'; +import {Subscription} from 'rxjs'; import {Router} from '@angular/router'; import {OrgService} from '@eg/core/org.service'; import {NetService} from '@eg/core/net.service'; @@ -67,7 +67,7 @@ export class ResultRecordComponent implements OnInit, OnDestroy { holdTarget = this.summary.metabibId; } - this.router.navigate([`/staff/catalog/hold/${holdType}`], + this.router.navigate([`/staff/catalog/hold/${holdType}`], {queryParams: {target: holdTarget}}); } @@ -88,7 +88,7 @@ export class ResultRecordComponent implements OnInit, OnDestroy { navigateToRecord(summary: BibRecordSummary) { const params = this.catUrl.toUrlParams(this.searchContext); - // Jump to metarecord constituent records page when a + // Jump to metarecord constituent records page when a // MR has more than 1 constituents. if (summary.metabibId && summary.metabibRecords.length > 1) { this.searchContext.termSearch.fromMetarecord = summary.metabibId; diff --git a/Open-ILS/src/eg2/src/app/staff/catalog/result/results.component.ts b/Open-ILS/src/eg2/src/app/staff/catalog/result/results.component.ts index 6a03b9bdd2..869eff2e79 100644 --- a/Open-ILS/src/eg2/src/app/staff/catalog/result/results.component.ts +++ b/Open-ILS/src/eg2/src/app/staff/catalog/result/results.component.ts @@ -49,7 +49,7 @@ export class ResultsComponent implements OnInit, OnDestroy { // searches. // // This will also fire on page load. - this.routeSub = + this.routeSub = this.route.queryParamMap.subscribe((params: ParamMap) => { // TODO: Angular docs suggest using switchMap(), but @@ -82,8 +82,8 @@ export class ResultsComponent implements OnInit, OnDestroy { const ids = this.searchContext.currentResultIds(); let allChecked = true; ids.forEach(id => { - if (!this.basket.hasRecordId(id)) { - allChecked = false; + if (!this.basket.hasRecordId(id)) { + allChecked = false; } }); this.allRecsSelected = allChecked; 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 711ff90ac7..5b16f71816 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 @@ -29,7 +29,6 @@ export class SearchFormComponent implements OnInit, AfterViewInit { private staffCat: StaffCatalogService ) { this.copyLocations = []; - //this.searchTab = 'term'; } ngOnInit() { @@ -140,9 +139,9 @@ export class SearchFormComponent implements OnInit, AfterViewInit { // TODO: is this how we avoid displaying too many locations? const org = this.context.searchOrg; - if (org.id() === this.org.root().id()) { + if (org.id() === this.org.root().id()) { this.copyLocations = []; - return; + return; } this.cat.fetchCopyLocations(org).then(() => @@ -184,7 +183,7 @@ export class SearchFormComponent implements OnInit, AfterViewInit { this.context.pager.offset = 0; // New search // Form search overrides basket display - this.context.showBasket = false; + this.context.showBasket = false; switch (this.searchTab) { @@ -199,7 +198,7 @@ export class SearchFormComponent implements OnInit, AfterViewInit { this.staffCat.search(); break; - case 'ident': + case 'ident': this.context.marcSearch.reset(); this.context.browseSearch.reset(); this.context.termSearch.reset(); diff --git a/Open-ILS/src/eg2/src/app/staff/nav.component.ts b/Open-ILS/src/eg2/src/app/staff/nav.component.ts index 54bbcbe511..852562c8f1 100644 --- a/Open-ILS/src/eg2/src/app/staff/nav.component.ts +++ b/Open-ILS/src/eg2/src/app/staff/nav.component.ts @@ -45,11 +45,11 @@ export class StaffNavComponent implements OnInit { ); // NOTE: this can eventually go away. - // Avoid attempts to fetch org settings if the user has not yet + // Avoid attempts to fetch org settings if the user has not yet // logged in (e.g. this is the login page). if (this.user()) { this.org.settings('ui.staff.angular_catalog.enabled') - .then(settings => this.showAngularCatalog = + .then(settings => this.showAngularCatalog = Boolean(settings['ui.staff.angular_catalog.enabled'])); } } diff --git a/Open-ILS/src/eg2/src/app/staff/share/hold.service.ts b/Open-ILS/src/eg2/src/app/staff/share/hold.service.ts index 3d89c20523..00e7374943 100644 --- a/Open-ILS/src/eg2/src/app/staff/share/hold.service.ts +++ b/Open-ILS/src/eg2/src/app/staff/share/hold.service.ts @@ -2,23 +2,22 @@ * Common code for mananging holdings */ import {Injectable, EventEmitter} from '@angular/core'; -import {Observable} from 'rxjs/Observable'; -import {map} from 'rxjs/operators/map'; -import {mergeMap} from 'rxjs/operators/mergeMap'; +import {Observable} from 'rxjs'; +import {map, mergeMap} from 'rxjs/operators'; import {IdlObject} from '@eg/core/idl.service'; import {NetService} from '@eg/core/net.service'; import {PcrudService} from '@eg/core/pcrud.service'; import {EventService, EgEvent} from '@eg/core/event.service'; import {AuthService} from '@eg/core/auth.service'; -import {BibRecordService, BibRecordSummary} - from '@eg/share/catalog/bib-record.service'; +import {BibRecordService, + BibRecordSummary} from '@eg/share/catalog/bib-record.service'; // Response from a place-holds API call. export interface HoldRequestResult { success: boolean; holdId?: number; evt?: EgEvent; -}; +} // Values passed to the place-holds API call. export interface HoldRequest { @@ -35,8 +34,8 @@ export interface HoldRequest { thawDate?: string; // ISO date frozen?: boolean; holdableFormats?: {[target: number]: string}; - result?: HoldRequestResult -}; + result?: HoldRequestResult; +} // A fleshed hold request target object containing whatever data is // available for each hold type / target. E.g. a TITLE hold will @@ -69,7 +68,7 @@ export class HoldService { ) {} placeHold(request: HoldRequest): Observable { - + let method = 'open-ils.circ.holds.test_and_create.batch'; if (request.override) { method = method + '.override'; } @@ -119,7 +118,7 @@ export class HoldService { )); } - getHoldTargetMeta(holdType: string, holdTarget: number | number[], + getHoldTargetMeta(holdType: string, holdTarget: number | number[], orgId?: number): Observable { const targetIds = [].concat(holdTarget); -- 2.43.2