Avoid prefixing shared classed with Eg consistent with Angular style.
Prefixing is not necessary since shared code has to be explicitly
imported.
Signed-off-by: Bill Erickson <berickxx@gmail.com>
template: '<router-outlet></router-outlet><eg-print></eg-print>'
})
-export class EgBaseComponent {
+export class BaseComponent {
}
/**
- * EgBaseModule is the shared starting point for all apps. It provides
+ * BaseModule is the shared starting point for all apps. It provides
* the root route and core services, and a simple welcome page for users
* that end up here accidentally.
*/
import {CookieModule} from 'ngx-cookie'; // import CookieMonster
import {EgCommonModule} from './common.module';
-import {EgBaseComponent} from './app.component';
-import {EgBaseRoutingModule} from './routing.module';
+import {BaseComponent} from './app.component';
+import {BaseRoutingModule} from './routing.module';
import {WelcomeComponent} from './welcome.component';
// Import and 'provide' globally required services.
@NgModule({
declarations: [
- EgBaseComponent,
+ BaseComponent,
WelcomeComponent
],
imports: [
EgCommonModule.forRoot(),
- EgBaseRoutingModule,
+ BaseRoutingModule,
BrowserModule,
NgbModule.forRoot(),
CookieModule.forRoot()
],
exports: [],
- bootstrap: [EgBaseComponent]
+ bootstrap: [BaseComponent]
})
-export class EgBaseModule {}
+export class BaseModule {}
import {FormsModule} from '@angular/forms';
import {NgbModule} from '@ng-bootstrap/ng-bootstrap';
-import {EgEventService} from '@eg/core/event.service';
-import {EgStoreService} from '@eg/core/store.service';
-import {EgIdlService} from '@eg/core/idl.service';
-import {EgNetService} from '@eg/core/net.service';
-import {EgAuthService} from '@eg/core/auth.service';
-import {EgPermService} from '@eg/core/perm.service';
-import {EgPcrudService} from '@eg/core/pcrud.service';
-import {EgOrgService} from '@eg/core/org.service';
-import {EgAudioService} from '@eg/share/util/audio.service';
-import {EgFormatService} from '@eg/share/util/format.service';
-import {EgPrintService} from '@eg/share/print/print.service';
-import {EgPrintComponent} from '@eg/share/print/print.component';
+import {EventService} from '@eg/core/event.service';
+import {StoreService} from '@eg/core/store.service';
+import {IdlService} from '@eg/core/idl.service';
+import {NetService} from '@eg/core/net.service';
+import {AuthService} from '@eg/core/auth.service';
+import {PermService} from '@eg/core/perm.service';
+import {PcrudService} from '@eg/core/pcrud.service';
+import {OrgService} from '@eg/core/org.service';
+import {AudioService} from '@eg/share/util/audio.service';
+import {FormatService} from '@eg/share/util/format.service';
+import {PrintService} from '@eg/share/print/print.service';
+import {PrintComponent} from '@eg/share/print/print.component';
@NgModule({
declarations: [
- EgPrintComponent
+ PrintComponent
],
imports: [
CommonModule,
RouterModule,
NgbModule,
FormsModule,
- EgPrintComponent
+ PrintComponent
]
})
providers: [
DatePipe,
CurrencyPipe,
- EgEventService,
- EgStoreService,
- EgIdlService,
- EgNetService,
- EgAuthService,
- EgPermService,
- EgPcrudService,
- EgOrgService,
- EgPrintService,
- EgAudioService,
- EgFormatService
+ EventService,
+ StoreService,
+ IdlService,
+ NetService,
+ AuthService,
+ PermService,
+ PcrudService,
+ OrgService,
+ PrintService,
+ AudioService,
+ FormatService
]
};
}
import {Injectable, EventEmitter} from '@angular/core';
-import {EgNetService} from './net.service';
-import {EgEventService, EgEvent} from './event.service';
-import {EgIdlService, EgIdlObject} from './idl.service';
-import {EgStoreService} from './store.service';
+import {NetService} from './net.service';
+import {EventService, EgEvent} from './event.service';
+import {IdlService, IdlObject} from './idl.service';
+import {StoreService} from './store.service';
// Not universally available.
declare var BroadcastChannel;
// Models a login instance.
-class EgAuthUser {
- user: EgIdlObject; // actor.usr (au) object
+class AuthUser {
+ user: IdlObject; // actor.usr (au) object
workstation: string; // workstation name
token: string;
authtime: number;
}
// Params required for calling the login() method.
-interface EgAuthLoginArgs {
+interface AuthLoginArgs {
username: string;
password: string;
type: string;
workstation?: string;
}
-export enum EgAuthWsState {
+export enum AuthWsState {
PENDING,
NOT_USED,
NOT_FOUND_SERVER,
}
@Injectable()
-export class EgAuthService {
+export class AuthService {
private authChannel: any;
- private activeUser: EgAuthUser = null;
+ private activeUser: AuthUser = null;
- workstationState: EgAuthWsState = EgAuthWsState.PENDING;
+ workstationState: AuthWsState = AuthWsState.PENDING;
// Used by auth-checking resolvers
redirectUrl: string;
pollTimeout: any;
constructor(
- private egEvt: EgEventService,
- private net: EgNetService,
- private store: EgStoreService
+ private egEvt: EventService,
+ private net: NetService,
+ private store: StoreService
) {
// BroadcastChannel is not yet defined in PhantomJS and elsewhere
// - Accessor functions always refer to the active user.
- user(): EgIdlObject {
+ user(): IdlObject {
return this.activeUser ? this.activeUser.user : null;
}
return this.activeUser ? this.activeUser.authtime : 0;
}
- // NOTE: EgNetService emits an event if the auth session has expired.
+ // NOTE: NetService 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,
// for example, we already have an activeUser.
- this.activeUser = new EgAuthUser(
+ this.activeUser = new AuthUser(
this.store.getLoginSessionItem('eg.auth.token'),
this.store.getLoginSessionItem('eg.auth.time')
);
'open-ils.auth',
'open-ils.auth.session.retrieve', this.token()).toPromise()
.then(user => {
- // EgNetService interceps NO_SESSION events.
+ // NetService interceps NO_SESSION events.
// We can only get here if the session is valid.
this.activeUser.user = user;
this.listenForLogout();
});
}
- login(args: EgAuthLoginArgs, isOpChange?: boolean): Promise<void> {
+ login(args: AuthLoginArgs, isOpChange?: boolean): Promise<void> {
return this.net.request('open-ils.auth', 'open-ils.auth.login', args)
.toPromise().then(res => {
return this.handleLoginResponse(
}
handleLoginResponse(
- args: EgAuthLoginArgs, evt: EgEvent, isOpChange: boolean): Promise<void> {
+ args: AuthLoginArgs, evt: EgEvent, isOpChange: boolean): Promise<void> {
switch (evt.textcode) {
case 'SUCCESS':
case 'WORKSTATION_NOT_FOUND':
console.error(`No such workstation "${args.workstation}"`);
- this.workstationState = EgAuthWsState.NOT_FOUND_SERVER;
+ this.workstationState = AuthWsState.NOT_FOUND_SERVER;
delete args.workstation;
return this.login(args, isOpChange);
}
// Stash the login data
- handleLoginOk(args: EgAuthLoginArgs, evt: EgEvent, isOpChange: boolean): Promise<void> {
+ handleLoginOk(args: AuthLoginArgs, evt: EgEvent, isOpChange: boolean): Promise<void> {
if (isOpChange) {
this.store.setLoginSessionItem('eg.auth.token.oc', this.token());
this.store.setLoginSessionItem('eg.auth.time.oc', this.authtime());
}
- this.activeUser = new EgAuthUser(
+ this.activeUser = new AuthUser(
evt.payload.authtoken,
evt.payload.authtime,
args.workstation
undoOpChange(): Promise<any> {
if (this.opChangeIsActive()) {
this.deleteSession();
- this.activeUser = new EgAuthUser(
+ this.activeUser = new AuthUser(
this.store.getLoginSessionItem('eg.auth.token.oc'),
this.store.getLoginSessionItem('eg.auth.time.oc'),
this.activeUser.workstation
0, // return extra auth details, unneeded here.
1 // avoid extending the auth timeout
- // EgNetService intercepts NO_SESSION events.
+ // NetService intercepts NO_SESSION events.
// If the promise resolves, the session is valid.
).subscribe(
user => this.sessionPoll(),
verifyWorkstation(): Promise<void> {
if (!this.user()) {
- this.workstationState = EgAuthWsState.PENDING;
+ this.workstationState = AuthWsState.PENDING;
return Promise.reject('Cannot verify workstation without user');
}
if (!this.user().wsid()) {
- this.workstationState = EgAuthWsState.NOT_USED;
+ this.workstationState = AuthWsState.NOT_USED;
return Promise.reject('User has no workstation ID to verify');
}
if (ws) {
this.activeUser.workstation = ws.name;
- this.workstationState = EgAuthWsState.VALID;
+ this.workstationState = AuthWsState.VALID;
return resolve();
}
}
- this.workstationState = EgAuthWsState.NOT_FOUND_LOCAL;
+ this.workstationState = AuthWsState.NOT_FOUND_LOCAL;
reject();
});
});
}
@Injectable()
-export class EgEventService {
+export class EventService {
/**
- * Returns an EgEvent if 'thing' is an event, null otherwise.
+ * Returns an Event if 'thing' is an event, null otherwise.
*/
parse(thing: any): EgEvent {
-import {EgEventService} from './event.service';
+import {EventService} from './event.service';
-describe('EgEventService', () => {
- let service: EgEventService;
+describe('EventService', () => {
+ let service: EventService;
beforeEach(() => {
- service = new EgEventService();
+ service = new EventService();
});
const evt = {
/**
* Every IDL object class implements this interface.
*/
-export interface EgIdlObject {
+export interface IdlObject {
a: any[];
classname: string;
_isfieldmapper: boolean;
}
@Injectable()
-export class EgIdlService {
+export class IdlService {
classes = {}; // IDL class metadata
constructors = {}; // IDL instance generators
/**
* Create a new IDL object instance.
*/
- create(cls: string, seed?: any[]): EgIdlObject {
+ create(cls: string, seed?: any[]): IdlObject {
if (this.constructors[cls]) {
return new this.constructors[cls](seed);
}
this.classes[cls].classname = cls;
// This dance lets us encode each IDL object with the
- // EgIdlObject interface. Useful for adding type restrictions
+ // IdlObject interface. Useful for adding type restrictions
// where desired for functions, etc.
- const generator: any = ((): EgIdlObject => {
+ const generator: any = ((): IdlObject => {
const x: any = function(seed) {
this.a = seed || [];
});
}
- // Makes a deep copy of an EgIdlObject's / structures containing
- // EgIdlObject's. Note we don't use JSON cross-walk because our
+ // Makes a deep copy of an IdlObject's / structures containing
+ // IdlObject's. Note we don't use JSON cross-walk because our
// JSON lib does not handle circular references.
- // @depth specifies the maximum number of steps through EgIdlObject'
+ // @depth specifies the maximum number of steps through IdlObject'
// we will traverse.
clone(source: any, depth?: number): any {
if (depth === undefined) {
-import {EgIdlService} from './idl.service';
+import {IdlService} from './idl.service';
-describe('EgIdlService', () => {
- let service: EgIdlService;
+describe('IdlService', () => {
+ let service: IdlService;
beforeEach(() => {
- service = new EgIdlService();
+ service = new IdlService();
});
it('should parse the IDL', () => {
/**
*
- * constructor(private net : EgNetService) {
+ * constructor(private net : NetService) {
* ...
* this.net.request(service, method, param1 [, param2, ...])
* .subscribe(
import {Injectable, EventEmitter} from '@angular/core';
import {Observable} from 'rxjs/Observable';
import {Observer} from 'rxjs/Observer';
-import {EgEventService, EgEvent} from './event.service';
+import {EventService, EgEvent} from './event.service';
// Global vars from opensrf.js
// These are availavble at runtime, but are not exported.
declare var OpenSRF, OSRF_TRANSPORT_TYPE_WS;
-export class EgNetRequest {
+export class NetRequest {
service: string;
method: string;
params: any[];
// True if we're using a single-use local session
localSession = true;
- // Last EgEvent encountered by this request.
- // Most callers will not need to import EgEvent since the parsed
+ // Last Event encountered by this request.
+ // Most callers will not need to import Event since the parsed
// event will be available here.
evt: EgEvent;
}
}
-export interface EgAuthExpiredEvent {
+export interface AuthExpiredEvent {
// request is set when the auth expiration was determined as a
// by-product of making an API call.
- request?: EgNetRequest;
+ request?: NetRequest;
// True if this environment (e.g. browser tab) was notified of the
// expired auth token from an external source (e.g. another browser tab).
}
@Injectable()
-export class EgNetService {
+export class NetService {
- permFailed$: EventEmitter<EgNetRequest>;
- authExpired$: EventEmitter<EgAuthExpiredEvent>;
+ permFailed$: EventEmitter<NetRequest>;
+ authExpired$: EventEmitter<AuthExpiredEvent>;
// If true, permission failures are emitted via permFailed$
// and the active request is marked as superseded.
permFailedHasHandler: Boolean = false;
constructor(
- private egEvt: EgEventService
+ private egEvt: EventService
) {
- this.permFailed$ = new EventEmitter<EgNetRequest>();
- this.authExpired$ = new EventEmitter<EgAuthExpiredEvent>();
+ this.permFailed$ = new EventEmitter<NetRequest>();
+ this.authExpired$ = new EventEmitter<AuthExpiredEvent>();
}
// Standard request call -- Variadic params version
requestWithParamList(service: string,
method: string, params: any[]): Observable<any> {
return this.requestCompiled(
- new EgNetRequest(service, method, params));
+ new NetRequest(service, method, params));
}
- // Request with pre-compiled EgNetRequest
- requestCompiled(request: EgNetRequest): Observable<any> {
+ // Request with pre-compiled NetRequest
+ requestCompiled(request: NetRequest): Observable<any> {
return Observable.create(
observer => {
request.observer = observer;
}
// Send the compiled request to the server via WebSockets
- sendCompiledRequest(request: EgNetRequest): void {
+ sendCompiledRequest(request: NetRequest): void {
OpenSRF.Session.transport = OSRF_TRANSPORT_TYPE_WS;
- console.debug(`EgNet: request ${request.method}`);
+ console.debug(`Net: request ${request.method}`);
request.session.request({
async : true, // WS only operates in async mode
oncomplete : () => {
// TODO: teach opensrf.js to call cleanup() inside
- // disconnect() and teach EgPcrud to call cleanup()
+ // disconnect() and teach Pcrud to call cleanup()
// as needed to avoid long-lived session data bloat.
if (request.localSession) {
request.session.cleanup();
switch (request.evt.textcode) {
case 'NO_SESSION':
- console.debug(`EgNet emitting event: ${request.evt}`);
+ console.debug(`Net emitting event: ${request.evt}`);
request.observer.error(request.evt.toString());
this.authExpired$.emit({request: request});
return;
case 'PERM_FAILURE':
if (this.permFailedHasHandler) {
- console.debug(`EgNet emitting event: ${request.evt}`);
+ console.debug(`Net emitting event: ${request.evt}`);
request.superseded = true;
this.permFailed$.emit(request);
return;
import {Injectable} from '@angular/core';
import {Observable} from 'rxjs/Observable';
-import {EgIdlObject, EgIdlService} from './idl.service';
-import {EgNetService} from './net.service';
-import {EgAuthService} from './auth.service';
-import {EgPcrudService} from './pcrud.service';
+import {IdlObject, IdlService} from './idl.service';
+import {NetService} from './net.service';
+import {AuthService} from './auth.service';
+import {PcrudService} from './pcrud.service';
-type EgOrgNodeOrId = number | EgIdlObject;
+type OrgNodeOrId = number | IdlObject;
interface OrgFilter {
canHaveUsers?: boolean;
}
@Injectable()
-export class EgOrgService {
+export class OrgService {
- private orgList: EgIdlObject[] = [];
- private orgTree: EgIdlObject; // root node + children
- private orgMap: {[id: number]: EgIdlObject} = {};
+ private orgList: IdlObject[] = [];
+ private orgTree: IdlObject; // root node + children
+ private orgMap: {[id: number]: IdlObject} = {};
private settingsCache: OrgSettingsBatch = {};
constructor(
- private net: EgNetService,
- private auth: EgAuthService,
- private pcrud: EgPcrudService
+ private net: NetService,
+ private auth: AuthService,
+ private pcrud: PcrudService
) {}
- get(nodeOrId: EgOrgNodeOrId): EgIdlObject {
+ get(nodeOrId: OrgNodeOrId): IdlObject {
if (typeof nodeOrId === 'object') {
return nodeOrId;
}
return this.orgMap[nodeOrId];
}
- list(): EgIdlObject[] {
+ list(): IdlObject[] {
return this.orgList;
}
return list;
}
- tree(): EgIdlObject {
+ tree(): IdlObject {
return this.orgTree;
}
// get the root OU
- root(): EgIdlObject {
+ root(): IdlObject {
return this.orgList[0];
}
// list of org_unit objects or IDs for ancestors + me
- ancestors(nodeOrId: EgOrgNodeOrId, asId?: boolean): any[] {
+ ancestors(nodeOrId: OrgNodeOrId, asId?: boolean): any[] {
let node = this.get(nodeOrId);
if (!node) { return []; }
const nodes = [node];
}
// list of org_unit objects or IDs for me + descendants
- descendants(nodeOrId: EgOrgNodeOrId, asId?: boolean): any[] {
+ descendants(nodeOrId: OrgNodeOrId, asId?: boolean): any[] {
const node = this.get(nodeOrId);
if (!node) { return []; }
const nodes = [];
}
// list of org_unit objects or IDs for ancestors + me + descendants
- fullPath(nodeOrId: EgOrgNodeOrId, asId?: boolean): any[] {
+ fullPath(nodeOrId: OrgNodeOrId, asId?: boolean): any[] {
const list = this.ancestors(nodeOrId, false).concat(
this.descendants(nodeOrId, false).slice(1));
if (asId) {
return list;
}
- sortTree(sortField?: string, node?: EgIdlObject): void {
+ sortTree(sortField?: string, node?: IdlObject): void {
if (!sortField) { sortField = 'shortname'; }
if (!node) { node = this.orgTree; }
node.children(
node.children.forEach(n => this.sortTree(n));
}
- absorbTree(node?: EgIdlObject): void {
+ absorbTree(node?: IdlObject): void {
if (!node) {
node = this.orgTree;
this.orgMap = {};
-import {EgIdlService} from './idl.service';
-import {EgEventService} from './event.service';
-import {EgNetService} from './net.service';
-import {EgAuthService} from './auth.service';
-import {EgPcrudService} from './pcrud.service';
-import {EgStoreService} from './store.service';
-import {EgOrgService} from './org.service';
+import {IdlService} from './idl.service';
+import {EventService} from './event.service';
+import {NetService} from './net.service';
+import {AuthService} from './auth.service';
+import {PcrudService} from './pcrud.service';
+import {StoreService} from './store.service';
+import {OrgService} from './org.service';
-describe('EgOrgService', () => {
- let idlService: EgIdlService;
- let netService: EgNetService;
- let authService: EgAuthService;
- let pcrudService: EgPcrudService;
- let orgService: EgOrgService;
- let evtService: EgEventService;
- let storeService: EgStoreService;
+describe('OrgService', () => {
+ let idlService: IdlService;
+ let netService: NetService;
+ let authService: AuthService;
+ let pcrudService: PcrudService;
+ let orgService: OrgService;
+ let evtService: EventService;
+ let storeService: StoreService;
beforeEach(() => {
- idlService = new EgIdlService();
- evtService = new EgEventService();
- storeService = new EgStoreService(null /* CookieService */);
- netService = new EgNetService(evtService);
- authService = new EgAuthService(evtService, netService, storeService);
- pcrudService = new EgPcrudService(idlService, netService, authService);
- orgService = new EgOrgService(netService, authService, pcrudService);
+ idlService = new IdlService();
+ evtService = new EventService();
+ storeService = new StoreService(null /* CookieService */);
+ netService = new NetService(evtService);
+ authService = new AuthService(evtService, netService, storeService);
+ pcrudService = new PcrudService(idlService, netService, authService);
+ orgService = new OrgService(netService, authService, pcrudService);
});
const initTestData = () => {
import {Injectable} from '@angular/core';
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';
+import {IdlService, IdlObject} from './idl.service';
+import {NetService, NetRequest} from './net.service';
+import {AuthService} from './auth.service';
// Externally defined. Used here for debugging.
declare var js2JSON: (jsThing: any) => string;
declare var OpenSRF: any; // creating sessions
-interface EgPcrudReqOps {
+interface PcrudReqOps {
authoritative?: boolean;
anonymous?: boolean;
idlist?: boolean;
}
// For for documentation purposes.
-type EgPcrudResponse = any;
+type PcrudResponse = any;
-export class EgPcrudContext {
+export class PcrudContext {
static verboseLogging = true; //
static identGenerator = 0; // for debug logging
private xactCloseMode: string;
private cudIdx: number;
private cudAction: string;
- private cudLast: EgPcrudResponse;
- private cudList: EgIdlObject[];
+ private cudLast: PcrudResponse;
+ private cudList: IdlObject[];
- private idl: EgIdlService;
- private net: EgNetService;
- private auth: EgAuthService;
+ private idl: IdlService;
+ private net: NetService;
+ private auth: AuthService;
// Tracks nested CUD actions
- cudObserver: Observer<EgPcrudResponse>;
+ cudObserver: Observer<PcrudResponse>;
session: any; // OpenSRF.ClientSession
constructor( // passed in by parent service -- not injected
- egIdl: EgIdlService,
- egNet: EgNetService,
- egAuth: EgAuthService
+ egIdl: IdlService,
+ egNet: NetService,
+ egAuth: AuthService
) {
this.idl = egIdl;
this.net = egNet;
this.auth = egAuth;
this.xactCloseMode = 'rollback';
- this.ident = EgPcrudContext.identGenerator++;
+ this.ident = PcrudContext.identGenerator++;
this.session = new OpenSRF.ClientSession('open-ils.pcrud');
}
}
log(msg: string): void {
- if (EgPcrudContext.verboseLogging) {
+ if (PcrudContext.verboseLogging) {
console.debug(this + ': ' + msg);
}
}
console.error(this + ': ' + msg);
}
- token(reqOps?: EgPcrudReqOps): string {
+ token(reqOps?: PcrudReqOps): string {
return (reqOps && reqOps.anonymous) ?
'ANONYMOUS' : this.auth.token();
}
- connect(): Promise<EgPcrudContext> {
+ connect(): Promise<PcrudContext> {
this.log('connect');
return new Promise( (resolve, reject) => {
this.session.connect({
}
retrieve(fmClass: string, pkey: Number | string,
- pcrudOps?: any, reqOps?: EgPcrudReqOps): Observable<EgPcrudResponse> {
+ pcrudOps?: any, reqOps?: PcrudReqOps): Observable<PcrudResponse> {
reqOps = reqOps || {};
this.authoritative = reqOps.authoritative || false;
return this.dispatch(
}
retrieveAll(fmClass: string, pcrudOps?: any,
- reqOps?: EgPcrudReqOps): Observable<EgPcrudResponse> {
+ reqOps?: PcrudReqOps): Observable<PcrudResponse> {
const search = {};
search[this.idl.classes[fmClass].pkey] = {'!=' : null};
return this.search(fmClass, search, pcrudOps, reqOps);
}
search(fmClass: string, search: any,
- pcrudOps?: any, reqOps?: EgPcrudReqOps): Observable<EgPcrudResponse> {
+ pcrudOps?: any, reqOps?: PcrudReqOps): Observable<PcrudResponse> {
reqOps = reqOps || {};
this.authoritative = reqOps.authoritative || false;
return this.dispatch(method, [this.token(reqOps), search, pcrudOps]);
}
- create(list: EgIdlObject | EgIdlObject[]): Observable<EgPcrudResponse> {
+ create(list: IdlObject | IdlObject[]): Observable<PcrudResponse> {
return this.cud('create', list);
}
- update(list: EgIdlObject | EgIdlObject[]): Observable<EgPcrudResponse> {
+ update(list: IdlObject | IdlObject[]): Observable<PcrudResponse> {
return this.cud('update', list);
}
- remove(list: EgIdlObject | EgIdlObject[]): Observable<EgPcrudResponse> {
+ remove(list: IdlObject | IdlObject[]): Observable<PcrudResponse> {
return this.cud('delete', list);
}
- autoApply(list: EgIdlObject | EgIdlObject[]): Observable<EgPcrudResponse> { // RENAMED
+ autoApply(list: IdlObject | IdlObject[]): Observable<PcrudResponse> { // RENAMED
return this.cud('auto', list);
}
- xactClose(): Observable<EgPcrudResponse> {
+ xactClose(): Observable<PcrudResponse> {
return this.sendRequest(
'open-ils.pcrud.transaction.' + this.xactCloseMode,
[this.token()]
);
}
- xactBegin(): Observable<EgPcrudResponse> {
+ xactBegin(): Observable<PcrudResponse> {
return this.sendRequest(
'open-ils.pcrud.transaction.begin', [this.token()]
);
}
- private dispatch(method: string, params: any[]): Observable<EgPcrudResponse> {
+ private dispatch(method: string, params: any[]): Observable<PcrudResponse> {
if (this.authoritative) {
return this.wrapXact(() => {
return this.sendRequest(method, params);
// => action
// => xact_close(commit/rollback)
// => disconnect
- wrapXact(mainFunc: () => Observable<EgPcrudResponse>): Observable<EgPcrudResponse> {
+ wrapXact(mainFunc: () => Observable<PcrudResponse>): Observable<PcrudResponse> {
return Observable.create(observer => {
// 1. connect
}
private sendRequest(method: string,
- params: any[]): Observable<EgPcrudResponse> {
+ params: any[]): Observable<PcrudResponse> {
// this.log(`sendRequest(${method})`);
return this.net.requestCompiled(
- new EgNetRequest(
+ new NetRequest(
'open-ils.pcrud', method, params, this.session)
);
}
private cud(action: string,
- list: EgIdlObject | EgIdlObject[]): Observable<EgPcrudResponse> {
+ list: IdlObject | IdlObject[]): Observable<PcrudResponse> {
this.cudList = [].concat(list); // value or array
this.log(`CUD(): ${action}`);
}
@Injectable()
-export class EgPcrudService {
+export class PcrudService {
constructor(
- private idl: EgIdlService,
- private net: EgNetService,
- private auth: EgAuthService
+ private idl: IdlService,
+ private net: NetService,
+ private auth: AuthService
) {}
// Pass-thru functions for one-off PCRUD calls
- connect(): Promise<EgPcrudContext> {
+ connect(): Promise<PcrudContext> {
return this.newContext().connect();
}
- newContext(): EgPcrudContext {
- return new EgPcrudContext(this.idl, this.net, this.auth);
+ newContext(): PcrudContext {
+ return new PcrudContext(this.idl, this.net, this.auth);
}
retrieve(fmClass: string, pkey: Number | string,
- pcrudOps?: any, reqOps?: EgPcrudReqOps): Observable<EgPcrudResponse> {
+ pcrudOps?: any, reqOps?: PcrudReqOps): Observable<PcrudResponse> {
return this.newContext().retrieve(fmClass, pkey, pcrudOps, reqOps);
}
retrieveAll(fmClass: string, pcrudOps?: any,
- reqOps?: EgPcrudReqOps): Observable<EgPcrudResponse> {
+ reqOps?: PcrudReqOps): Observable<PcrudResponse> {
return this.newContext().retrieveAll(fmClass, pcrudOps, reqOps);
}
search(fmClass: string, search: any,
- pcrudOps?: any, reqOps?: EgPcrudReqOps): Observable<EgPcrudResponse> {
+ pcrudOps?: any, reqOps?: PcrudReqOps): Observable<PcrudResponse> {
return this.newContext().search(fmClass, search, pcrudOps, reqOps);
}
- create(list: EgIdlObject | EgIdlObject[]): Observable<EgPcrudResponse> {
+ create(list: IdlObject | IdlObject[]): Observable<PcrudResponse> {
return this.newContext().create(list);
}
- update(list: EgIdlObject | EgIdlObject[]): Observable<EgPcrudResponse> {
+ update(list: IdlObject | IdlObject[]): Observable<PcrudResponse> {
return this.newContext().update(list);
}
- remove(list: EgIdlObject | EgIdlObject[]): Observable<EgPcrudResponse> {
+ remove(list: IdlObject | IdlObject[]): Observable<PcrudResponse> {
return this.newContext().remove(list);
}
- autoApply(list: EgIdlObject | EgIdlObject[]): Observable<EgPcrudResponse> {
+ autoApply(list: IdlObject | IdlObject[]): Observable<PcrudResponse> {
return this.newContext().autoApply(list);
}
}
import {Injectable} from '@angular/core';
-import {EgNetService} from './net.service';
-import {EgOrgService} from './org.service';
-import {EgAuthService} from './auth.service';
+import {NetService} from './net.service';
+import {OrgService} from './org.service';
+import {AuthService} from './auth.service';
interface HasPermAtResult {
[permName: string]: any[]; // org IDs or org unit objects
}
@Injectable()
-export class EgPermService {
+export class PermService {
constructor(
- private net: EgNetService,
- private org: EgOrgService,
- private auth: EgAuthService,
+ private net: NetService,
+ private org: OrgService,
+ private auth: AuthService,
) {}
// workstation not required.
import {CookieService} from 'ngx-cookie';
@Injectable()
-export class EgStoreService {
+export class StoreService {
// Base path for cookie-based storage.
// Useful for limiting cookies to subsections of the application.
-import {EgStoreService} from './store.service';
+import {StoreService} from './store.service';
-describe('EgStoreService', () => {
- let service: EgStoreService;
+describe('StoreService', () => {
+ let service: StoreService;
beforeEach(() => {
- service = new EgStoreService(null /* CookieService */);
+ service = new StoreService(null /* CookieService */);
});
it('should set/get a localStorage value', () => {
import {Injectable} from '@angular/core';
import {Router, Resolve, RouterStateSnapshot,
ActivatedRouteSnapshot} from '@angular/router';
-import {EgIdlService} from '@eg/core/idl.service';
-import {EgOrgService} from '@eg/core/org.service';
+import {IdlService} from '@eg/core/idl.service';
+import {OrgService} from '@eg/core/org.service';
@Injectable()
-export class EgBaseResolver implements Resolve<Promise<void>> {
+export class BaseResolver implements Resolve<Promise<void>> {
constructor(
private router: Router,
- private idl: EgIdlService,
- private org: EgOrgService,
+ private idl: IdlService,
+ private org: OrgService,
) {}
/**
import {NgModule} from '@angular/core';
import {RouterModule, Routes} from '@angular/router';
-import {EgBaseResolver} from './resolver.service';
+import {BaseResolver} from './resolver.service';
import {WelcomeComponent} from './welcome.component';
/**
component: WelcomeComponent
}, {
path: 'staff',
- resolve : {startup : EgBaseResolver},
- loadChildren: './staff/staff.module#EgStaffModule'
+ resolve : {startup : BaseResolver},
+ loadChildren: './staff/staff.module#StaffModule'
}
];
@NgModule({
imports: [RouterModule.forRoot(routes)],
exports: [RouterModule],
- providers: [EgBaseResolver]
+ providers: [BaseResolver]
})
-export class EgBaseRoutingModule {}
+export class BaseRoutingModule {}
Shared Angular services, components, directives, and associated classes.
These items are NOT automatically imported to the base module, though some
-may already be imported by intermediate modules (e.g. EgStaffCommonModule).
+may already be imported by intermediate modules (e.g. StaffCommonModule).
Import as needed.
/**
*/
import {Component, Input, OnInit} from '@angular/core';
-import {EgAccessKeyService} from '@eg/share/accesskey/accesskey.service';
-import {EgDialogComponent} from '@eg/share/dialog/dialog.component';
+import {AccessKeyService} from '@eg/share/accesskey/accesskey.service';
+import {DialogComponent} from '@eg/share/dialog/dialog.component';
import {NgbModal} from '@ng-bootstrap/ng-bootstrap';
@Component({
selector: 'eg-accesskey-info',
templateUrl: './accesskey-info.component.html'
})
-export class EgAccessKeyInfoComponent extends EgDialogComponent {
+export class AccessKeyInfoComponent extends DialogComponent {
constructor(
private modal: NgbModal, // required for passing to parent
- private keyService: EgAccessKeyService) {
+ private keyService: AccessKeyService) {
super(modal);
}
* >
*/
import {Directive, ElementRef, Input, OnInit} from '@angular/core';
-import {EgAccessKeyService} from '@eg/share/accesskey/accesskey.service';
+import {AccessKeyService} from '@eg/share/accesskey/accesskey.service';
@Directive({
selector: '[egAccessKey]'
})
-export class EgAccessKeyDirective implements OnInit {
+export class AccessKeyDirective implements OnInit {
// Space-separated list of key combinations
// E.g. "ctrl+h", "alt+h ctrl+y"
constructor(
private elm: ElementRef,
- private keyService: EgAccessKeyService
+ private keyService: AccessKeyService
) { }
ngOnInit() {
if (!this.keySpec) {
- console.warn('EgAccessKey no keySpec provided');
+ console.warn('AccessKey no keySpec provided');
return;
}
import {Injectable, EventEmitter, HostListener} from '@angular/core';
-export interface EgAccessKeyAssignment {
+export interface AccessKeyAssignment {
key: string; // keyboard command
desc: string; // human-friendly description
ctx: string; // template context
}
@Injectable()
-export class EgAccessKeyService {
+export class AccessKeyService {
// Assignments stored as an array with most recently assigned
// items toward the front. Most recent items have precedence.
- assignments: EgAccessKeyAssignment[] = [];
+ assignments: AccessKeyAssignment[] = [];
constructor() {}
- assign(assn: EgAccessKeyAssignment): void {
+ assign(assn: AccessKeyAssignment): void {
this.assignments.unshift(assn);
}
for (const i in this.assignments) { // for-loop to exit early
if (keySpec === this.assignments[i].key) {
const assign = this.assignments[i];
- console.debug(`EgAccessKey assignment found for ${assign.key}`);
+ console.debug(`AccessKey assignment found for ${assign.key}`);
// Allow the current digest cycle to complete before
// firing the access key action.
setTimeout(assign.action, 0);
import {Injectable} from '@angular/core';
import {ParamMap} from '@angular/router';
-import {EgOrgService} from '@eg/core/org.service';
+import {OrgService} from '@eg/core/org.service';
import {CatalogSearchContext, FacetFilter} from './search-context';
import {CATALOG_CCVM_FILTERS} from './catalog.service';
@Injectable()
-export class EgCatalogUrlService {
+export class CatalogUrlService {
// consider supporting a param name prefix/namespace
- constructor(private org: EgOrgService) { }
+ constructor(private org: OrgService) { }
/**
* Returns a URL query structure suitable for using with
import {Injectable} from '@angular/core';
-import {EgOrgService} from '@eg/core/org.service';
-import {EgUnapiService} from '@eg/share/catalog/unapi.service';
-import {EgIdlObject} from '@eg/core/idl.service';
-import {EgNetService} from '@eg/core/net.service';
-import {EgPcrudService} from '@eg/core/pcrud.service';
+import {OrgService} from '@eg/core/org.service';
+import {UnapiService} from '@eg/share/catalog/unapi.service';
+import {IdlObject} from '@eg/core/idl.service';
+import {NetService} from '@eg/core/net.service';
+import {PcrudService} from '@eg/core/pcrud.service';
import {CatalogSearchContext, CatalogSearchState} from './search-context';
export const CATALOG_CCVM_FILTERS = [
};
@Injectable()
-export class EgCatalogService {
+export class CatalogService {
- ccvmMap: {[ccvm: string]: EgIdlObject[]} = {};
- cmfMap: {[cmf: string]: EgIdlObject} = {};
+ ccvmMap: {[ccvm: string]: IdlObject[]} = {};
+ cmfMap: {[cmf: string]: IdlObject} = {};
// Keep a reference to the most recently retrieved facet data,
// since facet data is consistent across a given search.
lastFacetKey: string;
constructor(
- private net: EgNetService,
- private org: EgOrgService,
- private unapi: EgUnapiService,
- private pcrud: EgPcrudService
+ private net: NetService,
+ private org: OrgService,
+ private unapi: UnapiService,
+ private pcrud: PcrudService
) {}
search(ctx: CatalogSearchContext): Promise<void> {
summary => {
if (ctx.result.records) {
// May be reset when quickly navigating results.
- ctx.result.records[idx] = summary
+ ctx.result.records[idx] = summary;
}
}
)
});
}
- compileCcvms(ccvms: EgIdlObject[]): void {
+ compileCcvms(ccvms: IdlObject[]): void {
ccvms.forEach(ccvm => {
if (!this.ccvmMap[ccvm.ctype()]) {
this.ccvmMap[ccvm.ctype()] = [];
-import {EgOrgService} from '@eg/core/org.service';
-import {EgIdlObject} from '@eg/core/idl.service';
+import {OrgService} from '@eg/core/org.service';
+import {IdlObject} from '@eg/core/idl.service';
import {Pager} from '@eg/share/util/pager';
import {Params} from '@angular/router';
joinOp: string[];
matchOp: string[];
format: string;
- searchOrg: EgIdlObject;
+ searchOrg: IdlObject;
ccvmFilters: {[ccvmCode: string]: string[]};
facetFilters: FacetFilter[];
isStaff: boolean;
// Utility stuff
pager: Pager;
- org: EgOrgService;
+ org: OrgService;
constructor() {
this.pager = new Pager();
import {Injectable, EventEmitter} from '@angular/core';
-import {EgOrgService} from '@eg/core/org.service';
+import {OrgService} from '@eg/core/org.service';
/*
TODO: Add Display Fields to UNAPI
const UNAPI_PATH = '/opac/extras/unapi?id=tag::U2@';
-interface EgUnapiParams {
+interface UnapiParams {
target: string; // bre, ...
id: number | string; // 1 | 1,2,3,4,5
extras: string; // {holdings_xml,mra,...}
}
@Injectable()
-export class EgUnapiService {
+export class UnapiService {
- constructor(private org: EgOrgService) {}
+ constructor(private org: OrgService) {}
- createUrl(params: EgUnapiParams): string {
+ createUrl(params: UnapiParams): string {
const depth = params.depth || 0;
const org = params.orgId ? this.org.get(params.orgId) : this.org.root();
`${org.shortname()}/${depth}&format=${params.format}`;
}
- getAsXmlDocument(params: EgUnapiParams): Promise<XMLDocument> {
+ getAsXmlDocument(params: UnapiParams): Promise<XMLDocument> {
// XReq creates an XML document for us. Seems like the right
// tool for the job.
const url = this.createUrl(params);
selector: 'eg-date-select',
templateUrl: './date-select.component.html'
})
-export class EgDateSelectComponent implements OnInit {
+export class DateSelectComponent implements OnInit {
@Input() initialIso: string; // ISO string
@Input() initialYmd: string; // YYYY-MM-DD (uses local time zone)
import {Component, Input, ViewChild, TemplateRef} from '@angular/core';
-import {EgDialogComponent} from '@eg/share/dialog/dialog.component';
+import {DialogComponent} from '@eg/share/dialog/dialog.component';
@Component({
selector: 'eg-confirm-dialog',
/**
* Confirmation dialog that asks a yes/no question.
*/
-export class EgConfirmDialogComponent extends EgDialogComponent {
+export class ConfirmDialogComponent extends DialogComponent {
// What question are we asking?
@Input() public dialogBody: string;
}
/**
* Dialog base class. Handles the ngbModal logic.
* Sub-classed component templates must have a #dialogContent selector
- * at the root of the template (see EgConfirmDialogComponent).
+ * at the root of the template (see ConfirmDialogComponent).
*/
@Component({
selector: 'eg-dialog',
template: '<ng-template></ng-template>'
})
-export class EgDialogComponent implements OnInit {
+export class DialogComponent implements OnInit {
// Assume all dialogs support a title attribute.
@Input() public dialogTitle: string;
import {Component, Input, ViewChild, TemplateRef} from '@angular/core';
-import {EgDialogComponent} from '@eg/share/dialog/dialog.component';
+import {DialogComponent} from '@eg/share/dialog/dialog.component';
@Component({
selector: 'eg-progress-dialog',
*
* // assuming a template reference...
* @ViewChild('progressDialog')
- * private dialog: EgProgressDialogComponent;
+ * private dialog: ProgressDialogComponent;
*
* dialog.open();
* dialog.update({value : 0, max : 123});
* indeterminate: shows a generic value-less <progress/> with no
* clear indication of progress.
*/
-export class EgProgressDialogComponent extends EgDialogComponent {
+export class ProgressDialogComponent extends DialogComponent {
max: number;
value: number;
import {Component, Input, ViewChild, TemplateRef} from '@angular/core';
-import {EgDialogComponent} from '@eg/share/dialog/dialog.component';
+import {DialogComponent} from '@eg/share/dialog/dialog.component';
@Component({
selector: 'eg-prompt-dialog',
/**
* Promptation dialog that requests user input.
*/
-export class EgPromptDialogComponent extends EgDialogComponent {
+export class PromptDialogComponent extends DialogComponent {
// What question are we asking?
@Input() public dialogBody: string;
// Value to return to the caller
import {Component, OnInit, Input,
Output, EventEmitter, TemplateRef} from '@angular/core';
-import {EgIdlService, EgIdlObject} from '@eg/core/idl.service';
-import {EgAuthService} from '@eg/core/auth.service';
-import {EgPcrudService} from '@eg/core/pcrud.service';
-import {EgDialogComponent} from '@eg/share/dialog/dialog.component';
+import {IdlService, IdlObject} from '@eg/core/idl.service';
+import {AuthService} from '@eg/core/auth.service';
+import {PcrudService} from '@eg/core/pcrud.service';
+import {DialogComponent} from '@eg/share/dialog/dialog.component';
import {NgbModal, NgbModalOptions} from '@ng-bootstrap/ng-bootstrap';
interface CustomFieldTemplate {
interface CustomFieldContext {
// Current create/edit/view record
- record: EgIdlObject;
+ record: IdlObject;
// IDL field definition blob
field: any;
styles: ['input[type="checkbox"] {margin-left: 0px}']
})
export class FmRecordEditorComponent
- extends EgDialogComponent implements OnInit {
+ extends DialogComponent implements OnInit {
// IDL class hint (e.g. "aou")
@Input() idlClass: string;
recId: any;
// IDL record we are editing
// TODO: allow this to be update in real time by the caller?
- record: EgIdlObject;
+ record: IdlObject;
@Input() customFieldTemplates:
{[fieldName: string]: CustomFieldTemplate} = {};
// supports cases where whether a field is required or not depends
// on the current value of another field.
@Input() isRequiredOverride:
- {[field: string]: (field: string, record: EgIdlObject) => boolean};
+ {[field: string]: (field: string, record: IdlObject) => boolean};
// IDL record display label. Defaults to the IDL label.
@Input() recordLabel: string;
// Emit the modified object when the save action completes.
- @Output() onSave$ = new EventEmitter<EgIdlObject>();
+ @Output() onSave$ = new EventEmitter<IdlObject>();
// Emit the original object when the save action is canceled.
- @Output() onCancel$ = new EventEmitter<EgIdlObject>();
+ @Output() onCancel$ = new EventEmitter<IdlObject>();
// Emit an error message when the save action fails.
@Output() onError$ = new EventEmitter<string>();
constructor(
private modal: NgbModal, // required for passing to parent
- private idl: EgIdlService,
- private auth: EgAuthService,
- private pcrud: EgPcrudService) {
+ private idl: IdlService,
+ private auth: AuthService,
+ private pcrud: PcrudService) {
super(modal);
}
// Modifies the provided FM record in place, replacing JS values
// with IDL-compatible values.
- convertDatatypesToIdl(rec: EgIdlObject) {
+ convertDatatypesToIdl(rec: IdlObject) {
const fields = this.idlDef.fields;
fields.forEach(field => {
if (field.datatype === 'bool') {
}
- private flattenLinkedValues(cls: string, list: EgIdlObject[]): any[] {
+ private flattenLinkedValues(cls: string, list: IdlObject[]): any[] {
const idField = this.idl.classes[cls].pkey;
const selector =
this.idl.classes[cls].field_map[idField].selector || idField;
import {Component, Input, OnInit} from '@angular/core';
-import {EgDialogComponent} from '@eg/share/dialog/dialog.component';
-import {EgGridColumnSet} from './grid';
+import {DialogComponent} from '@eg/share/dialog/dialog.component';
+import {GridColumnSet} from './grid';
@Component({
selector: 'eg-grid-column-config',
/**
*/
-export class EgGridColumnConfigComponent extends EgDialogComponent implements OnInit {
- @Input() columnSet: EgGridColumnSet;
+export class GridColumnConfigComponent extends DialogComponent implements OnInit {
+ @Input() columnSet: GridColumnSet;
}
import {Component, Input, OnInit, Host} from '@angular/core';
-import {EgGridContext, EgGridColumn, EgGridColumnSet,
- EgGridDataSource} from './grid';
+import {GridContext, GridColumn, GridColumnSet,
+ GridDataSource} from './grid';
@Component({
selector: 'eg-grid-column-width',
templateUrl: './grid-column-width.component.html'
})
-export class EgGridColumnWidthComponent implements OnInit {
+export class GridColumnWidthComponent implements OnInit {
- @Input() gridContext: EgGridContext;
- columnSet: EgGridColumnSet;
+ @Input() gridContext: GridContext;
+ columnSet: GridColumnSet;
isVisible: boolean;
constructor() {}
this.columnSet = this.gridContext.columnSet;
}
- expandColumn(col: EgGridColumn) {
+ expandColumn(col: GridColumn) {
col.flex++;
}
- shrinkColumn(col: EgGridColumn) {
+ shrinkColumn(col: GridColumn) {
if (col.flex > 1) { col.flex--; }
}
import {Component, Input, OnInit, Host, TemplateRef} from '@angular/core';
-import {EgGridColumn, EgGridColumnSet} from './grid';
-import {EgGridComponent} from './grid.component';
+import {GridColumn, GridColumnSet} from './grid';
+import {GridComponent} from './grid.component';
@Component({
selector: 'eg-grid-column',
template: '<ng-template></ng-template>'
})
-export class EgGridColumnComponent implements OnInit {
+export class GridColumnComponent implements OnInit {
- // Note most input fields should match class fields for EgGridColumn
+ // Note most input fields should match class fields for GridColumn
@Input() name: string;
@Input() path: string;
@Input() label: string;
@Input() cellTemplate: TemplateRef<any>;
// get a reference to our container grid.
- constructor(@Host() private grid: EgGridComponent) {}
+ constructor(@Host() private grid: GridComponent) {}
ngOnInit() {
if (!this.grid) {
- console.warn('EgGridColumnComponent needs an <eg-grid>');
+ console.warn('GridColumnComponent needs an <eg-grid>');
return;
}
- const col = new EgGridColumn();
+ const col = new GridColumn();
col.name = this.name;
col.path = this.path;
col.label = this.label;
import {Component, Input, OnInit} from '@angular/core';
-import {EgGridContext, EgGridColumn, EgGridRowSelector,
- EgGridColumnSet, EgGridDataSource} from './grid';
+import {GridContext, GridColumn, GridRowSelector,
+ GridColumnSet, GridDataSource} from './grid';
@Component({
selector: 'eg-grid-header',
templateUrl: './grid-header.component.html'
})
-export class EgGridHeaderComponent implements OnInit {
+export class GridHeaderComponent implements OnInit {
- @Input() gridContext: EgGridContext;
- dragColumn: EgGridColumn;
+ @Input() gridContext: GridContext;
+ dragColumn: GridColumn;
constructor() {}
$event.preventDefault();
}
- onColumnDrop(col: EgGridColumn) {
+ onColumnDrop(col: GridColumn) {
this.gridContext.columnSet.insertBefore(this.dragColumn, col);
this.gridContext.columnSet.columns.forEach(c => c.isDragTarget = false);
}
- sortOneColumn(col: EgGridColumn) {
+ sortOneColumn(col: GridColumn) {
let dir = 'ASC';
const sort = this.gridContext.dataSource.sort;
// Returns true if the provided column is sorting in the
// specified direction.
- isColumnSorting(col: EgGridColumn, dir: string): boolean {
+ isColumnSorting(col: GridColumn, dir: string): boolean {
const sort = this.gridContext.dataSource.sort.filter(c => c.name === col.name)[0];
return sort && sort.dir === dir;
}
import {Component, Input, OnInit, Host, TemplateRef} from '@angular/core';
-import {EgGridToolbarAction} from './grid';
-import {EgGridComponent} from './grid.component';
+import {GridToolbarAction} from './grid';
+import {GridComponent} from './grid.component';
@Component({
selector: 'eg-grid-toolbar-action',
template: '<ng-template></ng-template>'
})
-export class EgGridToolbarActionComponent implements OnInit {
+export class GridToolbarActionComponent implements OnInit {
- // Note most input fields should match class fields for EgGridColumn
+ // Note most input fields should match class fields for GridColumn
@Input() label: string;
@Input() action: (rows: any[]) => any;
// get a reference to our container grid.
- constructor(@Host() private grid: EgGridComponent) {}
+ constructor(@Host() private grid: GridComponent) {}
ngOnInit() {
if (!this.grid) {
- console.warn('EgGridToolbarActionComponent needs a [grid]');
+ console.warn('GridToolbarActionComponent needs a [grid]');
return;
}
- const action = new EgGridToolbarAction();
+ const action = new GridToolbarAction();
action.label = this.label;
action.action = this.action;
import {Component, Input, OnInit, Host, TemplateRef} from '@angular/core';
-import {EgGridToolbarButton} from './grid';
-import {EgGridComponent} from './grid.component';
+import {GridToolbarButton} from './grid';
+import {GridComponent} from './grid.component';
@Component({
selector: 'eg-grid-toolbar-button',
template: '<ng-template></ng-template>'
})
-export class EgGridToolbarButtonComponent implements OnInit {
+export class GridToolbarButtonComponent implements OnInit {
- // Note most input fields should match class fields for EgGridColumn
+ // Note most input fields should match class fields for GridColumn
@Input() label: string;
@Input() action: () => any;
// get a reference to our container grid.
- constructor(@Host() private grid: EgGridComponent) {}
+ constructor(@Host() private grid: GridComponent) {}
ngOnInit() {
if (!this.grid) {
- console.warn('EgGridToolbarButtonComponent needs a [grid]');
+ console.warn('GridToolbarButtonComponent needs a [grid]');
return;
}
- const btn = new EgGridToolbarButton();
+ const btn = new GridToolbarButton();
btn.label = this.label;
btn.action = this.action;
import {Component, Input, OnInit, Host} from '@angular/core';
import {DomSanitizer, SafeUrl} from '@angular/platform-browser';
import {Pager} from '@eg/share/util/pager';
-import {EgGridColumn, EgGridColumnSet, EgGridToolbarButton,
- EgGridToolbarAction, EgGridContext, EgGridDataSource} from '@eg/share/grid/grid';
-import {EgGridColumnWidthComponent} from './grid-column-width.component';
+import {GridColumn, GridColumnSet, GridToolbarButton,
+ GridToolbarAction, GridContext, GridDataSource} from '@eg/share/grid/grid';
+import {GridColumnWidthComponent} from './grid-column-width.component';
@Component({
selector: 'eg-grid-toolbar',
templateUrl: 'grid-toolbar.component.html'
})
-export class EgGridToolbarComponent implements OnInit {
+export class GridToolbarComponent implements OnInit {
- @Input() gridContext: EgGridContext;
- @Input() colWidthConfig: EgGridColumnWidthComponent;
+ @Input() gridContext: GridContext;
+ @Input() colWidthConfig: GridColumnWidthComponent;
csvExportInProgress: boolean;
csvExportUrl: SafeUrl;
);
}
- performAction(action: EgGridToolbarAction) {
+ performAction(action: GridToolbarAction) {
action.action(this.gridContext.getSelectedRows());
}
import {Component, Input, OnInit, AfterViewInit, EventEmitter, OnDestroy,
HostListener, ViewEncapsulation} from '@angular/core';
import {Subscription} from 'rxjs/Subscription';
-import {EgIdlService} from '@eg/core/idl.service';
-import {EgOrgService} from '@eg/core/org.service';
-import {EgStoreService} from '@eg/core/store.service';
-import {EgFormatService} from '@eg/share/util/format.service';
-import {EgGridContext, EgGridColumn, EgGridDataSource} from './grid';
+import {IdlService} from '@eg/core/idl.service';
+import {OrgService} from '@eg/core/org.service';
+import {StoreService} from '@eg/core/store.service';
+import {FormatService} from '@eg/share/util/format.service';
+import {GridContext, GridColumn, GridDataSource} from './grid';
@Component({
selector: 'eg-grid',
encapsulation: ViewEncapsulation.None
})
-export class EgGridComponent implements OnInit, AfterViewInit, OnDestroy {
+export class GridComponent implements OnInit, AfterViewInit, OnDestroy {
@Input() mainLabel: string;
- @Input() dataSource: EgGridDataSource;
+ @Input() dataSource: GridDataSource;
@Input() idlClass: string;
@Input() isSortable: boolean;
@Input() isMultiSortable: boolean;
@Input() persistKey: string;
@Input() disableMultiSelect: boolean;
- context: EgGridContext;
+ context: GridContext;
onRowActivate$: EventEmitter<any>;
onRowClick$: EventEmitter<any>;
constructor(
- private idl: EgIdlService,
- private org: EgOrgService,
- private store: EgStoreService,
- private format: EgFormatService
+ private idl: IdlService,
+ private org: OrgService,
+ private store: StoreService,
+ private format: FormatService
) {
this.context =
- new EgGridContext(this.idl, this.org, this.store, this.format);
+ new GridContext(this.idl, this.org, this.store, this.format);
this.onRowActivate$ = new EventEmitter<any>();
this.onRowClick$ = new EventEmitter<any>();
}
import {NgModule} from '@angular/core';
import {EgCommonModule} from '@eg/common.module';
-import {EgGridComponent} from './grid.component';
-import {EgGridColumnComponent} from './grid-column.component';
-import {EgGridHeaderComponent} from './grid-header.component';
-import {EgGridToolbarComponent} from './grid-toolbar.component';
-import {EgGridToolbarButtonComponent} from './grid-toolbar-button.component';
-import {EgGridToolbarActionComponent} from './grid-toolbar-action.component';
-import {EgGridColumnConfigComponent} from './grid-column-config.component';
-import {EgGridColumnWidthComponent} from './grid-column-width.component';
+import {GridComponent} from './grid.component';
+import {GridColumnComponent} from './grid-column.component';
+import {GridHeaderComponent} from './grid-header.component';
+import {GridToolbarComponent} from './grid-toolbar.component';
+import {GridToolbarButtonComponent} from './grid-toolbar-button.component';
+import {GridToolbarActionComponent} from './grid-toolbar-action.component';
+import {GridColumnConfigComponent} from './grid-column-config.component';
+import {GridColumnWidthComponent} from './grid-column-width.component';
@NgModule({
declarations: [
// public + internal components
- EgGridComponent,
- EgGridColumnComponent,
- EgGridHeaderComponent,
- EgGridToolbarComponent,
- EgGridToolbarButtonComponent,
- EgGridToolbarActionComponent,
- EgGridColumnConfigComponent,
- EgGridColumnWidthComponent
+ GridComponent,
+ GridColumnComponent,
+ GridHeaderComponent,
+ GridToolbarComponent,
+ GridToolbarButtonComponent,
+ GridToolbarActionComponent,
+ GridColumnConfigComponent,
+ GridColumnWidthComponent
],
imports: [
EgCommonModule
],
exports: [
// public components
- EgGridComponent,
- EgGridColumnComponent,
- EgGridToolbarButtonComponent,
- EgGridToolbarActionComponent
+ GridComponent,
+ GridColumnComponent,
+ GridToolbarButtonComponent,
+ GridToolbarActionComponent
],
providers: [
]
})
-export class EgGridModule {
+export class GridModule {
}
import {TemplateRef} from '@angular/core';
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 {EgStoreService} from '@eg/core/store.service';
-import {EgFormatService} from '@eg/share/util/format.service';
+import {IdlService, IdlObject} from '@eg/core/idl.service';
+import {OrgService} from '@eg/core/org.service';
+import {StoreService} from '@eg/core/store.service';
+import {FormatService} from '@eg/share/util/format.service';
import {Pager} from '@eg/share/util/pager';
const MAX_ALL_ROW_COUNT = 10000;
-export class EgGridColumn {
+export class GridColumn {
name: string;
path: string;
label: string;
}
}
-export class EgGridColumnSet {
- columns: EgGridColumn[];
+export class GridColumnSet {
+ columns: GridColumn[];
idlClass: string;
- indexColumn: EgGridColumn;
+ indexColumn: GridColumn;
isSortable: boolean;
isMultiSortable: boolean;
stockVisible: string[];
this.idlClass = idlClass;
}
- add(col: EgGridColumn) {
+ add(col: GridColumn) {
// avoid dupes
if (this.getColByName(col.name)) { return; }
this.columns.push(col);
}
- getColByName(name: string): EgGridColumn {
+ getColByName(name: string): GridColumn {
return this.columns.filter(c => c.name === name)[0];
}
});
}
- applyColumnSortability(col: EgGridColumn) {
+ applyColumnSortability(col: GridColumn) {
// column sortability defaults to the sortability of the column set.
if (col.isSortable === undefined && this.isSortable) {
col.isSortable = true;
}
}
- displayColumns(): EgGridColumn[] {
+ displayColumns(): GridColumn[] {
return this.columns.filter(c => c.visible);
}
- insertBefore(source: EgGridColumn, target: EgGridColumn) {
+ insertBefore(source: GridColumn, target: GridColumn) {
let targetIdx = -1;
let sourceIdx = -1;
this.columns.forEach((col, idx) => {
this.columns = newCols;
}
- moveColumn(col: EgGridColumn, diff: number) {
+ moveColumn(col: GridColumn, diff: number) {
let srcIdx, targetIdx;
this.columns.forEach((c, i) => {
this.columns.splice(targetIdx, 0, col);
}
- compileSaveObject(): EgGridColumnPersistConf[] {
+ compileSaveObject(): GridColumnPersistConf[] {
// only store information about visible columns.
const conf = this.displayColumns();
// scrunch the data down to just the needed info
return conf.map(col => {
- const c: EgGridColumnPersistConf = {name : col.name};
+ const c: GridColumnPersistConf = {name : col.name};
if (col.align !== 'left') { c.align = col.align; }
if (col.flex !== 2) { c.flex = Number(col.flex); }
if (Number(col.sort)) { c.sort = Number(c.sort); }
});
}
- applyColumnSettings(conf: EgGridColumnPersistConf[]) {
+ applyColumnSettings(conf: GridColumnPersistConf[]) {
if (!conf || conf.length === 0) { return; }
const newCols = [];
}
-export class EgGridRowSelector {
+export class GridRowSelector {
indexes: {[string: string]: boolean};
constructor() {
-export class EgGridContext {
+export class GridContext {
pager: Pager;
idlClass: string;
isMultiSortable: boolean;
persistKey: string;
disableMultiSelect: boolean;
- dataSource: EgGridDataSource;
- columnSet: EgGridColumnSet;
- rowSelector: EgGridRowSelector;
- toolbarButtons: EgGridToolbarButton[];
- toolbarActions: EgGridToolbarAction[];
+ dataSource: GridDataSource;
+ columnSet: GridColumnSet;
+ rowSelector: GridRowSelector;
+ toolbarButtons: GridToolbarButton[];
+ toolbarActions: GridToolbarAction[];
lastSelectedIndex: any;
pageChanges: Subscription;
mainLabel: string;
// Services injected by our grid component
- idl: EgIdlService;
- org: EgOrgService;
- store: EgStoreService;
- format: EgFormatService;
+ idl: IdlService;
+ org: OrgService;
+ store: StoreService;
+ format: FormatService;
constructor(
- idl: EgIdlService, org: EgOrgService,
- store: EgStoreService, format: EgFormatService) {
+ idl: IdlService, org: OrgService,
+ store: StoreService, format: FormatService) {
this.idl = idl;
this.org = org;
this.format = format;
this.pager = new Pager();
this.pager.limit = 10; // TODO config
- this.rowSelector = new EgGridRowSelector();
+ this.rowSelector = new GridRowSelector();
this.toolbarButtons = [];
this.toolbarActions = [];
}
init() {
- this.columnSet = new EgGridColumnSet(this.idlClass);
+ this.columnSet = new GridColumnSet(this.idlClass);
this.columnSet.isSortable = this.isSortable === true;
this.columnSet.isMultiSortable = this.isMultiSortable === true;
this.generateColumns();
return selected;
}
- getRowColumnValue(row: any, col: EgGridColumn): string {
+ getRowColumnValue(row: any, col: GridColumn): string {
let val;
if (typeof row[col.name] === 'function') {
val = row[col.name]();
return this.format.transform({value: val, datatype: col.datatype});
}
- getColumnTextContent(row: any, col: EgGridColumn): string {
+ getColumnTextContent(row: any, col: GridColumn): string {
if (col.cellTemplate) {
// TODO
} else {
if (this.columnSet.idlClass) {
this.idl.classes[this.columnSet.idlClass].fields.forEach(field => {
if (field.virtual) { return; }
- const col = new EgGridColumn();
+ const col = new GridColumn();
col.name = field.name;
col.label = field.label || field.name;
col.idlFieldDef = field;
if (!this.persistKey) {
throw new Error('Grid persistKey required to save columns');
}
- const compiled: EgGridColumnPersistConf[] =
+ const compiled: GridColumnPersistConf[] =
this.columnSet.compileSaveObject();
return this.store.setItem('eg.grid.' + this.persistKey, compiled);
}
// TODO: saveColumnsAsOrgSetting(...)
- getColumnsConfig(persistKey: string): Promise<EgGridColumnPersistConf[]> {
+ getColumnsConfig(persistKey: string): Promise<GridColumnPersistConf[]> {
if (!persistKey) { return Promise.resolve([]); }
return this.store.getItem('eg.grid.' + persistKey);
}
}
-export class EgGridColumnPersistConf {
+export class GridColumnPersistConf {
name: string;
flex?: number;
sort?: number;
// Actions apply to specific rows
-export class EgGridToolbarAction {
+export class GridToolbarAction {
label: string;
action: (rows: any[]) => any;
}
// Buttons are global actions
-export class EgGridToolbarButton {
+export class GridToolbarButton {
label: string;
action: () => any;
}
-export class EgGridDataSource {
+export class GridDataSource {
data: any[];
sort: any[];
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';
-import {EgOrgService} from '@eg/core/org.service';
-import {EgIdlObject} from '@eg/core/idl.service';
+import {AuthService} from '@eg/core/auth.service';
+import {StoreService} from '@eg/core/store.service';
+import {OrgService} from '@eg/core/org.service';
+import {IdlObject} from '@eg/core/idl.service';
import {NgbTypeahead, NgbTypeaheadSelectItemEvent} from '@ng-bootstrap/ng-bootstrap';
// Use a unicode char for spacing instead of ASCII=32 so the browser
selector: 'eg-org-select',
templateUrl: './org-select.component.html'
})
-export class EgOrgSelectComponent implements OnInit {
+export class OrgSelectComponent implements OnInit {
selected: OrgDisplay;
hidden: number[] = [];
disabled: number[] = [];
click$ = new Subject<string>();
- startOrg: EgIdlObject;
+ startOrg: IdlObject;
@ViewChild('instance') instance: NgbTypeahead;
// Apply an org unit value at load time.
// This will NOT result in an onChange event.
- @Input() set initialOrg(org: EgIdlObject) {
+ @Input() set initialOrg(org: IdlObject) {
if (org) { this.startOrg = org; }
}
// Modify the selected org unit via data binding.
// This WILL result in an onChange event firing.
- @Input() set applyOrg(org: EgIdlObject) {
+ @Input() set applyOrg(org: IdlObject) {
if (org) {
this.selected = this.formatForDisplay(org);
}
// Emitted when the org unit value is changed via the selector.
// Does not fire on initialOrg
- @Output() onChange = new EventEmitter<EgIdlObject>();
+ @Output() onChange = new EventEmitter<IdlObject>();
constructor(
- private auth: EgAuthService,
- private store: EgStoreService,
- private org: EgOrgService
+ private auth: AuthService,
+ private store: StoreService,
+ private org: OrgService
) {}
ngOnInit() {
}
// Format for display in the selector drop-down and input.
- formatForDisplay(org: EgIdlObject): OrgDisplay {
+ formatForDisplay(org: IdlObject): OrgDisplay {
return {
id : org.id(),
label : PAD_SPACE.repeat(org.ou_type().depth())
import {Component, OnInit, TemplateRef, ElementRef} from '@angular/core';
-import {EgPrintService, EgPrintRequest} from './print.service';
+import {PrintService, PrintRequest} from './print.service';
@Component({
selector: 'eg-print',
templateUrl: './print.component.html'
})
-export class EgPrintComponent implements OnInit {
+export class PrintComponent implements OnInit {
template: TemplateRef<any>;
context: any;
constructor(
private elm: ElementRef,
- private printer: EgPrintService
+ private printer: PrintService
) {}
ngOnInit() {
printReq => this.handlePrintRequest(printReq));
}
- handlePrintRequest(printReq: EgPrintRequest) {
+ handlePrintRequest(printReq: PrintRequest) {
this.template = printReq.template;
this.context = printReq.contextData;
import {Injectable, EventEmitter, TemplateRef} from '@angular/core';
-export interface EgPrintRequest {
+export interface PrintRequest {
template: TemplateRef<any>;
contextData: any;
printContext: string;
}
@Injectable()
-export class EgPrintService {
+export class PrintService {
- onPrintRequest$: EventEmitter<EgPrintRequest>;
+ onPrintRequest$: EventEmitter<PrintRequest>;
constructor() {
- this.onPrintRequest$ = new EventEmitter<EgPrintRequest>();
+ this.onPrintRequest$ = new EventEmitter<PrintRequest>();
}
- print(printReq: EgPrintRequest) {
+ print(printReq: PrintRequest) {
this.onPrintRequest$.emit(printReq);
}
}
/*j
* <eg-string #helloStr text="Hello, {{name}}" i18n-text></eg-string>
*
- * import {EgStringComponent} from '@eg/share/string.component';
- * @ViewChild('helloStr') private helloStr: EgStringComponent;
+ * import {StringComponent} from '@eg/share/string.component';
+ * @ViewChild('helloStr') private helloStr: StringComponent;
* ...
* this.helloStr.currrent().then(s => console.log(s));
*
*/
import {Component, Input, OnInit, ElementRef, TemplateRef} from '@angular/core';
-import {EgStringService} from '@eg/share/string/string.service';
+import {StringService} from '@eg/share/string/string.service';
@Component({
selector: 'eg-string',
`
})
-export class EgStringComponent implements OnInit {
+export class StringComponent implements OnInit {
@Input() key: string;
@Input() ctx: any;
@Input() template: TemplateRef<any>;
- constructor(private elm: ElementRef, private strings: EgStringService) {
+ constructor(private elm: ElementRef, private strings: StringService) {
this.elm = elm;
this.strings = strings;
}
// Apply the new context if provided, give our container a
// chance to update, then resolve with the current string.
// NOTE: talking to the native DOM element is not so great, but
- // hopefully we can retire the EgString* code entirely once
+ // hopefully we can retire the String* code entirely once
// in-code translations are supported (Ang6?)
current(ctx?: any): Promise<string> {
if (ctx) { this.ctx = ctx; }
import {Injectable} from '@angular/core';
-interface EgStringAssignment {
+interface StringAssignment {
key: string; // keyboard command
resolver: (ctx: any) => Promise<string>;
}
@Injectable()
-export class EgStringService {
+export class StringService {
- strings: {[key: string]: EgStringAssignment} = {};
+ strings: {[key: string]: StringAssignment} = {};
constructor() {}
- register(assn: EgStringAssignment) {
+ register(assn: StringAssignment) {
this.strings[assn.key] = assn;
}
import {Component, Input, OnInit, ViewChild} from '@angular/core';
-import {EgToastService, EgToastMessage} from '@eg/share/toast/toast.service';
+import {ToastService, ToastMessage} from '@eg/share/toast/toast.service';
const EG_TOAST_TIMEOUT = 3000;
templateUrl: './toast.component.html',
styleUrls: ['./toast.component.css']
})
-export class EgToastComponent implements OnInit {
+export class ToastComponent implements OnInit {
- message: EgToastMessage;
+ message: ToastMessage;
// track the most recent timeout event
timeout: any;
- constructor(private toast: EgToastService) {
+ constructor(private toast: ToastService) {
}
ngOnInit() {
this.toast.messages$.subscribe(msg => this.show(msg));
}
- show(msg: EgToastMessage) {
+ show(msg: ToastMessage) {
this.dismiss(this.message);
this.message = msg;
this.timeout = setTimeout(
);
}
- dismiss(msg: EgToastMessage) {
+ dismiss(msg: ToastMessage) {
this.message = null;
if (this.timeout) {
clearTimeout(this.timeout);
import {Injectable, EventEmitter} from '@angular/core';
-export interface EgToastMessage {
+export interface ToastMessage {
text: string;
style: string;
}
@Injectable()
-export class EgToastService {
+export class ToastService {
- messages$: EventEmitter<EgToastMessage>;
+ messages$: EventEmitter<ToastMessage>;
constructor() {
- this.messages$ = new EventEmitter<EgToastMessage>();
+ this.messages$ = new EventEmitter<ToastMessage>();
}
- sendMessage(msg: EgToastMessage) {
+ sendMessage(msg: ToastMessage) {
this.messages$.emit(msg);
}
* workstation settings.
*/
import {Injectable, EventEmitter} from '@angular/core';
-import {EgStoreService} from '@eg/core/store.service';
+import {StoreService} from '@eg/core/store.service';
const AUDIO_BASE_URL = '/audio/notifications/';
@Injectable()
-export class EgAudioService {
+export class AudioService {
// map of requested audio path to resolved path
private urlCache: {[path: string]: string} = {};
- constructor(private store: EgStoreService) {}
+ constructor(private store: StoreService) {}
play(path: string): void {
if (path) {
import {Injectable} from '@angular/core';
import {DatePipe, CurrencyPipe} from '@angular/common';
-import {EgIdlService, EgIdlObject} from '@eg/core/idl.service';
-import {EgOrgService} from '@eg/core/org.service';
+import {IdlService, IdlObject} from '@eg/core/idl.service';
+import {OrgService} from '@eg/core/org.service';
/**
* Format IDL vield values for display.
declare var OpenSRF;
-export interface EgFormatParams {
+export interface FormatParams {
value: any;
idlClass?: string;
idlField?: string;
}
@Injectable()
-export class EgFormatService {
+export class FormatService {
dateFormat = 'shortDate';
dateTimeFormat = 'short';
constructor(
private datePipe: DatePipe,
private currencyPipe: CurrencyPipe,
- private idl: EgIdlService,
- private org: EgOrgService
+ private idl: IdlService,
+ private org: OrgService
) {}
/**
* Create a human-friendly display version of any field type.
*/
- transform(params: EgFormatParams): string {
+ transform(params: FormatParams): string {
const value = params.value;
if ( value === undefined
import {Component, OnInit} from '@angular/core';
import {ActivatedRoute} from '@angular/router';
-import {EgIdlService} from '@eg/core/idl.service';
+import {IdlService} from '@eg/core/idl.service';
/**
* Generic IDL class editor page.
`
})
-export class EgBasicAdminPageComponent implements OnInit {
+export class BasicAdminPageComponent implements OnInit {
idlClass: string;
classLabel: string;
constructor(
private route: ActivatedRoute,
- private idl: EgIdlService
+ private idl: IdlService
) {
}
import {NgModule} from '@angular/core';
-import {EgStaffCommonModule} from '@eg/staff/common.module';
-import {EgLinkTableComponent, EgLinkTableLinkComponent} from '@eg/staff/share/link-table/link-table.component';
-import {EgGridModule} from '@eg/share/grid/grid.module';
-import {EgAdminPageComponent} from '@eg/staff/share/admin-page/admin-page.component';
-import {EgBasicAdminPageComponent} from '@eg/staff/admin/basic-admin-page.component';
+import {StaffCommonModule} from '@eg/staff/common.module';
+import {LinkTableComponent, LinkTableLinkComponent} from '@eg/staff/share/link-table/link-table.component';
+import {GridModule} from '@eg/share/grid/grid.module';
+import {AdminPageComponent} from '@eg/staff/share/admin-page/admin-page.component';
+import {BasicAdminPageComponent} from '@eg/staff/admin/basic-admin-page.component';
@NgModule({
declarations: [
- EgLinkTableComponent,
- EgLinkTableLinkComponent,
- EgAdminPageComponent,
- EgBasicAdminPageComponent
+ LinkTableComponent,
+ LinkTableLinkComponent,
+ AdminPageComponent,
+ BasicAdminPageComponent
],
imports: [
- EgStaffCommonModule,
- EgGridModule
+ StaffCommonModule,
+ GridModule
],
exports: [
- EgStaffCommonModule,
- EgLinkTableComponent,
- EgLinkTableLinkComponent,
- EgAdminPageComponent,
- EgBasicAdminPageComponent,
- EgGridModule
+ StaffCommonModule,
+ LinkTableComponent,
+ LinkTableLinkComponent,
+ AdminPageComponent,
+ BasicAdminPageComponent,
+ GridModule
],
providers: [
]
})
-export class EgAdminCommonModule {
+export class AdminCommonModule {
}
path: '',
children : [
{ path: 'workstation',
- loadChildren: '@eg/staff/admin/workstation/routing.module#EgAdminWsRoutingModule'
+ loadChildren: '@eg/staff/admin/workstation/routing.module#AdminWsRoutingModule'
}, {
path: 'server',
- loadChildren: '@eg/staff/admin/server/admin-server.module#EgAdminServerModule'
+ loadChildren: '@eg/staff/admin/server/admin-server.module#AdminServerModule'
}]
}];
exports: [RouterModule]
})
-export class EgAdminRoutingModule {}
+export class AdminRoutingModule {}
import {NgModule} from '@angular/core';
-import {EgStaffCommonModule} from '@eg/staff/common.module';
-import {EgAdminServerRoutingModule} from './routing.module';
-import {EgAdminCommonModule} from '@eg/staff/admin/common.module';
+import {StaffCommonModule} from '@eg/staff/common.module';
+import {AdminServerRoutingModule} from './routing.module';
+import {AdminCommonModule} from '@eg/staff/admin/common.module';
import {AdminServerSplashComponent} from './admin-server-splash.component';
@NgModule({
AdminServerSplashComponent
],
imports: [
- EgAdminCommonModule,
- EgAdminServerRoutingModule
+ AdminCommonModule,
+ AdminServerRoutingModule
],
exports: [
],
]
})
-export class EgAdminServerModule {
+export class AdminServerModule {
}
import {NgModule} from '@angular/core';
import {RouterModule, Routes} from '@angular/router';
import {AdminServerSplashComponent} from './admin-server-splash.component';
-import {EgBasicAdminPageComponent} from '@eg/staff/admin/basic-admin-page.component';
+import {BasicAdminPageComponent} from '@eg/staff/admin/basic-admin-page.component';
const routes: Routes = [{
path: 'splash',
component: AdminServerSplashComponent
}, {
path: ':schema/:table',
- component: EgBasicAdminPageComponent
+ component: BasicAdminPageComponent
}];
@NgModule({
exports: [RouterModule]
})
-export class EgAdminServerRoutingModule {}
+export class AdminServerRoutingModule {}
exports: [RouterModule]
})
-export class EgAdminWsRoutingModule {}
+export class AdminWsRoutingModule {}
import {Component, OnInit, ViewChild} from '@angular/core';
import {Router, ActivatedRoute} from '@angular/router';
-import {EgStoreService} from '@eg/core/store.service';
-import {EgIdlObject} from '@eg/core/idl.service';
-import {EgNetService} from '@eg/core/net.service';
-import {EgPermService} from '@eg/core/perm.service';
-import {EgAuthService} from '@eg/core/auth.service';
-import {EgOrgService} from '@eg/core/org.service';
-import {EgEventService} from '@eg/core/event.service';
-import {EgConfirmDialogComponent} from '@eg/share/dialog/confirm.component';
+import {StoreService} from '@eg/core/store.service';
+import {IdlObject} from '@eg/core/idl.service';
+import {NetService} from '@eg/core/net.service';
+import {PermService} from '@eg/core/perm.service';
+import {AuthService} from '@eg/core/auth.service';
+import {OrgService} from '@eg/core/org.service';
+import {EventService} from '@eg/core/event.service';
+import {ConfirmDialogComponent} from '@eg/share/dialog/confirm.component';
// Slim version of the WS that's stored in the cache.
interface Workstation {
selectedName: string;
workstations: Workstation[] = [];
removeWorkstation: string;
- newOwner: EgIdlObject;
+ newOwner: IdlObject;
newName: string;
defaultName: string;
@ViewChild('workstationExistsDialog')
- private wsExistsDialog: EgConfirmDialogComponent;
+ private wsExistsDialog: ConfirmDialogComponent;
// Org selector options.
hideOrgs: number[];
disableOrgs: number[];
- orgOnChange = (org: EgIdlObject): void => {
+ orgOnChange = (org: IdlObject): void => {
this.newOwner = org;
}
constructor(
private router: Router,
private route: ActivatedRoute,
- private evt: EgEventService,
- private net: EgNetService,
- private store: EgStoreService,
- private auth: EgAuthService,
- private org: EgOrgService,
- private perm: EgPermService
+ private evt: EventService,
+ private net: NetService,
+ private store: StoreService,
+ private auth: AuthService,
+ private org: OrgService,
+ private perm: PermService
) {}
ngOnInit() {
import {NgModule} from '@angular/core';
-import {EgStaffCommonModule} from '@eg/staff/common.module';
+import {StaffCommonModule} from '@eg/staff/common.module';
import {WorkstationsRoutingModule} from './routing.module';
import {WorkstationsComponent} from './workstations.component';
WorkstationsComponent,
],
imports: [
- EgStaffCommonModule,
+ StaffCommonModule,
WorkstationsRoutingModule
]
})
@Component({
templateUrl: 'catalog.component.html'
})
-export class EgCatalogComponent implements OnInit {
+export class CatalogComponent implements OnInit {
constructor(private staffCat: StaffCatalogService) {}
import {NgModule} from '@angular/core';
-import {EgStaffCommonModule} from '@eg/staff/common.module';
-import {EgUnapiService} from '@eg/share/catalog/unapi.service';
-import {EgCatalogRoutingModule} from './routing.module';
-import {EgCatalogService} from '@eg/share/catalog/catalog.service';
-import {EgCatalogUrlService} from '@eg/share/catalog/catalog-url.service';
-import {EgCatalogComponent} from './catalog.component';
+import {StaffCommonModule} from '@eg/staff/common.module';
+import {UnapiService} from '@eg/share/catalog/unapi.service';
+import {CatalogRoutingModule} from './routing.module';
+import {CatalogService} from '@eg/share/catalog/catalog.service';
+import {CatalogUrlService} from '@eg/share/catalog/catalog-url.service';
+import {CatalogComponent} from './catalog.component';
import {SearchFormComponent} from './search-form.component';
import {ResultsComponent} from './result/results.component';
import {RecordComponent} from './record/record.component';
import {CopiesComponent} from './record/copies.component';
-import {EgBibSummaryComponent} from '@eg/staff/share/bib-summary/bib-summary.component';
+import {BibSummaryComponent} from '@eg/staff/share/bib-summary/bib-summary.component';
import {ResultPaginationComponent} from './result/pagination.component';
import {ResultFacetsComponent} from './result/facets.component';
import {ResultRecordComponent} from './result/record.component';
@NgModule({
declarations: [
- EgCatalogComponent,
+ CatalogComponent,
ResultsComponent,
RecordComponent,
CopiesComponent,
- EgBibSummaryComponent,
+ BibSummaryComponent,
SearchFormComponent,
ResultRecordComponent,
ResultFacetsComponent,
MarcViewComponent
],
imports: [
- EgStaffCommonModule,
- EgCatalogRoutingModule
+ StaffCommonModule,
+ CatalogRoutingModule
],
providers: [
- EgUnapiService,
- EgCatalogService,
- EgCatalogUrlService,
+ UnapiService,
+ CatalogService,
+ CatalogUrlService,
StaffCatalogService
]
})
-export class EgCatalogModule {
+export class CatalogModule {
}
import {Injectable} from '@angular/core';
import {Router, ActivatedRoute} from '@angular/router';
-import {EgIdlObject} from '@eg/core/idl.service';
-import {EgOrgService} from '@eg/core/org.service';
-import {EgCatalogService} from '@eg/share/catalog/catalog.service';
-import {EgCatalogUrlService} from '@eg/share/catalog/catalog-url.service';
+import {IdlObject} from '@eg/core/idl.service';
+import {OrgService} from '@eg/core/org.service';
+import {CatalogService} from '@eg/share/catalog/catalog.service';
+import {CatalogUrlService} from '@eg/share/catalog/catalog-url.service';
import {CatalogSearchContext} from '@eg/share/catalog/search-context';
/**
searchContext: CatalogSearchContext;
routeIndex = 0;
- defaultSearchOrg: EgIdlObject;
+ defaultSearchOrg: IdlObject;
defaultSearchLimit: number;
// TODO: does unapi support pref-lib for result-page copy counts?
- prefOrg: EgIdlObject;
+ prefOrg: IdlObject;
// Cache the currently selected detail record (i.g. catalog/record/123)
// summary so the record detail component can avoid duplicate fetches
constructor(
private router: Router,
private route: ActivatedRoute,
- private org: EgOrgService,
- private cat: EgCatalogService,
- private catUrl: EgCatalogUrlService
+ private org: OrgService,
+ private cat: CatalogService,
+ private catUrl: CatalogUrlService
) { }
createContext(): void {
import {Component, OnInit, Input} from '@angular/core';
-import {EgNetService} from '@eg/core/net.service';
+import {NetService} from '@eg/core/net.service';
import {StaffCatalogService} from '../catalog.service';
import {Pager} from '@eg/share/util/pager';
-import {EgOrgService} from '@eg/core/org.service';
+import {OrgService} from '@eg/core/org.service';
@Component({
selector: 'eg-catalog-copies',
}
constructor(
- private net: EgNetService,
- private org: EgOrgService,
+ private net: NetService,
+ private org: OrgService,
private staffCat: StaffCatalogService,
) {}
import {Component, OnInit, Input, ElementRef} from '@angular/core';
-import {EgNetService} from '@eg/core/net.service';
+import {NetService} from '@eg/core/net.service';
import {StaffCatalogService} from '../catalog.service';
-import {EgOrgService} from '@eg/core/org.service';
+import {OrgService} from '@eg/core/org.service';
@Component({
selector: 'eg-catalog-marc-view',
constructor(
private elm: ElementRef,
- private net: EgNetService,
+ private net: NetService,
private staffCat: StaffCatalogService
) {}
// Note: for printing, use the browser print page
// option. The end result is the same.
html = html.replace(
- /<button onclick="window.print(.*?)<\/button>/,'');
- html = html.replace(/<title>(.*?)<\/title>/,'');
+ /<button onclick="window.print(.*?)<\/button>/, '');
+ html = html.replace(/<title>(.*?)<\/title>/, '');
// remove reference to nonexistant CSS file
- html = html.replace(/<link(.*?)\/>/,'');
+ html = html.replace(/<link(.*?)\/>/, '');
this.elm.nativeElement.innerHTML = html;
});
}
import {Component, OnInit, Input} from '@angular/core';
import {Router} from '@angular/router';
-import {EgCatalogService} from '@eg/share/catalog/catalog.service';
+import {CatalogService} from '@eg/share/catalog/catalog.service';
import {CatalogSearchContext} from '@eg/share/catalog/search-context';
-import {EgCatalogUrlService} from '@eg/share/catalog/catalog-url.service';
+import {CatalogUrlService} from '@eg/share/catalog/catalog-url.service';
import {StaffCatalogService} from '../catalog.service';
import {Pager} from '@eg/share/util/pager';
constructor(
private router: Router,
- private cat: EgCatalogService,
- private catUrl: EgCatalogUrlService,
+ private cat: CatalogService,
+ private catUrl: CatalogUrlService,
private staffCat: StaffCatalogService,
) {}
import {Component, OnInit, Input, ViewChild} from '@angular/core';
import {NgbTabset, NgbTabChangeEvent} from '@ng-bootstrap/ng-bootstrap';
import {Router, ActivatedRoute, ParamMap} from '@angular/router';
-import {EgPcrudService} from '@eg/core/pcrud.service';
-import {EgIdlObject} from '@eg/core/idl.service';
+import {PcrudService} from '@eg/core/pcrud.service';
+import {IdlObject} from '@eg/core/idl.service';
import {CatalogSearchContext, CatalogSearchState} from '@eg/share/catalog/search-context';
-import {EgCatalogService} from '@eg/share/catalog/catalog.service';
+import {CatalogService} from '@eg/share/catalog/catalog.service';
import {StaffCatalogService} from '../catalog.service';
-import {EgBibSummaryComponent} from '@eg/staff/share/bib-summary/bib-summary.component';
+import {BibSummaryComponent} from '@eg/staff/share/bib-summary/bib-summary.component';
@Component({
selector: 'eg-catalog-record',
constructor(
private router: Router,
private route: ActivatedRoute,
- private pcrud: EgPcrudService,
- private cat: EgCatalogService,
+ private pcrud: PcrudService,
+ private cat: CatalogService,
private staffCat: StaffCatalogService
) {}
}
// Retain search parameters
- this.router.navigate([url], {queryParamsHandling: "merge"});
+ this.router.navigate([url], {queryParamsHandling: 'merge'});
}
loadRecord(): void {
this.searchContext.searchOrg.id(),
this.searchContext.searchOrg.ou_type().depth()
).then(summary => {
- this.bibSummary =
+ this.bibSummary =
this.staffCat.currentDetailRecordSummary = summary;
this.pcrud.search('au', {id: [summary.creator, summary.editor]})
.subscribe(user => {
import {Observer} from 'rxjs/Observer';
import {Router, Resolve, RouterStateSnapshot,
ActivatedRouteSnapshot} from '@angular/router';
-import {EgStoreService} from '@eg/core/store.service';
-import {EgNetService} from '@eg/core/net.service';
-import {EgOrgService} from '@eg/core/org.service';
-import {EgAuthService} from '@eg/core/auth.service';
-import {EgPcrudService} from '@eg/core/pcrud.service';
-import {EgCatalogService} from '@eg/share/catalog/catalog.service';
+import {StoreService} from '@eg/core/store.service';
+import {NetService} from '@eg/core/net.service';
+import {OrgService} from '@eg/core/org.service';
+import {AuthService} from '@eg/core/auth.service';
+import {PcrudService} from '@eg/core/pcrud.service';
+import {CatalogService} from '@eg/share/catalog/catalog.service';
import {StaffCatalogService} from './catalog.service';
@Injectable()
-export class EgCatalogResolver implements Resolve<Promise<any[]>> {
+export class CatalogResolver implements Resolve<Promise<any[]>> {
constructor(
private router: Router,
- private store: EgStoreService,
- private org: EgOrgService,
- private net: EgNetService,
- private auth: EgAuthService,
- private cat: EgCatalogService,
+ private store: StoreService,
+ private org: OrgService,
+ private net: NetService,
+ private auth: AuthService,
+ private cat: CatalogService,
private staffCat: StaffCatalogService
) {}
route: ActivatedRouteSnapshot,
state: RouterStateSnapshot): Promise<any[]> {
- console.debug('EgCatalogResolver:resolve()');
+ console.debug('CatalogResolver:resolve()');
return Promise.all([
this.cat.fetchCcvms(),
import {Component, OnInit, Input} from '@angular/core';
-import {EgCatalogService} from '@eg/share/catalog/catalog.service';
+import {CatalogService} from '@eg/share/catalog/catalog.service';
import {CatalogSearchContext, FacetFilter} from '@eg/share/catalog/search-context';
import {StaffCatalogService} from '../catalog.service';
facetConfig: any;
constructor(
- private cat: EgCatalogService,
+ private cat: CatalogService,
private staffCat: StaffCatalogService
) {
this.facetConfig = FACET_CONFIG;
import {Component, OnInit, Input} from '@angular/core';
-import {EgCatalogService} from '@eg/share/catalog/catalog.service';
+import {CatalogService} from '@eg/share/catalog/catalog.service';
import {CatalogSearchContext} from '@eg/share/catalog/search-context';
import {StaffCatalogService} from '../catalog.service';
searchContext: CatalogSearchContext;
constructor(
- private cat: EgCatalogService,
+ private cat: CatalogService,
private staffCat: StaffCatalogService
) {}
import {Component, OnInit, Input} from '@angular/core';
import {Router} from '@angular/router';
-import {EgOrgService} from '@eg/core/org.service';
-import {EgNetService} from '@eg/core/net.service';
-import {EgCatalogService} from '@eg/share/catalog/catalog.service';
+import {OrgService} from '@eg/core/org.service';
+import {NetService} from '@eg/core/net.service';
+import {CatalogService} from '@eg/share/catalog/catalog.service';
import {CatalogSearchContext} from '@eg/share/catalog/search-context';
-import {EgCatalogUrlService} from '@eg/share/catalog/catalog-url.service';
+import {CatalogUrlService} from '@eg/share/catalog/catalog-url.service';
import {StaffCatalogService} from '../catalog.service';
@Component({
constructor(
private router: Router,
- private org: EgOrgService,
- private net: EgNetService,
- private cat: EgCatalogService,
- private catUrl: EgCatalogUrlService,
+ private org: OrgService,
+ private net: NetService,
+ private cat: CatalogService,
+ private catUrl: CatalogUrlService,
private staffCat: StaffCatalogService
) {}
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 {EgCatalogUrlService} from '@eg/share/catalog/catalog-url.service';
+import {CatalogService} from '@eg/share/catalog/catalog.service';
+import {CatalogUrlService} from '@eg/share/catalog/catalog-url.service';
import {CatalogSearchContext, CatalogSearchState} from '@eg/share/catalog/search-context';
-import {EgPcrudService} from '@eg/core/pcrud.service';
+import {PcrudService} from '@eg/core/pcrud.service';
import {StaffCatalogService} from '../catalog.service';
-import {EgIdlObject} from '@eg/core/idl.service';
+import {IdlObject} from '@eg/core/idl.service';
@Component({
selector: 'eg-catalog-results',
// 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]: IdlObject} = {};
constructor(
private route: ActivatedRoute,
- private pcrud: EgPcrudService,
- private cat: EgCatalogService,
- private catUrl: EgCatalogUrlService,
+ private pcrud: PcrudService,
+ private cat: CatalogService,
+ private catUrl: CatalogUrlService,
private staffCat: StaffCatalogService
) {}
import {NgModule} from '@angular/core';
import {RouterModule, Routes} from '@angular/router';
-import {EgCatalogComponent} from './catalog.component';
+import {CatalogComponent} from './catalog.component';
import {ResultsComponent} from './result/results.component';
import {RecordComponent} from './record/record.component';
-import {EgCatalogResolver} from './resolver.service';
+import {CatalogResolver} from './resolver.service';
const routes: Routes = [{
path: '',
- component: EgCatalogComponent,
- resolve: {catResolver : EgCatalogResolver},
+ component: CatalogComponent,
+ resolve: {catResolver : CatalogResolver},
children : [{
path: 'search',
component: ResultsComponent
@NgModule({
imports: [RouterModule.forChild(routes)],
exports: [RouterModule],
- providers: [EgCatalogResolver]
+ providers: [CatalogResolver]
})
-export class EgCatalogRoutingModule {}
+export class CatalogRoutingModule {}
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 {IdlObject} from '@eg/core/idl.service';
+import {OrgService} from '@eg/core/org.service';
+import {CatalogService} from '@eg/share/catalog/catalog.service';
import {CatalogSearchContext, CatalogSearchState} from '@eg/share/catalog/search-context';
import {StaffCatalogService} from './catalog.service';
export class SearchFormComponent implements OnInit, AfterViewInit {
searchContext: CatalogSearchContext;
- ccvmMap: {[ccvm: string]: EgIdlObject[]} = {};
- cmfMap: {[cmf: string]: EgIdlObject} = {};
+ ccvmMap: {[ccvm: string]: IdlObject[]} = {};
+ cmfMap: {[cmf: string]: IdlObject} = {};
showAdvancedSearch = false;
constructor(
private renderer: Renderer2,
- private org: EgOrgService,
- private cat: EgCatalogService,
+ private org: OrgService,
+ private cat: CatalogService,
private staffCat: StaffCatalogService
) {}
return show;
}
- orgOnChange = (org: EgIdlObject): void => {
+ orgOnChange = (org: IdlObject): void => {
this.searchContext.searchOrg = org;
}
import {Component, OnInit, Renderer2} from '@angular/core';
import {ActivatedRoute} from '@angular/router';
-import {EgNetService} from '@eg/core/net.service';
-import {EgAuthService} from '@eg/core/auth.service';
+import {NetService} from '@eg/core/net.service';
+import {AuthService} from '@eg/core/auth.service';
@Component({
templateUrl: 'bcsearch.component.html'
})
-export class EgBcSearchComponent implements OnInit {
+export class BcSearchComponent implements OnInit {
barcode = '';
constructor(
private route: ActivatedRoute,
private renderer: Renderer2,
- private net: EgNetService,
- private auth: EgAuthService
+ private net: NetService,
+ private auth: AuthService
) {}
ngOnInit() {
import {NgModule} from '@angular/core';
-import {EgStaffCommonModule} from '@eg/staff/common.module';
-import {EgBcSearchRoutingModule} from './routing.module';
-import {EgBcSearchComponent} from './bcsearch.component';
+import {StaffCommonModule} from '@eg/staff/common.module';
+import {BcSearchRoutingModule} from './routing.module';
+import {BcSearchComponent} from './bcsearch.component';
@NgModule({
declarations: [
- EgBcSearchComponent
+ BcSearchComponent
],
imports: [
- EgStaffCommonModule,
- EgBcSearchRoutingModule,
+ StaffCommonModule,
+ BcSearchRoutingModule,
],
})
-export class EgBcSearchModule {}
+export class BcSearchModule {}
import {NgModule} from '@angular/core';
import {RouterModule, Routes} from '@angular/router';
-import {EgBcSearchComponent} from './bcsearch.component';
+import {BcSearchComponent} from './bcsearch.component';
const routes: Routes = [
{ path: '',
- component: EgBcSearchComponent
+ component: BcSearchComponent
},
{ path: ':barcode',
- component: EgBcSearchComponent
+ component: BcSearchComponent
},
];
exports: [RouterModule]
})
-export class EgBcSearchRoutingModule {}
+export class BcSearchRoutingModule {}
const routes: Routes = [
{ path: 'bcsearch',
- loadChildren: '@eg/staff/circ/patron/bcsearch/bcsearch.module#EgBcSearchModule'
+ loadChildren: '@eg/staff/circ/patron/bcsearch/bcsearch.module#BcSearchModule'
}
];
exports: [RouterModule]
})
-export class EgCircPatronRoutingModule {}
+export class CircPatronRoutingModule {}
const routes: Routes = [
{ path: 'patron',
- loadChildren: '@eg/staff/circ/patron/routing.module#EgCircPatronRoutingModule'
+ loadChildren: '@eg/staff/circ/patron/routing.module#CircPatronRoutingModule'
}
];
exports: [RouterModule]
})
-export class EgCircRoutingModule {}
+export class CircRoutingModule {}
import {NgModule, ModuleWithProviders} from '@angular/core';
import {EgCommonModule} from '@eg/common.module';
-import {EgStaffBannerComponent} from './share/staff-banner.component';
-import {EgOrgSelectComponent} from '@eg/share/org-select/org-select.component';
-import {EgDialogComponent} from '@eg/share/dialog/dialog.component';
-import {EgConfirmDialogComponent} from '@eg/share/dialog/confirm.component';
-import {EgPromptDialogComponent} from '@eg/share/dialog/prompt.component';
-import {EgProgressDialogComponent} from '@eg/share/dialog/progress.component';
-import {EgAccessKeyDirective} from '@eg/share/accesskey/accesskey.directive';
-import {EgAccessKeyService} from '@eg/share/accesskey/accesskey.service';
-import {EgAccessKeyInfoComponent} from '@eg/share/accesskey/accesskey-info.component';
-import {EgOpChangeComponent} from '@eg/staff/share/op-change/op-change.component';
-import {EgToastService} from '@eg/share/toast/toast.service';
-import {EgToastComponent} from '@eg/share/toast/toast.component';
-import {EgStringComponent} from '@eg/share/string/string.component';
-import {EgStringService} from '@eg/share/string/string.service';
+import {StaffBannerComponent} from './share/staff-banner.component';
+import {OrgSelectComponent} from '@eg/share/org-select/org-select.component';
+import {DialogComponent} from '@eg/share/dialog/dialog.component';
+import {ConfirmDialogComponent} from '@eg/share/dialog/confirm.component';
+import {PromptDialogComponent} from '@eg/share/dialog/prompt.component';
+import {ProgressDialogComponent} from '@eg/share/dialog/progress.component';
+import {AccessKeyDirective} from '@eg/share/accesskey/accesskey.directive';
+import {AccessKeyService} from '@eg/share/accesskey/accesskey.service';
+import {AccessKeyInfoComponent} from '@eg/share/accesskey/accesskey-info.component';
+import {OpChangeComponent} from '@eg/staff/share/op-change/op-change.component';
+import {ToastService} from '@eg/share/toast/toast.service';
+import {ToastComponent} from '@eg/share/toast/toast.component';
+import {StringComponent} from '@eg/share/string/string.component';
+import {StringService} from '@eg/share/string/string.service';
import {FmRecordEditorComponent} from '@eg/share/fm-editor/fm-editor.component';
-import {EgDateSelectComponent} from '@eg/share/date-select/date-select.component';
+import {DateSelectComponent} from '@eg/share/date-select/date-select.component';
/**
* Imports the EG common modules and adds modules common to all staff UI's.
@NgModule({
declarations: [
- EgStaffBannerComponent,
- EgOrgSelectComponent,
- EgDialogComponent,
- EgConfirmDialogComponent,
- EgPromptDialogComponent,
- EgProgressDialogComponent,
- EgAccessKeyDirective,
- EgAccessKeyInfoComponent,
- EgToastComponent,
- EgStringComponent,
- EgOpChangeComponent,
+ StaffBannerComponent,
+ OrgSelectComponent,
+ DialogComponent,
+ ConfirmDialogComponent,
+ PromptDialogComponent,
+ ProgressDialogComponent,
+ AccessKeyDirective,
+ AccessKeyInfoComponent,
+ ToastComponent,
+ StringComponent,
+ OpChangeComponent,
FmRecordEditorComponent,
- EgDateSelectComponent
+ DateSelectComponent
],
imports: [
EgCommonModule
],
exports: [
EgCommonModule,
- EgStaffBannerComponent,
- EgOrgSelectComponent,
- EgDialogComponent,
- EgConfirmDialogComponent,
- EgPromptDialogComponent,
- EgProgressDialogComponent,
- EgAccessKeyDirective,
- EgAccessKeyInfoComponent,
- EgToastComponent,
- EgStringComponent,
- EgOpChangeComponent,
+ StaffBannerComponent,
+ OrgSelectComponent,
+ DialogComponent,
+ ConfirmDialogComponent,
+ PromptDialogComponent,
+ ProgressDialogComponent,
+ AccessKeyDirective,
+ AccessKeyInfoComponent,
+ ToastComponent,
+ StringComponent,
+ OpChangeComponent,
FmRecordEditorComponent,
- EgDateSelectComponent
+ DateSelectComponent
]
})
-export class EgStaffCommonModule {
+export class StaffCommonModule {
static forRoot(): ModuleWithProviders {
return {
- ngModule: EgStaffCommonModule,
+ ngModule: StaffCommonModule,
providers: [ // Export staff-wide services
- EgAccessKeyService,
- EgStringService,
- EgToastService
+ AccessKeyService,
+ StringService,
+ ToastService
]
};
}
import {Component, OnInit, Renderer2} from '@angular/core';
import {Location} from '@angular/common';
import {Router, ActivatedRoute} from '@angular/router';
-import {EgAuthService, EgAuthWsState} from '@eg/core/auth.service';
-import {EgStoreService} from '@eg/core/store.service';
+import {AuthService, AuthWsState} from '@eg/core/auth.service';
+import {StoreService} from '@eg/core/store.service';
@Component({
templateUrl : './login.component.html'
})
-export class EgStaffLoginComponent implements OnInit {
+export class StaffLoginComponent implements OnInit {
workstations: any[];
private route: ActivatedRoute,
private ngLocation: Location,
private renderer: Renderer2,
- private auth: EgAuthService,
- private store: EgStoreService
+ private auth: AuthService,
+ private store: StoreService
) {}
ngOnInit() {
ok => {
this.auth.redirectUrl = null;
- if (this.auth.workstationState === EgAuthWsState.NOT_FOUND_SERVER) {
+ if (this.auth.workstationState === AuthWsState.NOT_FOUND_SERVER) {
// User attempted to login with a workstation that is
// unknown to the server. Redirect to the WS admin page.
this.router.navigate(
import {Component, OnInit, ViewChild} from '@angular/core';
import {ActivatedRoute, Router} from '@angular/router';
-import {EgAuthService} from '@eg/core/auth.service';
+import {AuthService} from '@eg/core/auth.service';
@Component({
selector: 'eg-staff-nav-bar',
templateUrl: 'nav.component.html'
})
-export class EgStaffNavComponent implements OnInit {
+export class StaffNavComponent implements OnInit {
constructor(
private router: Router,
- private auth: EgAuthService
+ private auth: AuthService
) {}
ngOnInit() {
import 'rxjs/add/observable/of'; // Observable.of()
import {Router, Resolve, RouterStateSnapshot,
ActivatedRoute, ActivatedRouteSnapshot} from '@angular/router';
-import {EgStoreService} from '@eg/core/store.service';
-import {EgNetService} from '@eg/core/net.service';
-import {EgAuthService, EgAuthWsState} from '@eg/core/auth.service';
-import {EgPermService} from '@eg/core/perm.service';
-import {EgOrgService} from '@eg/core/org.service';
-import {EgFormatService} from '@eg/share/util/format.service';
+import {StoreService} from '@eg/core/store.service';
+import {NetService} from '@eg/core/net.service';
+import {AuthService, AuthWsState} from '@eg/core/auth.service';
+import {PermService} from '@eg/core/perm.service';
+import {OrgService} from '@eg/core/org.service';
+import {FormatService} from '@eg/share/util/format.service';
const LOGIN_PATH = '/staff/login';
const WS_MANAGE_PATH = '/staff/admin/workstation/workstations/manage';
* Load data used by all staff modules.
*/
@Injectable()
-export class EgStaffResolver implements Resolve<Observable<any>> {
+export class StaffResolver implements Resolve<Observable<any>> {
// Tracks the primary resolve observable.
observer: Observer<any>;
private router: Router,
private route: ActivatedRoute,
private ngLocation: Location,
- private store: EgStoreService,
- private org: EgOrgService,
- private net: EgNetService,
- private auth: EgAuthService,
- private perm: EgPermService,
- private format: EgFormatService
+ private store: StoreService,
+ private org: OrgService,
+ private net: NetService,
+ private auth: AuthService,
+ private perm: PermService,
+ private format: FormatService
) {}
resolve(
// A page that's not the login page was requested without a
// valid auth token. Send the caller back to the login page.
handleInvalidToken(state: RouterStateSnapshot): void {
- console.debug('EgStaffResolver: authtoken is not valid');
+ console.debug('StaffResolver: authtoken is not valid');
this.auth.redirectUrl = state.url;
this.router.navigate([LOGIN_PATH]);
this.observer.error('invalid or no auth token');
import {NgModule} from '@angular/core';
import {RouterModule, Routes} from '@angular/router';
-import {EgStaffResolver} from './resolver.service';
-import {EgStaffComponent} from './staff.component';
-import {EgStaffLoginComponent} from './login.component';
-import {EgStaffSplashComponent} from './splash.component';
+import {StaffResolver} from './resolver.service';
+import {StaffComponent} from './staff.component';
+import {StaffLoginComponent} from './login.component';
+import {StaffSplashComponent} from './splash.component';
// Not using 'canActivate' because it's called before all resolvers,
// even the parent resolver, but the resolvers parse the IDL, load settings,
const routes: Routes = [{
path: '',
- component: EgStaffComponent,
- resolve: {staffResolver : EgStaffResolver},
+ component: StaffComponent,
+ resolve: {staffResolver : StaffResolver},
children: [{
path: '',
redirectTo: 'splash',
pathMatch: 'full',
}, {
path: 'login',
- component: EgStaffLoginComponent
+ component: StaffLoginComponent
}, {
path: 'splash',
- component: EgStaffSplashComponent
+ component: StaffSplashComponent
}, {
path: 'circ',
- loadChildren : '@eg/staff/circ/routing.module#EgCircRoutingModule'
+ loadChildren : '@eg/staff/circ/routing.module#CircRoutingModule'
}, {
path: 'catalog',
- loadChildren : '@eg/staff/catalog/catalog.module#EgCatalogModule'
+ loadChildren : '@eg/staff/catalog/catalog.module#CatalogModule'
}, {
path: 'sandbox',
- loadChildren : '@eg/staff/sandbox/sandbox.module#EgSandboxModule'
+ loadChildren : '@eg/staff/sandbox/sandbox.module#SandboxModule'
}, {
path: 'admin',
- loadChildren : '@eg/staff/admin/routing.module#EgAdminRoutingModule'
+ loadChildren : '@eg/staff/admin/routing.module#AdminRoutingModule'
}]
}];
@NgModule({
imports: [RouterModule.forChild(routes)],
exports: [RouterModule],
- providers: [EgStaffResolver]
+ providers: [StaffResolver]
})
-export class EgStaffRoutingModule {}
+export class StaffRoutingModule {}
import {NgModule} from '@angular/core';
import {RouterModule, Routes} from '@angular/router';
-import {EgSandboxComponent} from './sandbox.component';
+import {SandboxComponent} from './sandbox.component';
const routes: Routes = [{
path: '',
- component: EgSandboxComponent
+ component: SandboxComponent
}];
@NgModule({
providers: []
})
-export class EgSandboxRoutingModule {}
+export class SandboxRoutingModule {}
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 {ProgressDialogComponent} from '@eg/share/dialog/progress.component';
+import {ToastService} from '@eg/share/toast/toast.service';
+import {StringService} from '@eg/share/string/string.service';
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';
+import {GridDataSource} from '@eg/share/grid/grid';
+import {IdlService, IdlObject} from '@eg/core/idl.service';
+import {PcrudService} from '@eg/core/pcrud.service';
import {Pager} from '@eg/share/util/pager';
-import {EgDateSelectComponent} from '@eg/share/date-select/date-select.component';
-import {EgPrintService} from '@eg/share/print/print.service';
+import {DateSelectComponent} from '@eg/share/date-select/date-select.component';
+import {PrintService} from '@eg/share/print/print.service';
@Component({
templateUrl: 'sandbox.component.html'
})
-export class EgSandboxComponent implements OnInit {
+export class SandboxComponent implements OnInit {
@ViewChild('progressDialog')
- private progressDialog: EgProgressDialogComponent;
+ private progressDialog: ProgressDialogComponent;
@ViewChild('dateSelect')
- private dateSelector: EgDateSelectComponent;
+ private dateSelector: DateSelectComponent;
@ViewChild('printTemplate')
private printTemplate: TemplateRef<any>;
- // @ViewChild('helloStr') private helloStr: EgStringComponent;
+ // @ViewChild('helloStr') private helloStr: StringComponent;
- gridDataSource: EgGridDataSource = new EgGridDataSource();
+ gridDataSource: GridDataSource = new GridDataSource();
- btSource: EgGridDataSource = new EgGridDataSource();
+ btSource: GridDataSource = new GridDataSource();
btGridTestContext: any = {hello : 'world'};
testDate: any;
name = 'Jane';
constructor(
- private idl: EgIdlService,
- private pcrud: EgPcrudService,
- private strings: EgStringService,
- private toast: EgToastService,
- private printer: EgPrintService
+ private idl: IdlService,
+ private pcrud: PcrudService,
+ private strings: StringService,
+ private toast: ToastService,
+ private printer: PrintService
) {}
ngOnInit() {
import {NgModule} from '@angular/core';
-import {EgStaffCommonModule} from '@eg/staff/common.module';
-import {EgSandboxRoutingModule} from './routing.module';
-import {EgSandboxComponent} from './sandbox.component';
-import {EgGridModule} from '@eg/share/grid/grid.module';
+import {StaffCommonModule} from '@eg/staff/common.module';
+import {SandboxRoutingModule} from './routing.module';
+import {SandboxComponent} from './sandbox.component';
+import {GridModule} from '@eg/share/grid/grid.module';
@NgModule({
declarations: [
- EgSandboxComponent
+ SandboxComponent
],
imports: [
- EgStaffCommonModule,
- EgSandboxRoutingModule,
- EgGridModule
+ StaffCommonModule,
+ SandboxRoutingModule,
+ GridModule
],
providers: [
]
})
-export class EgSandboxModule {
+export class SandboxModule {
}
import {Component, Input, OnInit, TemplateRef, ViewChild} from '@angular/core';
-import {EgIdlService, EgIdlObject} from '@eg/core/idl.service';
-import {EgGridDataSource} from '@eg/share/grid/grid';
-import {EgGridComponent} from '@eg/share/grid/grid.component';
-import {EgToastService} from '@eg/share/toast/toast.service';
+import {IdlService, IdlObject} from '@eg/core/idl.service';
+import {GridDataSource} from '@eg/share/grid/grid';
+import {GridComponent} from '@eg/share/grid/grid.component';
+import {ToastService} from '@eg/share/toast/toast.service';
import {Pager} from '@eg/share/util/pager';
-import {EgPcrudService} from '@eg/core/pcrud.service';
-import {EgOrgService} from '@eg/core/org.service';
-import {EgAuthService} from '@eg/core/auth.service';
+import {PcrudService} from '@eg/core/pcrud.service';
+import {OrgService} from '@eg/core/org.service';
+import {AuthService} from '@eg/core/auth.service';
import {FmRecordEditorComponent} from '@eg/share/fm-editor/fm-editor.component';
-import {EgStringComponent} from '@eg/share/string/string.component';
+import {StringComponent} from '@eg/share/string/string.component';
/**
* General purpose CRUD interface for IDL objects
templateUrl: './admin-page.component.html'
})
-export class EgAdminPageComponent implements OnInit {
+export class AdminPageComponent implements OnInit {
@Input() idlClass: string;
// complete control over the contents of the grid. If no data source
// is provided, a generic one is create which is sufficient for data
// that requires no special handling, filtering, etc.
- @Input() dataSource: EgGridDataSource;
+ @Input() dataSource: GridDataSource;
// Size of create/edito dialog. Uses large by default.
@Input() dialogSize: 'sm' | 'lg' = 'lg';
// Ditto includeOrgAncestors, but descendants.
@Input() includeOrgDescendants: boolean;
- @ViewChild('grid') grid: EgGridComponent;
+ @ViewChild('grid') grid: GridComponent;
@ViewChild('editDialog') editDialog: FmRecordEditorComponent;
- @ViewChild('successString') successString: EgStringComponent;
- @ViewChild('createString') createString: EgStringComponent;
+ @ViewChild('successString') successString: StringComponent;
+ @ViewChild('createString') createString: StringComponent;
persistKey: string;
idlClassDef: any;
pkeyField: string;
createNew: () => void;
- deleteSelected: (rows: EgIdlObject[]) => void;
+ deleteSelected: (rows: IdlObject[]) => void;
- contextOrg: EgIdlObject;
+ contextOrg: IdlObject;
orgFieldLabel: string;
constructor(
- private idl: EgIdlService,
- private org: EgOrgService,
- private auth: EgAuthService,
- private pcrud: EgPcrudService,
- private toast: EgToastService
+ private idl: IdlService,
+ private org: OrgService,
+ private auth: AuthService,
+ private pcrud: PcrudService,
+ private toast: ToastService
) {}
applyOrgValues() {
}
this.grid.onRowActivate$.subscribe(
- (idlThing: EgIdlObject) => {
+ (idlThing: IdlObject) => {
this.editDialog.mode = 'update';
this.editDialog.recId = idlThing[this.pkeyField]();
this.editDialog.open({size: this.dialogSize}).then(
);
};
- this.deleteSelected = (idlThings: EgIdlObject[]) => {
+ this.deleteSelected = (idlThings: IdlObject[]) => {
idlThings.forEach(idlThing => idlThing.isdeleted(true));
this.pcrud.autoApply(idlThings).subscribe(
val => console.debug('deleted: ' + val),
};
}
- orgOnChange(org: EgIdlObject) {
+ orgOnChange(org: IdlObject) {
this.contextOrg = org;
this.grid.reload();
}
initDataSource() {
- this.dataSource = new EgGridDataSource();
+ this.dataSource = new GridDataSource();
this.dataSource.getRows = (pager: Pager, sort: any[]) => {
const orderBy: any = {};
import {Component, OnInit, Input} from '@angular/core';
-import {EgNetService} from '@eg/core/net.service';
-import {EgPcrudService} from '@eg/core/pcrud.service';
-import {EgCatalogService} from '@eg/share/catalog/catalog.service';
+import {NetService} from '@eg/core/net.service';
+import {PcrudService} from '@eg/core/pcrud.service';
+import {CatalogService} from '@eg/share/catalog/catalog.service';
@Component({
selector: 'eg-bib-summary',
templateUrl: 'bib-summary.component.html',
styles: ['.eg-bib-summary .card-header {padding: .25rem .5rem}']
})
-export class EgBibSummaryComponent implements OnInit {
+export class BibSummaryComponent implements OnInit {
initDone = false;
expandDisplay = true;
}
constructor(
- private cat: EgCatalogService,
- private net: EgNetService,
- private pcrud: EgPcrudService
+ private cat: CatalogService,
+ private net: NetService,
+ private pcrud: PcrudService
) {}
ngOnInit() {
templateUrl: './link-table.component.html'
})
-export class EgLinkTableComponent implements AfterViewInit {
+export class LinkTableComponent implements AfterViewInit {
@Input() columnCount: number;
links: LinkTableLink[];
rowBuckets: any[];
template: '<ng-template></ng-template>'
})
-export class EgLinkTableLinkComponent implements OnInit {
+export class LinkTableLinkComponent implements OnInit {
@Input() label: string;
@Input() url: string;
@Input() routerLink: string;
- constructor(@Host() private linkTable: EgLinkTableComponent) {}
+ constructor(@Host() private linkTable: LinkTableComponent) {}
ngOnInit() {
this.linkTable.links.push({
import {Component, OnInit, Input, Renderer2} from '@angular/core';
-import {EgToastService} from '@eg/share/toast/toast.service';
-import {EgAuthService} from '@eg/core/auth.service';
-import {EgDialogComponent} from '@eg/share/dialog/dialog.component';
+import {ToastService} from '@eg/share/toast/toast.service';
+import {AuthService} from '@eg/core/auth.service';
+import {DialogComponent} from '@eg/share/dialog/dialog.component';
import {NgbModal} from '@ng-bootstrap/ng-bootstrap';
@Component({
templateUrl: 'op-change.component.html'
})
-export class EgOpChangeComponent
- extends EgDialogComponent implements OnInit {
+export class OpChangeComponent
+ extends DialogComponent implements OnInit {
@Input() username: string;
@Input() password: string;
constructor(
private modal: NgbModal, // required for passing to parent
private renderer: Renderer2,
- private toast: EgToastService,
- private auth: EgAuthService) {
+ private toast: ToastService,
+ private auth: AuthService) {
super(modal);
}
'</div>'
})
-export class EgStaffBannerComponent {
+export class StaffBannerComponent {
@Input() public bannerText: string;
}
templateUrl: 'splash.component.html'
})
-export class EgStaffSplashComponent implements OnInit {
+export class StaffSplashComponent implements OnInit {
catSearchQuery: string;
import {Component, OnInit, NgZone, HostListener} from '@angular/core';
import {Router, ActivatedRoute, NavigationEnd} from '@angular/router';
-import {EgAuthService, EgAuthWsState} from '@eg/core/auth.service';
-import {EgNetService} from '@eg/core/net.service';
-import {EgAccessKeyService} from '@eg/share/accesskey/accesskey.service';
-import {EgAccessKeyInfoComponent} from '@eg/share/accesskey/accesskey-info.component';
+import {AuthService, AuthWsState} from '@eg/core/auth.service';
+import {NetService} from '@eg/core/net.service';
+import {AccessKeyService} from '@eg/share/accesskey/accesskey.service';
+import {AccessKeyInfoComponent} from '@eg/share/accesskey/accesskey-info.component';
const LOGIN_PATH = '/staff/login';
const WS_BASE_PATH = '/staff/admin/workstation/workstations/';
styleUrls: ['staff.component.css']
})
-export class EgStaffComponent implements OnInit {
+export class StaffComponent implements OnInit {
constructor(
private router: Router,
private route: ActivatedRoute,
private zone: NgZone,
- private net: EgNetService,
- private auth: EgAuthService,
- private keys: EgAccessKeyService
+ private net: NetService,
+ private auth: AuthService,
+ private keys: AccessKeyService
) {}
ngOnInit() {
// page load.
this.router.events.subscribe(routeEvent => {
if (routeEvent instanceof NavigationEnd) {
- // console.debug(`EgStaffComponent routing to ${routeEvent.url}`);
+ // console.debug(`StaffComponent routing to ${routeEvent.url}`);
this.preventForbiddenNavigation(routeEvent.url);
}
});
});
this.route.data.subscribe((data: {staffResolver: any}) => {
- // Data fetched via EgStaffResolver is available here.
+ // Data fetched via StaffResolver is available here.
});
return;
}
- if (this.auth.workstationState !== EgAuthWsState.VALID) {
+ if (this.auth.workstationState !== AuthWsState.VALID) {
this.router.navigate([WS_MANAGE_PATH]);
}
}
/*
@ViewChild('egAccessKeyInfo')
- private keyComponent: EgAccessKeyInfoComponent;
+ private keyComponent: AccessKeyInfoComponent;
*/
}
import {NgModule} from '@angular/core';
-import {EgStaffCommonModule} from '@eg/staff/common.module';
+import {StaffCommonModule} from '@eg/staff/common.module';
-import {EgStaffComponent} from './staff.component';
-import {EgStaffRoutingModule} from './routing.module';
-import {EgStaffNavComponent} from './nav.component';
-import {EgStaffLoginComponent} from './login.component';
-import {EgStaffSplashComponent} from './splash.component';
+import {StaffComponent} from './staff.component';
+import {StaffRoutingModule} from './routing.module';
+import {StaffNavComponent} from './nav.component';
+import {StaffLoginComponent} from './login.component';
+import {StaffSplashComponent} from './splash.component';
@NgModule({
declarations: [
- EgStaffComponent,
- EgStaffNavComponent,
- EgStaffSplashComponent,
- EgStaffLoginComponent
+ StaffComponent,
+ StaffNavComponent,
+ StaffSplashComponent,
+ StaffLoginComponent
],
imports: [
- EgStaffCommonModule.forRoot(),
- EgStaffRoutingModule
+ StaffCommonModule.forRoot(),
+ StaffRoutingModule
]
})
-export class EgStaffModule {}
+export class StaffModule {}
import { enableProdMode } from '@angular/core';
import { platformBrowserDynamic } from '@angular/platform-browser-dynamic';
-import { EgBaseModule } from './app/app.module';
+import { BaseModule } from './app/app.module';
import { environment } from './environments/environment';
if (environment.production) {
enableProdMode();
}
-platformBrowserDynamic().bootstrapModule(EgBaseModule)
+platformBrowserDynamic().bootstrapModule(BaseModule)
.catch(err => console.log(err));