From: Bill Erickson Date: Fri, 25 May 2018 18:22:29 +0000 (-0400) Subject: LP#1775466 Final ng-lint round X-Git-Url: https://old-git.evergreen-ils.org/?a=commitdiff_plain;h=edcd58920c65906e08ed1bb2c6b4b9f51a06d698;p=working%2FEvergreen.git LP#1775466 Final ng-lint round Signed-off-by: Bill Erickson --- diff --git a/Open-ILS/src/eg2/src/app/core/event.spec.ts b/Open-ILS/src/eg2/src/app/core/event.spec.ts index a0e67ba2be..631a9619c7 100644 --- a/Open-ILS/src/eg2/src/app/core/event.spec.ts +++ b/Open-ILS/src/eg2/src/app/core/event.spec.ts @@ -2,15 +2,17 @@ import {EgEventService} from './event.service'; describe('EgEventService', () => { let service: EgEventService; - beforeEach(() => {service = new EgEventService();}); + beforeEach(() => { + service = new EgEventService(); + }); const evt = { - ilsevent: "12345", - pid: "12345", - desc: "Test Event Description", + ilsevent: '12345', + pid: '12345', + desc: 'Test Event Description', payload: {test : 'xyz'}, - textcode: "TEST_EVENT", - servertime: "Wed Nov 6 16:05:50 2013" + textcode: 'TEST_EVENT', + servertime: 'Wed Nov 6 16:05:50 2013' }; it('should parse an event object', () => { @@ -39,7 +41,7 @@ describe('EgEventService', () => { it('should stringify an event', () => { expect(service.parse(evt).toString()).toBe( - 'Event: 12345:TEST_EVENT -> Test Event Description') + 'Event: 12345:TEST_EVENT -> Test Event Description'); }); }); diff --git a/Open-ILS/src/eg2/src/app/core/idl.spec.ts b/Open-ILS/src/eg2/src/app/core/idl.spec.ts index 33cd87ba1c..c5e8a6ea6b 100644 --- a/Open-ILS/src/eg2/src/app/core/idl.spec.ts +++ b/Open-ILS/src/eg2/src/app/core/idl.spec.ts @@ -2,7 +2,9 @@ import {EgIdlService} from './idl.service'; describe('EgIdlService', () => { let service: EgIdlService; - beforeEach(() => {service = new EgIdlService();}); + beforeEach(() => { + service = new EgIdlService(); + }); it('should parse the IDL', () => { service.parseIdl(); @@ -11,13 +13,13 @@ describe('EgIdlService', () => { it('should create an aou object', () => { service.parseIdl(); - let org = service.create('aou'); + const org = service.create('aou'); expect(typeof org.id).toBe('function'); }); it('should create an aou object with accessor/mutators', () => { service.parseIdl(); - let org = service.create('aou'); + const org = service.create('aou'); org.name('AN ORG'); expect(org.name()).toBe('AN ORG'); }); 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 e7189a9320..39369fc9dc 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 @@ -250,7 +250,7 @@ export class EgCatalogService { */ translateBibSummary(xmlDoc: XMLDocument): any { // TODO: bib summary interface - const response = { + const response: any = { copyCounts : [], ccvms : {} }; @@ -294,14 +294,17 @@ export class EgCatalogService { resolver, XPathResult.ANY_TYPE, null); while (node = result.iterateNext()) { - const counts = {}; - ['type', 'depth', 'org_unit', 'transcendant', + const counts = {type : node.getAttribute('type')}; + ['depth', 'org_unit', 'transcendant', 'available', 'count', 'unshadow'].forEach(field => { - counts[field] = node.getAttribute(field); + counts[field] = Number(node.getAttribute(field)); }); response.copyCounts.push(counts); } + response.creator = Number(response.creator); + response.editor = Number(response.editor); + // console.log(response); return response; } diff --git a/Open-ILS/src/eg2/src/app/staff/admin/server/config/billing_type.component.ts b/Open-ILS/src/eg2/src/app/staff/admin/server/config/billing_type.component.ts index 587526f172..ee920b9afe 100644 --- a/Open-ILS/src/eg2/src/app/staff/admin/server/config/billing_type.component.ts +++ b/Open-ILS/src/eg2/src/app/staff/admin/server/config/billing_type.component.ts @@ -46,7 +46,7 @@ export class BillingTypeComponent implements OnInit { limit: pager.limit, order_by: orderBy }); - } + }; } } diff --git a/Open-ILS/src/eg2/src/app/staff/admin/server/config/hard_due_date.component.ts b/Open-ILS/src/eg2/src/app/staff/admin/server/config/hard_due_date.component.ts index 2d8463f100..49c5acead7 100644 --- a/Open-ILS/src/eg2/src/app/staff/admin/server/config/hard_due_date.component.ts +++ b/Open-ILS/src/eg2/src/app/staff/admin/server/config/hard_due_date.component.ts @@ -46,7 +46,7 @@ export class HardDueDateComponent implements OnInit { limit: pager.limit, order_by: orderBy }); - } + }; } } diff --git a/Open-ILS/src/eg2/src/app/staff/admin/server/routing.module.ts b/Open-ILS/src/eg2/src/app/staff/admin/server/routing.module.ts index 2a5a90f4aa..88a68e99e4 100644 --- a/Open-ILS/src/eg2/src/app/staff/admin/server/routing.module.ts +++ b/Open-ILS/src/eg2/src/app/staff/admin/server/routing.module.ts @@ -1,4 +1,4 @@ -import {NgModule} from '@angular/core'; +import {NgModule} from '@angular/core'; import {RouterModule, Routes} from '@angular/router'; import {AdminServerSplashComponent} from './admin-server-splash.component'; diff --git a/Open-ILS/src/eg2/src/app/staff/admin/workstation/routing.module.ts b/Open-ILS/src/eg2/src/app/staff/admin/workstation/routing.module.ts index bd300d7a2b..9599000852 100644 --- a/Open-ILS/src/eg2/src/app/staff/admin/workstation/routing.module.ts +++ b/Open-ILS/src/eg2/src/app/staff/admin/workstation/routing.module.ts @@ -1,4 +1,4 @@ -import {NgModule} from '@angular/core'; +import {NgModule} from '@angular/core'; import {RouterModule, Routes} from '@angular/router'; const routes: Routes = [{ diff --git a/Open-ILS/src/eg2/src/app/staff/admin/workstation/workstations/routing.module.ts b/Open-ILS/src/eg2/src/app/staff/admin/workstation/workstations/routing.module.ts index a29f19b686..cebf138812 100644 --- a/Open-ILS/src/eg2/src/app/staff/admin/workstation/workstations/routing.module.ts +++ b/Open-ILS/src/eg2/src/app/staff/admin/workstation/workstations/routing.module.ts @@ -1,4 +1,4 @@ -import {NgModule} from '@angular/core'; +import {NgModule} from '@angular/core'; import {RouterModule, Routes} from '@angular/router'; import {WorkstationsComponent} from './workstations.component'; diff --git a/Open-ILS/src/eg2/src/app/staff/admin/workstation/workstations/workstations.component.ts b/Open-ILS/src/eg2/src/app/staff/admin/workstation/workstations/workstations.component.ts index 391e01c26c..0b1f36e075 100644 --- a/Open-ILS/src/eg2/src/app/staff/admin/workstation/workstations/workstations.component.ts +++ b/Open-ILS/src/eg2/src/app/staff/admin/workstation/workstations/workstations.component.ts @@ -55,12 +55,14 @@ export class WorkstationsComponent implements OnInit { .then(noop => this.store.getItem('eg.workstation.default')) .then(defWs => { this.defaultName = defWs; - this.selectedName = this.auth.workstation() || defWs + this.selectedName = this.auth.workstation() || defWs; }) .then(noop => { - let rm = this.route.snapshot.paramMap.get('remove'); - if (rm) this.removeSelected(this.removeWorkstation = rm) - }) + const rm = this.route.snapshot.paramMap.get('remove'); + if (rm) { + this.removeSelected(this.removeWorkstation = rm); + } + }); this.perm.hasWorkPermAt(['REGISTER_WORKSTATION'], true) .then(perms => { @@ -75,28 +77,32 @@ export class WorkstationsComponent implements OnInit { selected(): Workstation { return this.workstations.filter( - ws => {return ws.name == this.selectedName})[0]; + ws => ws.name === this.selectedName)[0]; } useNow(): void { - if (!this.selected()) return; - this.router.navigate(['/staff/login'], - {queryParams: {workstation: this.selected().name}}); + if (this.selected()) { + this.router.navigate(['/staff/login'], + {queryParams: {workstation: this.selected().name}}); + } } setDefault(): void { - if (!this.selected()) return; - this.defaultName = this.selected().name; - this.store.setItem('eg.workstation.default', this.defaultName); + if (this.selected()) { + this.defaultName = this.selected().name; + this.store.setItem('eg.workstation.default', this.defaultName); + } } removeSelected(name?: string): void { - if (!name) name = this.selected().name; + if (!name) { + name = this.selected().name; + } - this.workstations = this.workstations.filter(w => w.name != name); + this.workstations = this.workstations.filter(w => w.name !== name); this.store.setItem('eg.workstation.all', this.workstations); - if (this.defaultName == name) { + if (this.defaultName === name) { this.defaultName = null; this.store.removeItem('eg.workstation.default'); } @@ -126,30 +132,32 @@ export class WorkstationsComponent implements OnInit { this.registerWorkstationApi(true).then( wsId => resolve(wsId), notOk => reject(notOk) - ) + ); }, dismissed => reject(dismissed) - ) + ); }); } private registerWorkstationApi(override?: boolean): Promise { let method = 'open-ils.actor.workstation.register'; - if (override) method += '.override'; + if (override) { + method += '.override'; + } return new Promise((resolve, reject) => { this.net.request( 'open-ils.actor', method, this.auth.token(), this.newName, this.newOwner.id() ).subscribe(wsId => { - let evt = this.evt.parse(wsId); + const evt = this.evt.parse(wsId); if (evt) { - if (evt.textcode == 'WORKSTATION_NAME_EXISTS') { + if (evt.textcode === 'WORKSTATION_NAME_EXISTS') { this.handleCollision().then( id => resolve(id), notOk => reject(notOk) - ) + ); } else { console.error(`Registration failed ${evt}`); reject(); @@ -162,7 +170,7 @@ export class WorkstationsComponent implements OnInit { } private registerWorkstationLocal(wsId: number) { - let ws: Workstation = { + const ws: Workstation = { id: wsId, name: this.newName, owning_lib: this.newOwner.id() @@ -174,7 +182,7 @@ export class WorkstationsComponent implements OnInit { this.newName = ''; // when registering our first workstation, mark it as the // default and show it as selected in the ws selector. - if (this.workstations.length == 1) { + if (this.workstations.length === 1) { this.selectedName = ws.name; this.setDefault(); } diff --git a/Open-ILS/src/eg2/src/app/staff/catalog/catalog.service.ts b/Open-ILS/src/eg2/src/app/staff/catalog/catalog.service.ts index 84204571fb..151972980d 100644 --- a/Open-ILS/src/eg2/src/app/staff/catalog/catalog.service.ts +++ b/Open-ILS/src/eg2/src/app/staff/catalog/catalog.service.ts @@ -14,7 +14,7 @@ import {CatalogSearchContext} from '@eg/share/catalog/search-context'; export class StaffCatalogService { searchContext: CatalogSearchContext; - routeIndex: number = 0; + routeIndex = 0; defaultSearchOrg: EgIdlObject; defaultSearchLimit: number; @@ -59,9 +59,9 @@ export class StaffCatalogService { * execute the actual search. */ search(): void { - if (!this.searchContext.isSearchable()) return; + if (!this.searchContext.isSearchable()) { return; } - let params = this.catUrl.toUrlParams(this.searchContext); + const params = this.catUrl.toUrlParams(this.searchContext); // Force a new search every time this method is called, even if // it's the same as the active search. Since router navigation @@ -71,7 +71,7 @@ export class StaffCatalogService { // versions of a query param fail to cause a route navigation. // (E.g. going from two query= params to one). Investigation // pending. - params.ridx=''+this.routeIndex++; + params.ridx = '' + this.routeIndex++; this.router.navigate( ['/staff/catalog/search'], {queryParams: params}); diff --git a/Open-ILS/src/eg2/src/app/staff/catalog/record/copies.component.ts b/Open-ILS/src/eg2/src/app/staff/catalog/record/copies.component.ts index a39095c811..7b8c9a8088 100644 --- a/Open-ILS/src/eg2/src/app/staff/catalog/record/copies.component.ts +++ b/Open-ILS/src/eg2/src/app/staff/catalog/record/copies.component.ts @@ -11,15 +11,17 @@ import {EgOrgService} from '@eg/core/org.service'; export class CopiesComponent implements OnInit { pager: Pager; - copies: any[] + copies: any[]; recId: number; - initDone: boolean = false; + initDone = false; @Input() set recordId(id: number) { this.recId = id; // Only force new data collection when recordId() // is invoked after ngInit() has already run. - if (this.initDone) this.collectData(); + if (this.initDone) { + this.collectData(); + } } constructor( @@ -34,7 +36,7 @@ export class CopiesComponent implements OnInit { } collectData() { - if (!this.recId) return; + if (!this.recId) { return; } this.pager = new Pager(); this.pager.limit = 10; // TODO UI this.fetchCopies(); @@ -49,7 +51,7 @@ export class CopiesComponent implements OnInit { // "Show Result from All Libraries" i.e. global search displays // copies from all branches, sorted by search/pref libs. - let copy_depth = this.staffCat.searchContext.global ? + const copy_depth = this.staffCat.searchContext.global ? this.org.root().ou_type().depth() : this.staffCat.searchContext.searchOrg.ou_type().depth(); @@ -68,9 +70,9 @@ export class CopiesComponent implements OnInit { } holdable(copy: any): boolean { - return copy.holdable == 't' - && copy.location_holdable == 't' - && copy.status_holdable == 't'; + return copy.holdable === 't' + && copy.location_holdable === 't' + && copy.status_holdable === 't'; } firstPage(): void { diff --git a/Open-ILS/src/eg2/src/app/staff/catalog/record/pagination.component.ts b/Open-ILS/src/eg2/src/app/staff/catalog/record/pagination.component.ts index 9eba7d7c4c..0b2344757e 100644 --- a/Open-ILS/src/eg2/src/app/staff/catalog/record/pagination.component.ts +++ b/Open-ILS/src/eg2/src/app/staff/catalog/record/pagination.component.ts @@ -15,13 +15,15 @@ export class RecordPaginationComponent implements OnInit { id: number; index: number; - initDone: boolean = false; + initDone = false; searchContext: CatalogSearchContext; @Input() set recordId(id: number) { this.id = id; // Only apply new record data after the initial load - if (this.initDone) this.setIndex(); + if (this.initDone) { + this.setIndex(); + } } constructor( @@ -38,7 +40,7 @@ export class RecordPaginationComponent implements OnInit { firstRecord(): void { this.findRecordAtIndex(0).then(id => { - let params = this.catUrl.toUrlParams(this.searchContext); + const params = this.catUrl.toUrlParams(this.searchContext); this.router.navigate( ['/staff/catalog/record/' + id], {queryParams: params}); }); @@ -48,7 +50,7 @@ export class RecordPaginationComponent implements OnInit { this.findRecordAtIndex( this.searchContext.result.count - 1 ).then(id => { - let params = this.catUrl.toUrlParams(this.searchContext); + const params = this.catUrl.toUrlParams(this.searchContext); this.router.navigate( ['/staff/catalog/record/' + id], {queryParams: params}); }); @@ -56,7 +58,7 @@ export class RecordPaginationComponent implements OnInit { nextRecord(): void { this.findRecordAtIndex(this.index + 1).then(id => { - let params = this.catUrl.toUrlParams(this.searchContext); + const params = this.catUrl.toUrlParams(this.searchContext); this.router.navigate( ['/staff/catalog/record/' + id], {queryParams: params}); }); @@ -64,7 +66,7 @@ export class RecordPaginationComponent implements OnInit { prevRecord(): void { this.findRecordAtIndex(this.index - 1).then(id => { - let params = this.catUrl.toUrlParams(this.searchContext); + const params = this.catUrl.toUrlParams(this.searchContext); this.router.navigate( ['/staff/catalog/record/' + id], {queryParams: params}); }); @@ -86,12 +88,16 @@ export class RecordPaginationComponent implements OnInit { return new Promise((resolve, reject) => { this.index = this.searchContext.indexForResult(this.id); - if (this.index !== null) return resolve(); + if (this.index !== null) { + return resolve(); + } return this.refreshSearch().then(ok => { this.index = this.searchContext.indexForResult(this.id); - if (this.index === null) console.warn( - 'No search results found containing the focused record.'); + if (this.index === null) { + console.warn( + 'No search results found containing the focused record.'); + } resolve(); }); }); @@ -105,8 +111,8 @@ export class RecordPaginationComponent implements OnInit { // First see if the selected record sits in the current page // of search results. return new Promise((resolve, reject) => { - let id = this.searchContext.resultIdAt(index); - if (id) return resolve(id); + const id = this.searchContext.resultIdAt(index); + if (id) { return resolve(id); } console.debug( 'Record paginator unable to find record at index ' + index); @@ -116,9 +122,9 @@ export class RecordPaginationComponent implements OnInit { // requested record plus one more. return this.refreshSearch(index + 2).then( ok => { - let id = this.searchContext.resultIdAt(index); - if (id) { - resolve(id); + const rid = this.searchContext.resultIdAt(index); + if (rid) { + resolve(rid); } else { reject('no record found'); } @@ -127,23 +133,24 @@ export class RecordPaginationComponent implements OnInit { }); } - refreshSearch(limit?: number): Promise { + refreshSearch(limit?: number): Promise { console.debug('paginator refreshing search'); - if (!this.searchContext.isSearchable()) + if (!this.searchContext.isSearchable()) { return Promise.resolve(); + } - let origPager = this.searchContext.pager; - let tmpPager = new Pager(); + const origPager = this.searchContext.pager; + const tmpPager = new Pager(); tmpPager.limit = limit || 1000; this.searchContext.pager = tmpPager; return this.cat.search(this.searchContext) .then( - ok => { this.searchContext.pager = origPager; }, - notOk => { this.searchContext.pager = origPager } + ok => this.searchContext.pager = origPager, + notOk => this.searchContext.pager = origPager ); } 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 b25f1e7ad4..b07d21ee1b 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 @@ -2,8 +2,7 @@ import {Component, OnInit, Input} from '@angular/core'; import {ActivatedRoute, ParamMap} from '@angular/router'; import {EgPcrudService} from '@eg/core/pcrud.service'; import {EgIdlObject} from '@eg/core/idl.service'; -import {CatalogSearchContext, CatalogSearchState} - from '@eg/share/catalog/search-context'; +import {CatalogSearchContext, CatalogSearchState} from '@eg/share/catalog/search-context'; import {EgCatalogService} from '@eg/share/catalog/catalog.service'; import {StaffCatalogService} from '../catalog.service'; import {EgBibSummaryComponent} from '@eg/staff/share/bib-summary/bib-summary.component'; @@ -32,7 +31,7 @@ export class RecordComponent implements OnInit { this.route.paramMap.subscribe((params: ParamMap) => { this.recordId = +params.get('id'); this.loadRecord(); - }) + }); } loadRecord(): void { @@ -49,11 +48,13 @@ export class RecordComponent implements OnInit { this.bibSummary = summary; this.pcrud.search('au', {id: [summary.creator, summary.editor]}) .subscribe(user => { - if (user.id() == summary.creator) + if (user.id() === summary.creator) { summary.creator = user; - if (user.id() == summary.editor) + } + if (user.id() === summary.editor) { summary.editor = user; - }) + } + }); }); } } 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 8f1830d6e6..a4432a8752 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 @@ -38,7 +38,7 @@ export class EgCatalogResolver implements Resolve> { } fetchSettings(): Promise { - let promises = []; + const promises = []; promises.push( this.store.getItem('eg.search.search_lib').then( diff --git a/Open-ILS/src/eg2/src/app/staff/catalog/result/pagination.component.ts b/Open-ILS/src/eg2/src/app/staff/catalog/result/pagination.component.ts index 88afc30280..b1be050189 100644 --- a/Open-ILS/src/eg2/src/app/staff/catalog/result/pagination.component.ts +++ b/Open-ILS/src/eg2/src/app/staff/catalog/result/pagination.component.ts @@ -32,7 +32,7 @@ export class ResultPaginationComponent implements OnInit { } setPage(page: number): void { - if (this.searchContext.pager.currentPage() == page) return; + if (this.searchContext.pager.currentPage() === page) { return; } this.searchContext.pager.setPage(page); this.staffCat.search(); } diff --git a/Open-ILS/src/eg2/src/app/staff/catalog/result/record.component.html b/Open-ILS/src/eg2/src/app/staff/catalog/result/record.component.html index 1048211238..d7b3945c53 100644 --- a/Open-ILS/src/eg2/src/app/staff/catalog/result/record.component.html +++ b/Open-ILS/src/eg2/src/app/staff/catalog/result/record.component.html @@ -112,7 +112,7 @@ Place Hold - +