From 464bcb3885fd38100930e998cc42156b60d6a6a7 Mon Sep 17 00:00:00 2001 From: Bill Erickson Date: Thu, 17 May 2018 18:09:27 -0400 Subject: [PATCH] LP#1775466 ng-lint updates Signed-off-by: Bill Erickson --- Open-ILS/src/eg2/src/app/core/auth.service.ts | 66 ++++++++------- Open-ILS/src/eg2/src/app/core/net.service.ts | 54 ++++++------ Open-ILS/src/eg2/src/app/core/org.service.ts | 95 ++++++++++++---------- Open-ILS/src/eg2/src/app/core/pcrud.service.ts | 86 ++++++++++---------- Open-ILS/src/eg2/src/app/share/grid/grid.ts | 2 +- .../app/share/org-select/org-select.component.ts | 19 +++-- .../eg2/src/app/staff/catalog/resolver.service.ts | 3 +- .../app/staff/catalog/result/results.component.ts | 2 +- Open-ILS/src/eg2/src/app/staff/resolver.service.ts | 4 +- .../eg2/src/app/staff/sandbox/sandbox.component.ts | 10 ++- Open-ILS/src/eg2/tslint.json | 2 - 11 files changed, 188 insertions(+), 155 deletions(-) diff --git a/Open-ILS/src/eg2/src/app/core/auth.service.ts b/Open-ILS/src/eg2/src/app/core/auth.service.ts index 73fc9fd121..f43cfc55b4 100644 --- a/Open-ILS/src/eg2/src/app/core/auth.service.ts +++ b/Open-ILS/src/eg2/src/app/core/auth.service.ts @@ -23,10 +23,10 @@ class EgAuthUser { // Params required for calling the login() method. interface EgAuthLoginArgs { - username: string, - password: string, - type: string, - workstation?: string + username: string; + password: string; + type: string; + workstation?: string; } export enum EgAuthWsState { @@ -35,7 +35,7 @@ export enum EgAuthWsState { NOT_FOUND_SERVER, NOT_FOUND_LOCAL, VALID -}; +} @Injectable() export class EgAuthService { @@ -59,7 +59,7 @@ export class EgAuthService { ) { // BroadcastChannel is not yet defined in PhantomJS and elsewhere - this.authChannel = (typeof BroadcastChannel == 'undefined') ? + this.authChannel = (typeof BroadcastChannel === 'undefined') ? {} : new BroadcastChannel('eg.auth'); } @@ -70,29 +70,29 @@ export class EgAuthService { // - Accessor functions always refer to the active user. - user(): EgIdlObject { + user(): EgIdlObject { return this.activeUser ? this.activeUser.user : null; - }; + } // Workstation name. - workstation(): string { + workstation(): string { return this.activeUser ? this.activeUser.workstation : null; - }; + } - token(): string { + token(): string { return this.activeUser ? this.activeUser.token : null; - }; + } - authtime(): number { + authtime(): number { return this.activeUser ? this.activeUser.authtime : 0; - }; + } // NOTE: EgNetService emits an event if the auth session has expired. // This only rejects when no authtoken is found. testAuthToken(): Promise { if (!this.activeUser) { - // Only necessary on new page loads. During op-change, + // Only necessary on new page loads. During op-change, // for example, we already have an activeUser. this.activeUser = new EgAuthUser( this.store.getLoginSessionItem('eg.auth.token'), @@ -100,7 +100,9 @@ export class EgAuthService { ); } - if (!this.token()) return Promise.reject('no authtoken'); + if (!this.token()) { + return Promise.reject('no authtoken'); + } return this.net.request( 'open-ils.auth', @@ -118,8 +120,8 @@ export class EgAuthService { return this.net.request('open-ils.auth', 'open-ils.auth.login', args) .toPromise().then(res => { return this.handleLoginResponse( - args, this.egEvt.parse(res), isOpChange) - }) + args, this.egEvt.parse(res), isOpChange); + }); } handleLoginResponse( @@ -169,8 +171,8 @@ export class EgAuthService { this.store.getLoginSessionItem('eg.auth.time.oc'), this.activeUser.workstation ); - this.store.removeLoginSessionItem('eg.auth.token.oc'); - this.store.removeLoginSessionItem('eg.auth.time.oc'); + this.store.removeLoginSessionItem('eg.auth.token.oc'); + this.store.removeLoginSessionItem('eg.auth.time.oc'); this.store.setLoginSessionItem('eg.auth.token', this.token()); this.store.setLoginSessionItem('eg.auth.time', this.authtime()); } @@ -182,27 +184,29 @@ export class EgAuthService { * Listen for logout events initiated by other browser tabs. */ listenForLogout(): void { - if (this.authChannel.onmessage) return; + if (this.authChannel.onmessage) { + return; + } this.authChannel.onmessage = (e) => { console.debug( `received eg.auth broadcast ${JSON.stringify(e.data)}`); - if (e.data.action == 'logout') { + if (e.data.action === 'logout') { // Logout will be handled by the originating tab. // We just need to clear tab-local memory. this.cleanup(); this.net.authExpired$.emit({viaExternal: true}); } - } + }; } /** - * Force-check the validity of the authtoken on occasion. + * Force-check the validity of the authtoken on occasion. * This allows us to redirect an idle staff client back to the login * page after the session times out. Otherwise, the UI would stay * open with potentially sensitive data visible. - * TODO: What is the practical difference (for a browser) between + * TODO: What is the practical difference (for a browser) between * checking auth validity and the ui.general.idle_timeout setting? * Does that setting serve a purpose in a browser environment? */ @@ -210,7 +214,7 @@ export class EgAuthService { // add a 5 second delay to give the token plenty of time // to expire on the server. - let pollTime = this.authtime() * 1000 + 5000; + const pollTime = this.authtime() * 1000 + 5000; console.debug('polling with timeout ' + pollTime); @@ -233,7 +237,7 @@ export class EgAuthService { } - // Resolves if login workstation matches a workstation known to this + // Resolves if login workstation matches a workstation known to this // browser instance. No attempt is made to see if the workstation // is present on the server. That happens at login time. verifyWorkstation(): Promise { @@ -253,8 +257,8 @@ export class EgAuthService { .then(workstations => { if (workstations) { - let ws = workstations.filter( - w => {return w.id == this.user().wsid()})[0]; + const ws = workstations.filter( + w => Number(w.id) === Number(this.user().wsid()))[0]; if (ws) { this.activeUser.workstation = ws.name; @@ -274,7 +278,7 @@ export class EgAuthService { this.net.request( 'open-ils.auth', 'open-ils.auth.session.delete', this.token()) - .subscribe(x => console.debug('logged out')) + .subscribe(x => console.debug('logged out')); } } @@ -297,7 +301,7 @@ export class EgAuthService { // Invalidate server auth token and clean up. logout(): void { this.deleteSession(); - this.store.clearLoginSessionItems(); + this.store.clearLoginSessionItems(); this.cleanup(); } } diff --git a/Open-ILS/src/eg2/src/app/core/net.service.ts b/Open-ILS/src/eg2/src/app/core/net.service.ts index bcedfc7033..660201a726 100644 --- a/Open-ILS/src/eg2/src/app/core/net.service.ts +++ b/Open-ILS/src/eg2/src/app/core/net.service.ts @@ -1,5 +1,5 @@ /** - * + * * constructor(private net : EgNetService) { * ... * this.net.request(service, method, param1 [, param2, ...]) @@ -17,11 +17,12 @@ * * } * - * Each response is relayed via Observable.next(). The interface is + * Each response is relayed via Observable.next(). The interface is * the same for streaming and atomic requests. */ import {Injectable, EventEmitter} from '@angular/core'; -import {Observable, Observer} from 'rxjs/Rx'; +import {Observable} from 'rxjs/Observable'; +import {Observer} from 'rxjs/Observer'; import {EgEventService, EgEvent} from './event.service'; // Global vars from opensrf.js @@ -29,15 +30,15 @@ import {EgEventService, EgEvent} from './event.service'; declare var OpenSRF, OSRF_TRANSPORT_TYPE_WS; export class EgNetRequest { - service : string; - method : string; - params : any[]; - observer : Observer; - superseded : boolean = false; + service: string; + method: string; + params: any[]; + observer: Observer; + superseded = false; // If set, this will be used instead of a one-off OpenSRF.ClientSession. - session? : any; + session?: any; // True if we're using a single-use local session - localSession: boolean = true; + localSession = true; // Last EgEvent encountered by this request. // Most callers will not need to import EgEvent since the parsed @@ -58,7 +59,7 @@ export class EgNetRequest { } export interface EgAuthExpiredEvent { - // request is set when the auth expiration was determined as a + // request is set when the auth expiration was determined as a // by-product of making an API call. request?: EgNetRequest; @@ -73,13 +74,13 @@ export class EgNetService { permFailed$: EventEmitter; authExpired$: EventEmitter; - // If true, permission failures are emitted via permFailed$ + // If true, permission failures are emitted via permFailed$ // and the active request is marked as superseded. permFailedHasHandler: Boolean = false; constructor( private egEvt: EgEventService - ) { + ) { this.permFailed$ = new EventEmitter(); this.authExpired$ = new EventEmitter(); } @@ -90,7 +91,7 @@ export class EgNetService { } // Array params version - requestWithParamList(service: string, + requestWithParamList(service: string, method: string, params: any[]): Observable { return this.requestCompiled( new EgNetRequest(service, method, params)); @@ -118,30 +119,33 @@ export class EgNetService { oncomplete : () => { // TODO: teach opensrf.js to call cleanup() inside - // disconnect() and teach EgPcrud to call cleanup() + // disconnect() and teach EgPcrud to call cleanup() // as needed to avoid long-lived session data bloat. - if (request.localSession) + if (request.localSession) { request.session.cleanup(); + } - // A superseded request will be complete()'ed by the + // A superseded request will be complete()'ed by the // superseder at a later time. - if (!request.superseded) + if (!request.superseded) { request.observer.complete(); + } }, onresponse : r => { this.dispatchResponse(request, r.recv().content()); }, onerror : errmsg => { - let msg = `${request.method} failed! See server logs. ${errmsg}`; + const msg = `${request.method} failed! See server logs. ${errmsg}`; console.error(msg); request.observer.error(msg); }, - onmethoderror : (req, statCode, statMsg) => { - let msg = + onmethoderror : (req, statCode, statMsg) => { + const msg = `${request.method} failed! stat=${statCode} msg=${statMsg}`; console.error(msg); - if (request.service == 'open-ils.pcrud' && statCode == 401) { + if (request.service === 'open-ils.pcrud' + && Number(statCode) === 401) { // 401 is the PCRUD equivalent of a NO_SESSION event this.authExpired$.emit({request: request}); } @@ -159,7 +163,7 @@ export class EgNetService { request.evt = this.egEvt.parse(response); if (request.evt) { - switch(request.evt.textcode) { + switch (request.evt.textcode) { case 'NO_SESSION': console.debug(`EgNet emitting event: ${request.evt}`); @@ -174,10 +178,10 @@ export class EgNetService { this.permFailed$.emit(request); return; } - } + } } // Pass the response to the caller. request.observer.next(response); - }; + } } 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 b2ad2505da..3a16708eca 100644 --- a/Open-ILS/src/eg2/src/app/core/org.service.ts +++ b/Open-ILS/src/eg2/src/app/core/org.service.ts @@ -1,5 +1,5 @@ import {Injectable} from '@angular/core'; -import {Observable} from 'rxjs/Rx'; +import {Observable} from 'rxjs/Observable'; import {EgIdlObject, EgIdlService} from './idl.service'; import {EgNetService} from './net.service'; import {EgAuthService} from './auth.service'; @@ -34,8 +34,9 @@ export class EgOrgService { ) {} get(nodeOrId: EgOrgNodeOrId): EgIdlObject { - if (typeof nodeOrId == 'object') + if (typeof nodeOrId === 'object') { return nodeOrId; + } return this.orgMap[nodeOrId]; } @@ -53,22 +54,24 @@ export class EgOrgService { this.list().forEach(org => { let chu = filter.canHaveUsers; - if (chu && !this.canHaveUsers(org)) return; - if (chu === false && this.canHaveUsers(org)) return; + if (chu && !this.canHaveUsers(org)) { return; } + if (chu === false && this.canHaveUsers(org)) { return; } let chv = filter.canHaveVolumes; - if (chv && !this.canHaveVolumes(org)) return; - if (chv === false && this.canHaveVolumes(org)) return; + if (chv && !this.canHaveVolumes(org)) { return; } + if (chv === false && this.canHaveVolumes(org)) { return; } let ov = filter.opacVisible; - if (ov && !this.opacVisible(org)) return; - if (ov === false && this.opacVisible(org)) return; + if (ov && !this.opacVisible(org)) { return; } + if (ov === false && this.opacVisible(org)) { return; } - if (filter.inList && filter.inList.indexOf(org.id()) == -1) + if (filter.inList && filter.inList.indexOf(org.id()) == -1) { return; + } - if (filter.notInList && filter.notInList.indexOf(org.id()) > -1) + if (filter.notInList && filter.notInList.indexOf(org.id()) > -1) { return; + } // All filter tests passed. Add it to the list list.push(asId ? org.id() : org); @@ -89,20 +92,20 @@ export class EgOrgService { // list of org_unit objects or IDs for ancestors + me ancestors(nodeOrId: EgOrgNodeOrId, asId?: boolean): any[] { let node = this.get(nodeOrId); - if (!node) return []; + if (!node) { return []; } let nodes = [node]; - while( (node = this.get(node.parent_ou()))) + while( (node = this.get(node.parent_ou()))) { nodes.push(node); - if (asId) return nodes.map(n => n.id()); + } + if (asId) { + return nodes.map(n => n.id()); + } return nodes; } // tests that a node can have users canHaveUsers(nodeOrId): boolean { - return this - .get(nodeOrId) - .ou_type() - .can_have_users() == 't'; + return this.get(nodeOrId).ou_type().can_have_users() === 't'; } // tests that a node can have volumes @@ -110,25 +113,26 @@ export class EgOrgService { return this .get(nodeOrId) .ou_type() - .can_have_vols() == 't'; + .can_have_vols() === 't'; } opacVisible(nodeOrId): boolean { - return this.get(nodeOrId).opac_visible() == 't'; + return this.get(nodeOrId).opac_visible() === 't'; } // list of org_unit objects or IDs for me + descendants descendants(nodeOrId: EgOrgNodeOrId, asId?: boolean): any[] { let node = this.get(nodeOrId); - if (!node) return []; + if (!node) { return []; } let nodes = []; - function descend(n) { + const descend = (n) => { nodes.push(n); n.children().forEach(descend); } descend(node); - if (asId) - return nodes.map(function(n){return n.id()}); + if (asId) { + return nodes.map(n => n.id()); + } return nodes; } @@ -136,14 +140,15 @@ export class EgOrgService { fullPath(nodeOrId: EgOrgNodeOrId, asId?: boolean): any[] { let list = this.ancestors(nodeOrId, false).concat( this.descendants(nodeOrId, false).slice(1)); - if (asId) - return list.map(function(n){return n.id()}); + if (asId) { + return list.map(n => n.id()); + } return list; } sortTree(sortField?: string, node?: EgIdlObject): void { - if (!sortField) sortField = 'shortname'; - if (!node) node = this.orgTree; + if (!sortField) { sortField = 'shortname'; } + if (!node) { node = this.orgTree; } node.children( node.children.sort((a, b) => { return a[sortField]() < b[sortField]() ? -1 : 1 @@ -151,7 +156,7 @@ export class EgOrgService { ); node.children.forEach(n => this.sortTree(n)); } - + absorbTree(node?: EgIdlObject): void { if (!node) { node = this.orgTree; @@ -178,10 +183,10 @@ export class EgOrgService { }); } - /** + /** * Populate 'target' with settings from cache where available. * Return the list of settings /not/ pulled from cache. - */ + */ private settingsFromCache(names: string[], target: any) { let cacheKeys = Object.keys(this.settingsCache); @@ -200,7 +205,7 @@ export class EgOrgService { * Fetch org settings from the network. * 'auth' is null for anonymous lookup. */ - private settingsFromNet(orgId: number, + private settingsFromNet(orgId: number, names: string[], auth?: string): Promise { let settings = {}; @@ -224,44 +229,50 @@ export class EgOrgService { /** - * + * */ - settings(names: string[], + settings(names: string[], orgId?: number, anonymous?: boolean): Promise { let settings = {}; let auth: string = null; - let useCache: boolean = false; + let useCache = false; if (this.auth.user()) { if (orgId) { - useCache = orgId == this.auth.user().ws_ou(); + useCache = Number(orgId) == Number(this.auth.user().ws_ou()); } else { orgId = this.auth.user().ws_ou(); useCache = true; } // avoid passing auth token when anonymous is requested. - if (!anonymous) auth = this.auth.token(); + if (!anonymous) { + auth = this.auth.token(); + } } else if (!anonymous) { return Promise.reject( 'Use "anonymous" To retrieve org settings without an authtoken'); } - if (useCache) names = this.settingsFromCache(names, settings); + if (useCache) { + names = this.settingsFromCache(names, settings); + } // All requested settings found in cache (or name list is empty) - if (names.length == 0) return Promise.resolve(settings); + if (names.length === 0) { + return Promise.resolve(settings); + } return this.settingsFromNet(orgId, names, auth) - .then(settings => { + .then(sets => { if (useCache) { - Object.keys(settings).forEach(key => { - this.settingsCache[key] = settings[key]; + Object.keys(sets).forEach(key => { + this.settingsCache[key] = sets[key]; }); } - return settings; + return sets; }); } } diff --git a/Open-ILS/src/eg2/src/app/core/pcrud.service.ts b/Open-ILS/src/eg2/src/app/core/pcrud.service.ts index dddf209a0d..66c4fa88f8 100644 --- a/Open-ILS/src/eg2/src/app/core/pcrud.service.ts +++ b/Open-ILS/src/eg2/src/app/core/pcrud.service.ts @@ -1,11 +1,12 @@ import {Injectable} from '@angular/core'; -import {Observable, Observer} from 'rxjs/Rx'; +import {Observable} from 'rxjs/Observable'; +import {Observer} from 'rxjs/Observer'; import {EgIdlService, EgIdlObject} from './idl.service'; import {EgNetService, EgNetRequest} from './net.service'; import {EgAuthService} from './auth.service'; // Externally defined. Used here for debugging. -declare var js2JSON: (jsThing:any) => string; +declare var js2JSON: (jsThing: any) => string; declare var OpenSRF: any; // creating sessions interface EgPcrudReqOps { @@ -20,8 +21,8 @@ type EgPcrudResponse = any; export class EgPcrudContext { - static verboseLogging: boolean = true; // - static identGenerator: number = 0; // for debug logging + static verboseLogging = true; // + static identGenerator = 0; // for debug logging private ident: number; private authoritative: boolean; @@ -35,7 +36,7 @@ export class EgPcrudContext { private net: EgNetService; private auth: EgAuthService; - // Tracks nested CUD actions + // Tracks nested CUD actions cudObserver: Observer; session: any; // OpenSRF.ClientSession @@ -58,8 +59,9 @@ export class EgPcrudContext { } log(msg: string): void { - if (EgPcrudContext.verboseLogging) + if (EgPcrudContext.verboseLogging) { console.debug(this + ': ' + msg); + } } err(msg: string): void { @@ -77,7 +79,7 @@ export class EgPcrudContext { this.session.connect({ onconnect : () => { resolve(this); } }); - }) + }); } disconnect(): void { @@ -85,46 +87,46 @@ export class EgPcrudContext { this.session.disconnect(); } - retrieve(fmClass: string, pkey: Number | string, + retrieve(fmClass: string, pkey: Number | string, pcrudOps?: any, reqOps?: EgPcrudReqOps): Observable { - if (!reqOps) reqOps = {}; + reqOps = reqOps || {}; this.authoritative = reqOps.authoritative || false; return this.dispatch( - `open-ils.pcrud.retrieve.${fmClass}`, + `open-ils.pcrud.retrieve.${fmClass}`, [this.token(reqOps), pkey, pcrudOps]); } - retrieveAll(fmClass: string, pcrudOps?: any, + retrieveAll(fmClass: string, pcrudOps?: any, reqOps?: EgPcrudReqOps): Observable { - let search = {}; + const search = {}; search[this.idl.classes[fmClass].pkey] = {'!=' : null}; return this.search(fmClass, search, pcrudOps, reqOps); } - search(fmClass: string, search: any, + search(fmClass: string, search: any, pcrudOps?: any, reqOps?: EgPcrudReqOps): Observable { reqOps = reqOps || {}; this.authoritative = reqOps.authoritative || false; - let returnType = reqOps.idlist ? 'id_list' : 'search'; + const returnType = reqOps.idlist ? 'id_list' : 'search'; let method = `open-ils.pcrud.${returnType}.${fmClass}`; - if (reqOps.atomic) method += '.atomic'; + if (reqOps.atomic) { method += '.atomic'; } return this.dispatch(method, [this.token(reqOps), search, pcrudOps]); } create(list: EgIdlObject | EgIdlObject[]): Observable { - return this.cud('create', list) + return this.cud('create', list); } update(list: EgIdlObject | EgIdlObject[]): Observable { - return this.cud('update', list) + return this.cud('update', list); } remove(list: EgIdlObject | EgIdlObject[]): Observable { - return this.cud('delete', list) + return this.cud('delete', list); } autoApply(list: EgIdlObject | EgIdlObject[]): Observable { // RENAMED - return this.cud('auto', list) + return this.cud('auto', list); } xactClose(): Observable { @@ -132,13 +134,13 @@ export class EgPcrudContext { 'open-ils.pcrud.transaction.' + this.xactCloseMode, [this.token()] ); - }; + } xactBegin(): Observable { return this.sendRequest( 'open-ils.pcrud.transaction.begin', [this.token()] ); - }; + } private dispatch(method: string, params: any[]): Observable { if (this.authoritative) { @@ -146,15 +148,15 @@ export class EgPcrudContext { return this.sendRequest(method, params); }); } else { - return this.sendRequest(method, params) + return this.sendRequest(method, params); } - }; + } // => connect - // => xact_begin + // => xact_begin // => action - // => xact_close(commit/rollback) + // => xact_close(commit/rollback) // => disconnect wrapXact(mainFunc: () => Observable): Observable { return Observable.create(observer => { @@ -163,9 +165,9 @@ export class EgPcrudContext { this.connect() // 2. start the transaction - .then(() => {return this.xactBegin().toPromise()}) + .then(() => this.xactBegin().toPromise()) - // 3. execute the main body + // 3. execute the main body .then(() => { mainFunc().subscribe( @@ -180,11 +182,11 @@ export class EgPcrudContext { }); } ); - }) + }); }); - }; + } - private sendRequest(method: string, + private sendRequest(method: string, params: any[]): Observable { this.log(`sendRequest(${method})`); @@ -195,7 +197,7 @@ export class EgPcrudContext { ); } - private cud(action: string, + private cud(action: string, list: EgIdlObject | EgIdlObject[]): Observable { this.cudList = [].concat(list); // value or array @@ -225,14 +227,14 @@ export class EgPcrudContext { } let action = this.cudAction; - let fmObj = this.cudList[this.cudIdx++]; + const fmObj = this.cudList[this.cudIdx++]; - if (action == 'auto') { - if (fmObj.ischanged()) action = 'update'; - if (fmObj.isnew()) action = 'create'; - if (fmObj.isdeleted()) action = 'delete'; + if (action === 'auto') { + if (fmObj.ischanged()) { action = 'update'; } + if (fmObj.isnew()) { action = 'create'; } + if (fmObj.isdeleted()) { action = 'delete'; } - if (action == 'auto') { + if (action === 'auto') { // object does not need updating; move along this.nextCudRequest(); } @@ -246,7 +248,7 @@ export class EgPcrudContext { err => this.cudObserver.error(err), () => this.nextCudRequest() ); - }; + } } @Injectable() @@ -268,17 +270,17 @@ export class EgPcrudService { return new EgPcrudContext(this.idl, this.net, this.auth); } - retrieve(fmClass: string, pkey: Number | string, + retrieve(fmClass: string, pkey: Number | string, pcrudOps?: any, reqOps?: EgPcrudReqOps): Observable { return this.newContext().retrieve(fmClass, pkey, pcrudOps, reqOps); } - retrieveAll(fmClass: string, pcrudOps?: any, + retrieveAll(fmClass: string, pcrudOps?: any, reqOps?: EgPcrudReqOps): Observable { return this.newContext().retrieveAll(fmClass, pcrudOps, reqOps); } - search(fmClass: string, search: any, + search(fmClass: string, search: any, pcrudOps?: any, reqOps?: EgPcrudReqOps): Observable { return this.newContext().search(fmClass, search, pcrudOps, reqOps); } @@ -295,7 +297,7 @@ export class EgPcrudService { return this.newContext().remove(list); } - autoApply(list: EgIdlObject | EgIdlObject[]): Observable { + autoApply(list: EgIdlObject | EgIdlObject[]): Observable { return this.newContext().autoApply(list); } } diff --git a/Open-ILS/src/eg2/src/app/share/grid/grid.ts b/Open-ILS/src/eg2/src/app/share/grid/grid.ts index 3a5c317112..e863c8a75b 100644 --- a/Open-ILS/src/eg2/src/app/share/grid/grid.ts +++ b/Open-ILS/src/eg2/src/app/share/grid/grid.ts @@ -2,7 +2,7 @@ * Collection of grid related classses and interfaces. */ import {TemplateRef} from '@angular/core'; -import {Observable} from 'rxjs/Rx'; +import {Observable} from 'rxjs/Observable'; import {Subscription} from "rxjs/Subscription"; import {EgIdlService, EgIdlObject} from '@eg/core/idl.service'; import {EgOrgService} from '@eg/core/org.service'; diff --git a/Open-ILS/src/eg2/src/app/share/org-select/org-select.component.ts b/Open-ILS/src/eg2/src/app/share/org-select/org-select.component.ts index 6f76875e4b..ddb5f9d980 100644 --- a/Open-ILS/src/eg2/src/app/share/org-select/org-select.component.ts +++ b/Open-ILS/src/eg2/src/app/share/org-select/org-select.component.ts @@ -1,6 +1,10 @@ import {Component, OnInit, Input, Output, ViewChild, EventEmitter} from '@angular/core'; import {Observable} from 'rxjs/Observable'; -import {map, debounceTime} from 'rxjs/operators'; +import {map} from 'rxjs/operators/map'; +import {debounceTime} from 'rxjs/operators/debounceTime'; +import {distinctUntilChanged} from 'rxjs/operators/distinctUntilChanged'; +import {merge} from 'rxjs/operators/merge'; +import {filter} from 'rxjs/operators/filter'; import {Subject} from 'rxjs/Subject'; import {EgAuthService} from '@eg/core/auth.service'; import {EgStoreService} from '@eg/core/store.service'; @@ -131,11 +135,11 @@ export class EgOrgSelectComponent implements OnInit { formatter = (result: OrgDisplay) => result.label.trim(); filter = (text$: Observable): Observable => { - return text$ - .debounceTime(200) - .distinctUntilChanged() - .merge(this.click$.filter(() => !this.instance.isPopupOpen())) - .map(term => { + return text$.pipe( + debounceTime(200), + distinctUntilChanged(), + merge(this.click$.pipe(filter(() => !this.instance.isPopupOpen()))), + map(term => { return this.org.list().filter(org => { @@ -148,7 +152,8 @@ export class EgOrgSelectComponent implements OnInit { id => {return org.id() == id}).length == 0; }).map(org => {return this.formatForDisplay(org)}) - }); + }) + ); } } 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 f081fc2077..854b93751c 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 @@ -1,5 +1,6 @@ import {Injectable} from '@angular/core'; -import {Observable, Observer} from 'rxjs/Rx'; +import {Observable} from 'rxjs/Observable'; +import {Observer} from 'rxjs/Observer'; import {Router, Resolve, RouterStateSnapshot, ActivatedRouteSnapshot} from '@angular/router'; import {EgStoreService} from '@eg/core/store.service'; 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 a970154831..1f29e85fc8 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 @@ -1,5 +1,5 @@ import {Component, OnInit, Input} from '@angular/core'; -import {Observable} from 'rxjs/Rx'; +import {Observable} from 'rxjs/Observable'; import {map, switchMap, distinctUntilChanged} from 'rxjs/operators'; import {ActivatedRoute, ParamMap} from '@angular/router'; import {EgCatalogService} from '@eg/share/catalog/catalog.service'; diff --git a/Open-ILS/src/eg2/src/app/staff/resolver.service.ts b/Open-ILS/src/eg2/src/app/staff/resolver.service.ts index d15b867a16..1746e4aaac 100644 --- a/Open-ILS/src/eg2/src/app/staff/resolver.service.ts +++ b/Open-ILS/src/eg2/src/app/staff/resolver.service.ts @@ -1,6 +1,8 @@ import {Injectable} from '@angular/core'; import {Location} from '@angular/common'; -import {Observable, Observer} from 'rxjs/Rx'; +import {Observable} from 'rxjs/Observable'; +import {Observer} from 'rxjs/Observer'; +import 'rxjs/add/observable/of'; // Observable.of() import {Router, Resolve, RouterStateSnapshot, ActivatedRoute, ActivatedRouteSnapshot} from '@angular/router'; import {EgStoreService} from '@eg/core/store.service'; diff --git a/Open-ILS/src/eg2/src/app/staff/sandbox/sandbox.component.ts b/Open-ILS/src/eg2/src/app/staff/sandbox/sandbox.component.ts index b366b2cea3..e7addc5b31 100644 --- a/Open-ILS/src/eg2/src/app/staff/sandbox/sandbox.component.ts +++ b/Open-ILS/src/eg2/src/app/staff/sandbox/sandbox.component.ts @@ -2,7 +2,10 @@ import {Component, OnInit, ViewChild, Input, TemplateRef} from '@angular/core'; import {EgProgressDialogComponent} from '@eg/share/dialog/progress.component'; import {EgToastService} from '@eg/share/toast/toast.service'; import {EgStringService} from '@eg/share/string/string.service'; -import {Observable} from 'rxjs/Rx'; +import {Observable} from 'rxjs/Observable'; +import 'rxjs/add/observable/timer'; +import {map} from 'rxjs/operators/map'; +import {take} from 'rxjs/operators/take'; import {EgGridDataSource} from '@eg/share/grid/grid'; import {EgIdlService, EgIdlObject} from '@eg/core/idl.service'; import {EgPcrudService} from '@eg/core/pcrud.service'; @@ -82,7 +85,10 @@ export class EgSandboxComponent implements OnInit { this.progressDialog.open(); // every 250ms emit x*10 for 0-10 - Observable.timer(0, 250).map(x => x * 10).take(11).subscribe( + Observable.timer(0, 250).pipe( + map(x => x * 10), + take(11) + ).subscribe( val => this.progressDialog.update({value: val, max: 100}), err => {}, () => this.progressDialog.close() diff --git a/Open-ILS/src/eg2/tslint.json b/Open-ILS/src/eg2/tslint.json index c6773f5703..450a2a7f1b 100644 --- a/Open-ILS/src/eg2/tslint.json +++ b/Open-ILS/src/eg2/tslint.json @@ -44,8 +44,6 @@ "no-bitwise": true, "no-console": [ true, - "debug", - "info", "time", "timeEnd", "trace" -- 2.11.0