LP#1626157 Final ng-lint round
authorBill Erickson <berickxx@gmail.com>
Fri, 25 May 2018 18:22:29 +0000 (14:22 -0400)
committerBill Erickson <berickxx@gmail.com>
Fri, 25 May 2018 18:22:29 +0000 (14:22 -0400)
Signed-off-by: Bill Erickson <berickxx@gmail.com>
27 files changed:
Open-ILS/src/eg2/src/app/core/event.spec.ts
Open-ILS/src/eg2/src/app/core/idl.spec.ts
Open-ILS/src/eg2/src/app/share/catalog/catalog.service.ts
Open-ILS/src/eg2/src/app/staff/admin/server/config/billing_type.component.ts
Open-ILS/src/eg2/src/app/staff/admin/server/config/hard_due_date.component.ts
Open-ILS/src/eg2/src/app/staff/admin/server/routing.module.ts
Open-ILS/src/eg2/src/app/staff/admin/workstation/routing.module.ts
Open-ILS/src/eg2/src/app/staff/admin/workstation/workstations/routing.module.ts
Open-ILS/src/eg2/src/app/staff/admin/workstation/workstations/workstations.component.ts
Open-ILS/src/eg2/src/app/staff/catalog/catalog.service.ts
Open-ILS/src/eg2/src/app/staff/catalog/record/copies.component.ts
Open-ILS/src/eg2/src/app/staff/catalog/record/pagination.component.ts
Open-ILS/src/eg2/src/app/staff/catalog/record/record.component.ts
Open-ILS/src/eg2/src/app/staff/catalog/resolver.service.ts
Open-ILS/src/eg2/src/app/staff/catalog/result/pagination.component.ts
Open-ILS/src/eg2/src/app/staff/catalog/result/record.component.html
Open-ILS/src/eg2/src/app/staff/catalog/result/record.component.ts
Open-ILS/src/eg2/src/app/staff/catalog/result/results.component.ts
Open-ILS/src/eg2/src/app/staff/catalog/search-form.component.ts
Open-ILS/src/eg2/src/app/staff/circ/patron/bcsearch/bcsearch.component.ts
Open-ILS/src/eg2/src/app/staff/circ/patron/bcsearch/bcsearch.module.ts
Open-ILS/src/eg2/src/app/staff/circ/patron/bcsearch/routing.module.ts
Open-ILS/src/eg2/src/app/staff/circ/patron/routing.module.ts
Open-ILS/src/eg2/src/app/staff/circ/routing.module.ts
Open-ILS/src/eg2/src/app/staff/sandbox/sandbox.component.ts
Open-ILS/src/eg2/src/app/staff/share/admin-page/admin-page.component.ts
Open-ILS/src/eg2/src/app/staff/share/bib-summary/bib-summary.component.ts

index a0e67ba..631a961 100644 (file)
@@ -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');
     });
 
 });
index 33cd87b..c5e8a6e 100644 (file)
@@ -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');
     });
index e7189a9..39369fc 100644 (file)
@@ -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;
     }
index 587526f..ee920b9 100644 (file)
@@ -46,7 +46,7 @@ export class BillingTypeComponent implements OnInit {
                 limit: pager.limit,
                 order_by: orderBy
             });
-        }
+        };
     }
 }
 
index 2d8463f..49c5ace 100644 (file)
@@ -46,7 +46,7 @@ export class HardDueDateComponent implements OnInit {
                 limit: pager.limit,
                 order_by: orderBy
             });
-        }
+        };
     }
 }
 
index 2a5a90f..88a68e9 100644 (file)
@@ -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';
 
index bd300d7..9599000 100644 (file)
@@ -1,4 +1,4 @@
-import {NgModule}             from '@angular/core';
+import {NgModule} from '@angular/core';
 import {RouterModule, Routes} from '@angular/router';
 
 const routes: Routes = [{
index a29f19b..cebf138 100644 (file)
@@ -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';
 
index 391e01c..0b1f36e 100644 (file)
@@ -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<number> {
         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();
             }
index 8420457..1519729 100644 (file)
@@ -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});
index a39095c..7b8c9a8 100644 (file)
@@ -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 {
index 9eba7d7..0b23447 100644 (file)
@@ -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<void> {
+    refreshSearch(limit?: number): Promise<any> {
 
         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
         );
     }
 
index b25f1e7..b07d21e 100644 (file)
@@ -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;
-            })
+                }
+            });
         });
     }
 }
