// 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 {
NOT_FOUND_SERVER,
NOT_FOUND_LOCAL,
VALID
-};
+}
@Injectable()
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');
}
// - 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<any> {
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'),
);
}
- if (!this.token()) return Promise.reject('no authtoken');
+ if (!this.token()) {
+ return Promise.reject('no authtoken');
+ }
return this.net.request(
'open-ils.auth',
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(
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());
}
* 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?
*/
// 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);
}
- // 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<void> {
.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;
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'));
}
}
// Invalidate server auth token and clean up.
logout(): void {
this.deleteSession();
- this.store.clearLoginSessionItems();
+ this.store.clearLoginSessionItems();
this.cleanup();
}
}
/**
- *
+ *
* constructor(private net : EgNetService) {
* ...
* this.net.request(service, method, param1 [, param2, ...])
*
* }
*
- * 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
declare var OpenSRF, OSRF_TRANSPORT_TYPE_WS;
export class EgNetRequest {
- service : string;
- method : string;
- params : any[];
- observer : Observer<any>;
- superseded : boolean = false;
+ service: string;
+ method: string;
+ params: any[];
+ observer: Observer<any>;
+ 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
}
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;
permFailed$: EventEmitter<EgNetRequest>;
authExpired$: EventEmitter<EgAuthExpiredEvent>;
- // 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<EgNetRequest>();
this.authExpired$ = new EventEmitter<EgAuthExpiredEvent>();
}
}
// Array params version
- requestWithParamList(service: string,
+ requestWithParamList(service: string,
method: string, params: any[]): Observable<any> {
return this.requestCompiled(
new EgNetRequest(service, method, params));
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});
}
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}`);
this.permFailed$.emit(request);
return;
}
- }
+ }
}
// Pass the response to the caller.
request.observer.next(response);
- };
+ }
}
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';
) {}
get(nodeOrId: EgOrgNodeOrId): EgIdlObject {
- if (typeof nodeOrId == 'object')
+ if (typeof nodeOrId === 'object') {
return nodeOrId;
+ }
return this.orgMap[nodeOrId];
}
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);
// 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
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;
}
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
);
node.children.forEach(n => this.sortTree(n));
}
-
+
absorbTree(node?: EgIdlObject): void {
if (!node) {
node = this.orgTree;
});
}
- /**
+ /**
* 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);
* 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<any> {
let settings = {};
/**
- *
+ *
*/
- settings(names: string[],
+ settings(names: string[],
orgId?: number, anonymous?: boolean): Promise<OrgSettingsBatch> {
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;
});
}
}
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 {
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;
private net: EgNetService;
private auth: EgAuthService;
- // Tracks nested CUD actions
+ // Tracks nested CUD actions
cudObserver: Observer<EgPcrudResponse>;
session: any; // OpenSRF.ClientSession
}
log(msg: string): void {
- if (EgPcrudContext.verboseLogging)
+ if (EgPcrudContext.verboseLogging) {
console.debug(this + ': ' + msg);
+ }
}
err(msg: string): void {
this.session.connect({
onconnect : () => { resolve(this); }
});
- })
+ });
}
disconnect(): void {
this.session.disconnect();
}
- retrieve(fmClass: string, pkey: Number | string,
+ retrieve(fmClass: string, pkey: Number | string,
pcrudOps?: any, reqOps?: EgPcrudReqOps): Observable<EgPcrudResponse> {
- 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<EgPcrudResponse> {
- 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<EgPcrudResponse> {
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<EgPcrudResponse> {
- return this.cud('create', list)
+ return this.cud('create', list);
}
update(list: EgIdlObject | EgIdlObject[]): Observable<EgPcrudResponse> {
- return this.cud('update', list)
+ return this.cud('update', list);
}
remove(list: EgIdlObject | EgIdlObject[]): Observable<EgPcrudResponse> {
- return this.cud('delete', list)
+ return this.cud('delete', list);
}
autoApply(list: EgIdlObject | EgIdlObject[]): Observable<EgPcrudResponse> { // RENAMED
- return this.cud('auto', list)
+ return this.cud('auto', list);
}
xactClose(): Observable<EgPcrudResponse> {
'open-ils.pcrud.transaction.' + this.xactCloseMode,
[this.token()]
);
- };
+ }
xactBegin(): Observable<EgPcrudResponse> {
return this.sendRequest(
'open-ils.pcrud.transaction.begin', [this.token()]
);
- };
+ }
private dispatch(method: string, params: any[]): Observable<EgPcrudResponse> {
if (this.authoritative) {
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<EgPcrudResponse>): Observable<EgPcrudResponse> {
return Observable.create(observer => {
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(
});
}
);
- })
+ });
});
- };
+ }
- private sendRequest(method: string,
+ private sendRequest(method: string,
params: any[]): Observable<EgPcrudResponse> {
this.log(`sendRequest(${method})`);
);
}
- private cud(action: string,
+ private cud(action: string,
list: EgIdlObject | EgIdlObject[]): Observable<EgPcrudResponse> {
this.cudList = [].concat(list); // value or array
}
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();
}
err => this.cudObserver.error(err),
() => this.nextCudRequest()
);
- };
+ }
}
@Injectable()
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<EgPcrudResponse> {
return this.newContext().retrieve(fmClass, pkey, pcrudOps, reqOps);
}
- retrieveAll(fmClass: string, pcrudOps?: any,
+ retrieveAll(fmClass: string, pcrudOps?: any,
reqOps?: EgPcrudReqOps): Observable<EgPcrudResponse> {
return this.newContext().retrieveAll(fmClass, pcrudOps, reqOps);
}
- search(fmClass: string, search: any,
+ search(fmClass: string, search: any,
pcrudOps?: any, reqOps?: EgPcrudReqOps): Observable<EgPcrudResponse> {
return this.newContext().search(fmClass, search, pcrudOps, reqOps);
}
return this.newContext().remove(list);
}
- autoApply(list: EgIdlObject | EgIdlObject[]): Observable<EgPcrudResponse> {
+ autoApply(list: EgIdlObject | EgIdlObject[]): Observable<EgPcrudResponse> {
return this.newContext().autoApply(list);
}
}
* 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';
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';
formatter = (result: OrgDisplay) => result.label.trim();
filter = (text$: Observable<string>): Observable<OrgDisplay[]> => {
- 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 => {
id => {return org.id() == id}).length == 0;
}).map(org => {return this.formatForDisplay(org)})
- });
+ })
+ );
}
}
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';
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';
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';
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';
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()
"no-bitwise": true,
"no-console": [
true,
- "debug",
- "info",
"time",
"timeEnd",
"trace"