index 8f1830d..a4432a8 100644 (file)
@@ -38,7 +38,7 @@ export class EgCatalogResolver implements Resolve<Promise<any[]>> {
     }
 
     fetchSettings(): Promise<any> {
-        let promises = [];
+        const promises = [];
 
         promises.push(
             this.store.getItem('eg.search.search_lib').then(
index 88afc30..b1be050 100644 (file)
@@ -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();
     }
index 1048211..d7b3945 100644 (file)
                   <span i18n>Place Hold</span>
                 </button>
               </span>
-              <span>
+              <span class="pl-1">
                 <button (click)="addToList()" 
                   class="btn btn-sm btn-info label-with-material-icon small-text-1">
                   <span class="material-icons">playlist_add_check</span>
index 8abfbaf..945d7d9 100644 (file)
@@ -61,7 +61,7 @@ export class ResultRecordComponent implements OnInit {
      * Propagate the search params along when navigating to each record.
      */
     navigatToRecord(id: number) {
-        let params = this.catUrl.toUrlParams(this.searchContext);
+        const params = this.catUrl.toUrlParams(this.searchContext);
 
         this.router.navigate(
           ['/staff/catalog/record/' + id], {queryParams: params});
index f16d5b4..039a065 100644 (file)
@@ -4,8 +4,7 @@ import {map, switchMap, distinctUntilChanged} from 'rxjs/operators';
 import {ActivatedRoute, ParamMap} from '@angular/router';
 import {EgCatalogService} from '@eg/share/catalog/catalog.service';
 import {EgCatalogUrlService} from '@eg/share/catalog/catalog-url.service';
-import {CatalogSearchContext, CatalogSearchState}
-  from '@eg/share/catalog/search-context';
+import {CatalogSearchContext, CatalogSearchState} from '@eg/share/catalog/search-context';
 import {EgPcrudService} from '@eg/core/pcrud.service';
 import {StaffCatalogService} from '../catalog.service';
 import {EgIdlObject} from '@eg/core/idl.service';
@@ -20,7 +19,7 @@ export class ResultsComponent implements OnInit {
 
     // Cache record creator/editor since this will likely be a
     // reasonably small set of data w/ lots of repitition.
-    userCache: {[id:number] : EgIdlObject} = {};
+    userCache: {[id: number]: EgIdlObject} = {};
 
     constructor(
         private route: ActivatedRoute,
@@ -49,31 +48,31 @@ export class ResultsComponent implements OnInit {
               // params and running through .distinctUntilChanged(), but
               // .map() is not firing either.  I'm missing something.
               this.searchByUrl(params);
-        })
+        });
     }
 
     searchByUrl(params: ParamMap): void {
         this.catUrl.applyUrlParams(this.searchContext, params);
 
-        // A query string is required at minimum.
-        if (!this.searchContext.isSearchable()) return;
+        if (this.searchContext.isSearchable()) {
 
-        this.cat.search(this.searchContext)
-        .then(ok => {
-            this.cat.fetchFacets(this.searchContext);
-            this.cat.fetchBibSummaries(this.searchContext)
-            .then(ok2 => this.fleshSearchResults());
-        });
+            this.cat.search(this.searchContext)
+            .then(ok => {
+                this.cat.fetchFacets(this.searchContext);
+                this.cat.fetchBibSummaries(this.searchContext)
+                .then(ok2 => this.fleshSearchResults());
+            });
+        }
     }
 
     fleshSearchResults(): void {
-        let records = this.searchContext.result.records;
-        if (records.length == 0) return;
+        const records = this.searchContext.result.records;
+        if (records.length === 0) { return; }
 
         // Flesh the creator / editor fields with the user object.
         // Handle the user fleshing here (instead of record.component so
         // we only need to grab one copy of each user.
-        let userIds: {[id:number]: boolean} = {};
+        const userIds: {[id: number]: boolean} = {};
         records.forEach(recSum => {
             if (this.userCache[recSum.creator]) {
                 recSum.creator = this.userCache[recSum.creator];
@@ -88,20 +87,24 @@ export class ResultsComponent implements OnInit {
             }
         });
 
-        if (!Object.keys(userIds).length) return;
+        if (!Object.keys(userIds).length) { return; }
 
         this.pcrud.search('au', {id : Object.keys(userIds)})
         .subscribe(usr => {
             this.userCache[usr.id()] = usr;
             records.forEach(recSum => {
-                if (recSum.creator == usr.id()) recSum.creator = usr;
-                if (recSum.editor == usr.id()) recSum.editor = usr;
+                if (recSum.creator === usr.id()) {
+                    recSum.creator = usr;
+                }
+                if (recSum.editor === usr.id()) {
+                    recSum.editor = usr;
+                }
             });
         });
     }
 
     searchIsDone(): boolean {
-        return this.searchContext.searchState == CatalogSearchState.COMPLETE;
+        return this.searchContext.searchState === CatalogSearchState.COMPLETE;
     }
 
 }
index 7081eea..976251b 100644 (file)
@@ -1,9 +1,8 @@
 import {Component, OnInit, AfterViewInit, Renderer2} from '@angular/core';
 import {EgIdlObject} from '@eg/core/idl.service';
 import {EgOrgService} from '@eg/core/org.service';
-import {EgCatalogService,} from '@eg/share/catalog/catalog.service';
-import {CatalogSearchContext, CatalogSearchState}
-  from '@eg/share/catalog/search-context';
+import {EgCatalogService} from '@eg/share/catalog/catalog.service';
+import {CatalogSearchContext, CatalogSearchState} from '@eg/share/catalog/search-context';
 import {StaffCatalogService} from './catalog.service';
 
 @Component({
@@ -14,9 +13,9 @@ import {StaffCatalogService} from './catalog.service';
 export class SearchFormComponent implements OnInit, AfterViewInit {
 
     searchContext: CatalogSearchContext;
-    ccvmMap: {[ccvm:string] : EgIdlObject[]} = {};
-    cmfMap: {[cmf:string] : EgIdlObject} = {};
-    showAdvancedSearch: boolean = false;
+    ccvmMap: {[ccvm: string]: EgIdlObject[]} = {};
+    cmfMap: {[cmf: string]: EgIdlObject} = {};
+    showAdvancedSearch = false;
 
     constructor(
         private renderer: Renderer2,
@@ -56,8 +55,9 @@ export class SearchFormComponent implements OnInit, AfterViewInit {
         // e.g. if filters were applied then removed.
         let show = false;
         Object.keys(this.searchContext.ccvmFilters).forEach(ccvm => {
-            if (this.searchContext.ccvmFilters[ccvm][0] != '')
+            if (this.searchContext.ccvmFilters[ccvm][0] !== '') {
                 show = true;
+            }
         });
 
         return show;
@@ -96,7 +96,7 @@ export class SearchFormComponent implements OnInit, AfterViewInit {
     }
 
     searchIsActive(): boolean {
-        return this.searchContext.searchState == CatalogSearchState.SEARCHING;
+        return this.searchContext.searchState === CatalogSearchState.SEARCHING;
     }
 
 }
index a8f2107..53936a8 100644 (file)
@@ -9,7 +9,7 @@ import {EgAuthService} from '@eg/core/auth.service';
 
 export class EgBcSearchComponent implements OnInit {
 
-    barcode: string = '';
+    barcode = '';
 
     constructor(
         private route: ActivatedRoute,
index cbb97b5..d16acf0 100644 (file)
@@ -1,7 +1,7 @@
-import {NgModule}                from '@angular/core';
-import {EgStaffCommonModule}     from '@eg/staff/common.module';
+import {NgModule} from '@angular/core';
+import {EgStaffCommonModule} from '@eg/staff/common.module';
 import {EgBcSearchRoutingModule} from './routing.module';
-import {EgBcSearchComponent}     from './bcsearch.component';
+import {EgBcSearchComponent} from './bcsearch.component';
 
 @NgModule({
   declarations: [
index 82f8a8b..467ced7 100644 (file)
@@ -1,6 +1,6 @@
-import {NgModule}             from '@angular/core';
+import {NgModule} from '@angular/core';
 import {RouterModule, Routes} from '@angular/router';
-import {EgBcSearchComponent}  from './bcsearch.component';
+import {EgBcSearchComponent} from './bcsearch.component';
 
 const routes: Routes = [
   { path: '',
index 0f0bbb0..06c9460 100644 (file)
@@ -1,4 +1,4 @@
-import {NgModule}             from '@angular/core';
+import {NgModule} from '@angular/core';
 import {RouterModule, Routes} from '@angular/router';
 
 const routes: Routes = [
index 3a4ffe7..b107f71 100644 (file)
@@ -1,5 +1,5 @@
-import { NgModule }             from '@angular/core';
-import { RouterModule, Routes } from '@angular/router';
+import {NgModule} from '@angular/core';
+import {RouterModule, Routes} from '@angular/router';
 
 const routes: Routes = [
   { path: 'patron',
index 05943e4..7820b7b 100644 (file)
@@ -27,8 +27,7 @@ export class EgSandboxComponent implements OnInit {
     @ViewChild('printTemplate')
     private printTemplate: TemplateRef<any>;
 
-
-    //@ViewChild('helloStr') private helloStr: EgStringComponent;
+    // @ViewChild('helloStr') private helloStr: EgStringComponent;
 
     gridDataSource: EgGridDataSource = new EgGridDataSource();
 
@@ -41,7 +40,7 @@ export class EgSandboxComponent implements OnInit {
         this.testStr = str;
     }
 
-    name: string = 'Jane';
+    name = 'Jane';
 
     constructor(
         private idl: EgIdlService,
@@ -65,7 +64,7 @@ export class EgSandboxComponent implements OnInit {
                 limit: pager.limit,
                 order_by: {cbt: 'name'}
             });
-        }
+        };
     }
 
     doPrint() {
index 3554834..0d146d3 100644 (file)
@@ -88,7 +88,7 @@ export class EgAdminPageComponent implements OnInit {
                 },
                 err => {}
             );
-        }
+        };
 
         this.deleteSelected = (idlThings: EgIdlObject[]) => {
             idlThings.forEach(idlThing => idlThing.isdeleted(true));
@@ -97,14 +97,13 @@ export class EgAdminPageComponent implements OnInit {
                 err => {},
                 ()  => this.grid.reload()
             );
-        }
+        };
     }
 
     initDataSource() {
         this.dataSource = new EgGridDataSource();
 
         this.dataSource.getRows = (pager: Pager, sort: any[]) => {
-
             const orderBy: any = {};
             if (sort.length) {
                 orderBy[this.idlClass] = sort[0].name + ' ' + sort[0].dir;
@@ -117,7 +116,7 @@ export class EgAdminPageComponent implements OnInit {
                 limit: pager.limit,
                 order_by: orderBy
             });
-        }
+        };
     }
 }
 
index ef64617..cda892f 100644 (file)
@@ -9,7 +9,8 @@ import {EgCatalogService} from '@eg/share/catalog/catalog.service';
 })
 export class EgBibSummaryComponent implements OnInit {
 
-    initDone: boolean = false;
+    initDone = false;
+    expandDisplay = true;
 
     // If provided, the record will be fetched by the component.
     @Input() recordId: number;
@@ -18,11 +19,11 @@ export class EgBibSummaryComponent implements OnInit {
     summary: any;
     @Input() set bibSummary(s: any) {
         this.summary = s;
-        if (this.initDone) this.fetchBibCallNumber();
+        if (this.initDone) {
+            this.fetchBibCallNumber();
+        }
     }
 
-    expandDisplay: boolean = true;
-
     constructor(
         private cat: EgCatalogService,
         private net: EgNetService,
@@ -34,7 +35,9 @@ export class EgBibSummaryComponent implements OnInit {
         if (this.summary) {
             this.fetchBibCallNumber();
         } else {
-            if (this.recordId) this.loadSummary();
+            if (this.recordId) {
+                this.loadSummary();
+            }
         }
     }
 
@@ -46,19 +49,23 @@ export class EgBibSummaryComponent implements OnInit {
             // Flesh the user data
             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;
-            })
+                }
+            });
         });
     }
 
     fetchBibCallNumber(): void {
-        if (!this.summary || this.summary.callNumber) return;
+        if (!this.summary || this.summary.callNumber) {
+            return;
+        }
 
         // TODO labelClass = cat.default_classification_scheme YAOUS
-        let labelClass = 1;
+        const labelClass = 1;
 
         this.net.request(
             'open-ils.cat',
@@ -66,7 +73,7 @@ export class EgBibSummaryComponent implements OnInit {
             this.summary.id, labelClass
         ).subscribe(cnArray => {
             if (cnArray && cnArray.length > 0) {
-                let key1 = Object.keys(cnArray[0])[0];
+                const key1 = Object.keys(cnArray[0])[0];
                 this.summary.callNumber = cnArray[0][key1];
             }
         });