-
diff --git a/Open-ILS/src/eg2/src/app/staff/app.component.ts b/Open-ILS/src/eg2/src/app/staff/app.component.ts
deleted file mode 100644
index f4bf36fe8d..0000000000
--- a/Open-ILS/src/eg2/src/app/staff/app.component.ts
+++ /dev/null
@@ -1,88 +0,0 @@
-import {Component, OnInit, NgZone} from '@angular/core';
-import {Router, ActivatedRoute, NavigationEnd} from '@angular/router';
-import {EgAuthService, EgAuthWsState} from '@eg/core/auth';
-import {EgNetService} from '@eg/core/net';
-
-@Component({
- templateUrl: 'app.component.html',
- styleUrls: ['app.component.css']
-})
-
-export class EgStaffComponent implements OnInit {
-
- readonly loginPath = '/staff/login';
- readonly wsAdminBasePath = '/staff/admin/workstation/workstations/';
-
- constructor(
- private router: Router,
- private route: ActivatedRoute,
- private zone: NgZone,
- private net: EgNetService,
- private auth: EgAuthService
- ) {}
-
- ngOnInit() {
-
- console.debug('EgStaffComponent:ngOnInit()');
-
- // Fires on all in-app router navigation, but not initial page load.
- this.router.events.subscribe(routeEvent => {
- if (routeEvent instanceof NavigationEnd) {
- //console.debug(`EgStaffComponent routing to ${routeEvent.url}`);
- this.basicAuthChecks(routeEvent.url);
- }
- });
-
- // Redirect to the login page on any auth timeout events.
- this.net.authExpired$.subscribe(expireEvent => {
-
- // If the expired authtoken was identified locally (i.e.
- // in this browser tab) notify all tabs of imminent logout.
- if (!expireEvent.viaExternal) this.auth.broadcastLogout();
-
- console.debug('Auth session has expired. Redirecting to login');
- this.auth.redirectUrl = this.router.url;
-
- // https://github.com/angular/angular/issues/18254
- // When a tab redirects to a login page as a result of
- // another tab broadcasting a logout, ngOnInit() fails to
- // fire in the login component, until the user interacts
- // with the page. Fix it by wrapping it in zone.run().
- // This is the only navigate() where I have seen this happen.
- this.zone.run(() => {
- this.router.navigate([this.loginPath]);
- });
- });
-
- this.route.data.subscribe((data: {staffResolver : any}) => {
- // Data fetched via EgStaffResolver is available here.
- });
- }
-
- /**
- * Verifying the auth token on every route is overkill, since
- * an expired token will make itself known with the first API
- * call or when the auth session poll discovers it, but we do
- * want to prevent navigation from the login or workstation admin
- * page, since these can be accessed without a valid authtoken or
- * workstation, respectively, once the initial route resolvers have
- * done their jobs.
- */
- basicAuthChecks(url: string): void {
-
- // Access to login page is always granted
- if (url == this.loginPath) return;
-
- if (!this.auth.token())
- this.router.navigate([this.loginPath]);
-
- // Access to workstation admin page is granted regardless
- // of workstation validity.
- if (url.indexOf(this.wsAdminBasePath) >= 0) return;
-
- if (this.auth.workstationState != EgAuthWsState.VALID)
- this.router.navigate([this.wsAdminBasePath]);
- }
-}
-
-
diff --git a/Open-ILS/src/eg2/src/app/staff/app.module.ts b/Open-ILS/src/eg2/src/app/staff/app.module.ts
deleted file mode 100644
index dfdd41b512..0000000000
--- a/Open-ILS/src/eg2/src/app/staff/app.module.ts
+++ /dev/null
@@ -1,24 +0,0 @@
-import {NgModule} from '@angular/core';
-import {EgStaffCommonModule} from '@eg/staff/common.module';
-
-import {EgStaffComponent} from './app.component';
-import {EgStaffRoutingModule} from './routing.module';
-import {EgStaffNavComponent} from './nav.component';
-import {EgStaffLoginComponent} from './login.component';
-import {EgStaffSplashComponent} from './splash.component';
-
-@NgModule({
- declarations: [
- EgStaffComponent,
- EgStaffNavComponent,
- EgStaffSplashComponent,
- EgStaffLoginComponent
- ],
- imports: [
- EgStaffCommonModule.forRoot(),
- EgStaffRoutingModule
- ]
-})
-
-export class EgStaffModule {}
-
diff --git a/Open-ILS/src/eg2/src/app/staff/catalog/app.component.html b/Open-ILS/src/eg2/src/app/staff/catalog/app.component.html
deleted file mode 100644
index 1596454ac1..0000000000
--- a/Open-ILS/src/eg2/src/app/staff/catalog/app.component.html
+++ /dev/null
@@ -1,6 +0,0 @@
-
-
-
-
-
-
diff --git a/Open-ILS/src/eg2/src/app/staff/catalog/app.component.ts b/Open-ILS/src/eg2/src/app/staff/catalog/app.component.ts
deleted file mode 100644
index 8fffa13ed2..0000000000
--- a/Open-ILS/src/eg2/src/app/staff/catalog/app.component.ts
+++ /dev/null
@@ -1,18 +0,0 @@
-import {Component, OnInit} from '@angular/core';
-import {StaffCatalogService} from './app.service';
-
-@Component({
- templateUrl: 'app.component.html'
-})
-export class EgCatalogComponent implements OnInit {
-
- constructor(private staffCat: StaffCatalogService) {}
-
- ngOnInit() {
- // Create the search context that will be used by all of my
- // child components. After initial creation, the context is
- // reset and updated as needed to apply new search parameters.
- this.staffCat.createContext();
- }
-}
-
diff --git a/Open-ILS/src/eg2/src/app/staff/catalog/app.module.ts b/Open-ILS/src/eg2/src/app/staff/catalog/app.module.ts
deleted file mode 100644
index fbcf894586..0000000000
--- a/Open-ILS/src/eg2/src/app/staff/catalog/app.module.ts
+++ /dev/null
@@ -1,46 +0,0 @@
-import {NgModule} from '@angular/core';
-import {EgStaffCommonModule} from '@eg/staff/common.module';
-import {EgUnapiService} from '@eg/share/unapi';
-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 './app.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 '../share/bib-summary.component';
-import {ResultPaginationComponent} from './result/pagination.component';
-import {ResultFacetsComponent} from './result/facets.component';
-import {ResultRecordComponent} from './result/record.component';
-import {StaffCatalogService} from './app.service';
-import {RecordPaginationComponent} from './record/pagination.component';
-
-@NgModule({
- declarations: [
- EgCatalogComponent,
- ResultsComponent,
- RecordComponent,
- CopiesComponent,
- EgBibSummaryComponent,
- SearchFormComponent,
- ResultRecordComponent,
- ResultFacetsComponent,
- ResultPaginationComponent,
- RecordPaginationComponent
- ],
- imports: [
- EgStaffCommonModule,
- EgCatalogRoutingModule
- ],
- providers: [
- EgUnapiService,
- EgCatalogService,
- EgCatalogUrlService,
- StaffCatalogService
- ]
-})
-
-export class EgCatalogModule {
-
-}
diff --git a/Open-ILS/src/eg2/src/app/staff/catalog/app.service.ts b/Open-ILS/src/eg2/src/app/staff/catalog/app.service.ts
deleted file mode 100644
index 0cf04ca7f2..0000000000
--- a/Open-ILS/src/eg2/src/app/staff/catalog/app.service.ts
+++ /dev/null
@@ -1,82 +0,0 @@
-import {Injectable} from '@angular/core';
-import {Router, ActivatedRoute} from '@angular/router';
-import {EgIdlObject} from '@eg/core/idl';
-import {EgOrgService} from '@eg/core/org';
-import {EgCatalogService} from '@eg/share/catalog/catalog.service';
-import {EgCatalogUrlService} from '@eg/share/catalog/catalog-url.service';
-import {CatalogSearchContext} from '@eg/share/catalog/search-context';
-
-/**
- * Shared bits needed by the staff version of the catalog.
- */
-
-@Injectable()
-export class StaffCatalogService {
-
- searchContext: CatalogSearchContext;
- routeIndex: number = 0;
- defaultSearchOrg: EgIdlObject;
- defaultSearchLimit: number;
-
- // TODO: does unapi support pref-lib for result-page copy counts?
- prefOrg: EgIdlObject;
-
- constructor(
- private router: Router,
- private route: ActivatedRoute,
- private org: EgOrgService,
- private cat: EgCatalogService,
- private catUrl: EgCatalogUrlService
- ) { }
-
- createContext(): void {
- // Initialize the search context from the load-time URL params.
- // Do this here so the search form and other context data are
- // applied on every page, not just the search results page. The
- // search results pages will handle running the actual search.
- this.searchContext =
- this.catUrl.fromUrlParams(this.route.snapshot.queryParamMap);
-
- this.searchContext.org = this.org; // service, not searchOrg
- this.searchContext.isStaff = true;
- this.applySearchDefaults();
- }
-
- applySearchDefaults(): void {
- if (!this.searchContext.searchOrg) {
- this.searchContext.searchOrg =
- this.defaultSearchOrg || this.org.root();
- }
-
- if (!this.searchContext.pager.limit) {
- this.searchContext.pager.limit = this.defaultSearchLimit || 20;
- }
- }
-
- /**
- * Redirect to the search results page while propagating the current
- * search paramters into the URL. Let the search results component
- * execute the actual search.
- */
- search(): void {
- if (!this.searchContext.isSearchable()) return;
-
- let params = this.catUrl.toUrlParams(this.searchContext);
-
- // Force a new search every time this method is called, even if
- // it's the same as the active search. Since router navigation
- // exits early when the route + params is identical, add a
- // random token to the route params to force a full navigation.
- // This also resolves a problem where only removing secondary+
- // versions of a query param fail to cause a route navigation.
- // (E.g. going from two query= params to one). Investigation
- // pending.
- params.ridx=''+this.routeIndex++;
-
- this.router.navigate(
- ['/staff/catalog/search'], {queryParams: params});
- }
-
-}
-
-
diff --git a/Open-ILS/src/eg2/src/app/staff/catalog/catalog.component.html b/Open-ILS/src/eg2/src/app/staff/catalog/catalog.component.html
new file mode 100644
index 0000000000..1596454ac1
--- /dev/null
+++ b/Open-ILS/src/eg2/src/app/staff/catalog/catalog.component.html
@@ -0,0 +1,6 @@
+
+
+
+
+
+
diff --git a/Open-ILS/src/eg2/src/app/staff/catalog/catalog.component.ts b/Open-ILS/src/eg2/src/app/staff/catalog/catalog.component.ts
new file mode 100644
index 0000000000..0324ed406b
--- /dev/null
+++ b/Open-ILS/src/eg2/src/app/staff/catalog/catalog.component.ts
@@ -0,0 +1,18 @@
+import {Component, OnInit} from '@angular/core';
+import {StaffCatalogService} from './catalog.service';
+
+@Component({
+ templateUrl: 'catalog.component.html'
+})
+export class EgCatalogComponent implements OnInit {
+
+ constructor(private staffCat: StaffCatalogService) {}
+
+ ngOnInit() {
+ // Create the search context that will be used by all of my
+ // child components. After initial creation, the context is
+ // reset and updated as needed to apply new search parameters.
+ this.staffCat.createContext();
+ }
+}
+
diff --git a/Open-ILS/src/eg2/src/app/staff/catalog/catalog.module.ts b/Open-ILS/src/eg2/src/app/staff/catalog/catalog.module.ts
new file mode 100644
index 0000000000..80a1499746
--- /dev/null
+++ b/Open-ILS/src/eg2/src/app/staff/catalog/catalog.module.ts
@@ -0,0 +1,46 @@
+import {NgModule} from '@angular/core';
+import {EgStaffCommonModule} from '@eg/staff/common.module';
+import {EgUnapiService} from '@eg/share/unapi';
+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 {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 '../share/bib-summary.component';
+import {ResultPaginationComponent} from './result/pagination.component';
+import {ResultFacetsComponent} from './result/facets.component';
+import {ResultRecordComponent} from './result/record.component';
+import {StaffCatalogService} from './catalog.service';
+import {RecordPaginationComponent} from './record/pagination.component';
+
+@NgModule({
+ declarations: [
+ EgCatalogComponent,
+ ResultsComponent,
+ RecordComponent,
+ CopiesComponent,
+ EgBibSummaryComponent,
+ SearchFormComponent,
+ ResultRecordComponent,
+ ResultFacetsComponent,
+ ResultPaginationComponent,
+ RecordPaginationComponent
+ ],
+ imports: [
+ EgStaffCommonModule,
+ EgCatalogRoutingModule
+ ],
+ providers: [
+ EgUnapiService,
+ EgCatalogService,
+ EgCatalogUrlService,
+ StaffCatalogService
+ ]
+})
+
+export class EgCatalogModule {
+
+}
diff --git a/Open-ILS/src/eg2/src/app/staff/catalog/catalog.service.ts b/Open-ILS/src/eg2/src/app/staff/catalog/catalog.service.ts
new file mode 100644
index 0000000000..0cf04ca7f2
--- /dev/null
+++ b/Open-ILS/src/eg2/src/app/staff/catalog/catalog.service.ts
@@ -0,0 +1,82 @@
+import {Injectable} from '@angular/core';
+import {Router, ActivatedRoute} from '@angular/router';
+import {EgIdlObject} from '@eg/core/idl';
+import {EgOrgService} from '@eg/core/org';
+import {EgCatalogService} from '@eg/share/catalog/catalog.service';
+import {EgCatalogUrlService} from '@eg/share/catalog/catalog-url.service';
+import {CatalogSearchContext} from '@eg/share/catalog/search-context';
+
+/**
+ * Shared bits needed by the staff version of the catalog.
+ */
+
+@Injectable()
+export class StaffCatalogService {
+
+ searchContext: CatalogSearchContext;
+ routeIndex: number = 0;
+ defaultSearchOrg: EgIdlObject;
+ defaultSearchLimit: number;
+
+ // TODO: does unapi support pref-lib for result-page copy counts?
+ prefOrg: EgIdlObject;
+
+ constructor(
+ private router: Router,
+ private route: ActivatedRoute,
+ private org: EgOrgService,
+ private cat: EgCatalogService,
+ private catUrl: EgCatalogUrlService
+ ) { }
+
+ createContext(): void {
+ // Initialize the search context from the load-time URL params.
+ // Do this here so the search form and other context data are
+ // applied on every page, not just the search results page. The
+ // search results pages will handle running the actual search.
+ this.searchContext =
+ this.catUrl.fromUrlParams(this.route.snapshot.queryParamMap);
+
+ this.searchContext.org = this.org; // service, not searchOrg
+ this.searchContext.isStaff = true;
+ this.applySearchDefaults();
+ }
+
+ applySearchDefaults(): void {
+ if (!this.searchContext.searchOrg) {
+ this.searchContext.searchOrg =
+ this.defaultSearchOrg || this.org.root();
+ }
+
+ if (!this.searchContext.pager.limit) {
+ this.searchContext.pager.limit = this.defaultSearchLimit || 20;
+ }
+ }
+
+ /**
+ * Redirect to the search results page while propagating the current
+ * search paramters into the URL. Let the search results component
+ * execute the actual search.
+ */
+ search(): void {
+ if (!this.searchContext.isSearchable()) return;
+
+ let params = this.catUrl.toUrlParams(this.searchContext);
+
+ // Force a new search every time this method is called, even if
+ // it's the same as the active search. Since router navigation
+ // exits early when the route + params is identical, add a
+ // random token to the route params to force a full navigation.
+ // This also resolves a problem where only removing secondary+
+ // versions of a query param fail to cause a route navigation.
+ // (E.g. going from two query= params to one). Investigation
+ // pending.
+ params.ridx=''+this.routeIndex++;
+
+ this.router.navigate(
+ ['/staff/catalog/search'], {queryParams: params});
+ }
+
+}
+
+
diff --git a/Open-ILS/src/eg2/src/app/staff/catalog/record/copies.component.ts b/Open-ILS/src/eg2/src/app/staff/catalog/record/copies.component.ts
index b8e05f0baa..cae7920175 100644
--- a/Open-ILS/src/eg2/src/app/staff/catalog/record/copies.component.ts
+++ b/Open-ILS/src/eg2/src/app/staff/catalog/record/copies.component.ts
@@ -1,6 +1,6 @@
import {Component, OnInit, Input} from '@angular/core';
import {EgNetService} from '@eg/core/net';
-import {StaffCatalogService} from '../app.service';
+import {StaffCatalogService} from '../catalog.service';
import {Pager} from '@eg/share/util/pager';
import {EgOrgService} from '@eg/core/org';
diff --git a/Open-ILS/src/eg2/src/app/staff/catalog/record/pagination.component.ts b/Open-ILS/src/eg2/src/app/staff/catalog/record/pagination.component.ts
index a7535f6514..31fee2cde6 100644
--- a/Open-ILS/src/eg2/src/app/staff/catalog/record/pagination.component.ts
+++ b/Open-ILS/src/eg2/src/app/staff/catalog/record/pagination.component.ts
@@ -3,7 +3,7 @@ import {Router} from '@angular/router';
import {EgCatalogService} from '@eg/share/catalog/catalog.service';
import {CatalogSearchContext} from '@eg/share/catalog/search-context';
import {EgCatalogUrlService} from '@eg/share/catalog/catalog-url.service';
-import {StaffCatalogService} from '../app.service';
+import {StaffCatalogService} from '../catalog.service';
import {Pager} from '@eg/share/util/pager';
diff --git a/Open-ILS/src/eg2/src/app/staff/catalog/record/record.component.ts b/Open-ILS/src/eg2/src/app/staff/catalog/record/record.component.ts
index 78552eb443..61e5759cd8 100644
--- a/Open-ILS/src/eg2/src/app/staff/catalog/record/record.component.ts
+++ b/Open-ILS/src/eg2/src/app/staff/catalog/record/record.component.ts
@@ -5,7 +5,7 @@ import {EgIdlObject} from '@eg/core/idl';
import {CatalogSearchContext, CatalogSearchState}
from '@eg/share/catalog/search-context';
import {EgCatalogService} from '@eg/share/catalog/catalog.service';
-import {StaffCatalogService} from '../app.service';
+import {StaffCatalogService} from '../catalog.service';
import {EgBibSummaryComponent} from '../../share/bib-summary.component';
@Component({
diff --git a/Open-ILS/src/eg2/src/app/staff/catalog/resolver.service.ts b/Open-ILS/src/eg2/src/app/staff/catalog/resolver.service.ts
index 45fc8c5927..8452323a94 100644
--- a/Open-ILS/src/eg2/src/app/staff/catalog/resolver.service.ts
+++ b/Open-ILS/src/eg2/src/app/staff/catalog/resolver.service.ts
@@ -8,7 +8,7 @@ import {EgOrgService} from '@eg/core/org';
import {EgAuthService} from '@eg/core/auth';
import {EgPcrudService} from '@eg/core/pcrud';
import {EgCatalogService} from '@eg/share/catalog/catalog.service';
-import {StaffCatalogService} from './app.service';
+import {StaffCatalogService} from './catalog.service';
@Injectable()
export class EgCatalogResolver implements Resolve> {
diff --git a/Open-ILS/src/eg2/src/app/staff/catalog/result/facets.component.ts b/Open-ILS/src/eg2/src/app/staff/catalog/result/facets.component.ts
index 8101ceda01..be689686c4 100644
--- a/Open-ILS/src/eg2/src/app/staff/catalog/result/facets.component.ts
+++ b/Open-ILS/src/eg2/src/app/staff/catalog/result/facets.component.ts
@@ -1,7 +1,7 @@
import {Component, OnInit, Input} from '@angular/core';
import {EgCatalogService} from '@eg/share/catalog/catalog.service';
import {CatalogSearchContext, FacetFilter} from '@eg/share/catalog/search-context';
-import {StaffCatalogService} from '../app.service';
+import {StaffCatalogService} from '../catalog.service';
export const FACET_CONFIG = {
display: [
diff --git a/Open-ILS/src/eg2/src/app/staff/catalog/result/pagination.component.ts b/Open-ILS/src/eg2/src/app/staff/catalog/result/pagination.component.ts
index 8dbb4d84c9..189fbced81 100644
--- a/Open-ILS/src/eg2/src/app/staff/catalog/result/pagination.component.ts
+++ b/Open-ILS/src/eg2/src/app/staff/catalog/result/pagination.component.ts
@@ -1,7 +1,7 @@
import {Component, OnInit, Input} from '@angular/core';
import {EgCatalogService} from '@eg/share/catalog/catalog.service';
import {CatalogSearchContext} from '@eg/share/catalog/search-context';
-import {StaffCatalogService} from '../app.service';
+import {StaffCatalogService} from '../catalog.service';
@Component({
selector: 'eg-catalog-result-pagination',
diff --git a/Open-ILS/src/eg2/src/app/staff/catalog/result/record.component.ts b/Open-ILS/src/eg2/src/app/staff/catalog/result/record.component.ts
index beee4cfbb0..cf903f56c2 100644
--- a/Open-ILS/src/eg2/src/app/staff/catalog/result/record.component.ts
+++ b/Open-ILS/src/eg2/src/app/staff/catalog/result/record.component.ts
@@ -5,7 +5,7 @@ import {EgCatalogService} from '@eg/share/catalog/catalog.service';
import {CatalogSearchContext} from '@eg/share/catalog/search-context';
import {EgNetService} from '@eg/core/net';
import {EgCatalogUrlService} from '@eg/share/catalog/catalog-url.service';
-import {StaffCatalogService} from '../app.service';
+import {StaffCatalogService} from '../catalog.service';
@Component({
selector: 'eg-catalog-result-record',
diff --git a/Open-ILS/src/eg2/src/app/staff/catalog/result/results.component.ts b/Open-ILS/src/eg2/src/app/staff/catalog/result/results.component.ts
index ff2d36ce29..ff9c259a25 100644
--- a/Open-ILS/src/eg2/src/app/staff/catalog/result/results.component.ts
+++ b/Open-ILS/src/eg2/src/app/staff/catalog/result/results.component.ts
@@ -7,7 +7,7 @@ import {EgCatalogUrlService} from '@eg/share/catalog/catalog-url.service';
import {CatalogSearchContext, CatalogSearchState}
from '@eg/share/catalog/search-context';
import {EgPcrudService} from '@eg/core/pcrud';
-import {StaffCatalogService} from '../app.service';
+import {StaffCatalogService} from '../catalog.service';
import {EgIdlObject} from '@eg/core/idl';
@Component({
diff --git a/Open-ILS/src/eg2/src/app/staff/catalog/routing.module.ts b/Open-ILS/src/eg2/src/app/staff/catalog/routing.module.ts
index 9125c9d7eb..2376f80cb4 100644
--- a/Open-ILS/src/eg2/src/app/staff/catalog/routing.module.ts
+++ b/Open-ILS/src/eg2/src/app/staff/catalog/routing.module.ts
@@ -1,6 +1,6 @@
import {NgModule} from '@angular/core';
import {RouterModule, Routes} from '@angular/router';
-import {EgCatalogComponent} from './app.component';
+import {EgCatalogComponent} from './catalog.component';
import {ResultsComponent} from './result/results.component';
import {RecordComponent} from './record/record.component';
import {EgCatalogResolver} from './resolver.service';
diff --git a/Open-ILS/src/eg2/src/app/staff/catalog/search-form.component.ts b/Open-ILS/src/eg2/src/app/staff/catalog/search-form.component.ts
index 9e5b807593..615e608f34 100644
--- a/Open-ILS/src/eg2/src/app/staff/catalog/search-form.component.ts
+++ b/Open-ILS/src/eg2/src/app/staff/catalog/search-form.component.ts
@@ -4,7 +4,7 @@ import {EgOrgService} from '@eg/core/org';
import {EgCatalogService,} from '@eg/share/catalog/catalog.service';
import {CatalogSearchContext, CatalogSearchState}
from '@eg/share/catalog/search-context';
-import {StaffCatalogService} from './app.service';
+import {StaffCatalogService} from './catalog.service';
@Component({
selector: 'eg-catalog-search-form',
diff --git a/Open-ILS/src/eg2/src/app/staff/circ/patron/bcsearch/app.component.html b/Open-ILS/src/eg2/src/app/staff/circ/patron/bcsearch/app.component.html
deleted file mode 100644
index 58d5c4c3d5..0000000000
--- a/Open-ILS/src/eg2/src/app/staff/circ/patron/bcsearch/app.component.html
+++ /dev/null
@@ -1,19 +0,0 @@
-
-
-
-
-
+
diff --git a/Open-ILS/src/eg2/src/app/staff/staff.component.ts b/Open-ILS/src/eg2/src/app/staff/staff.component.ts
new file mode 100644
index 0000000000..864beab8eb
--- /dev/null
+++ b/Open-ILS/src/eg2/src/app/staff/staff.component.ts
@@ -0,0 +1,88 @@
+import {Component, OnInit, NgZone} from '@angular/core';
+import {Router, ActivatedRoute, NavigationEnd} from '@angular/router';
+import {EgAuthService, EgAuthWsState} from '@eg/core/auth';
+import {EgNetService} from '@eg/core/net';
+
+@Component({
+ templateUrl: 'staff.component.html',
+ styleUrls: ['staff.component.css']
+})
+
+export class EgStaffComponent implements OnInit {
+
+ readonly loginPath = '/staff/login';
+ readonly wsAdminBasePath = '/staff/admin/workstation/workstations/';
+
+ constructor(
+ private router: Router,
+ private route: ActivatedRoute,
+ private zone: NgZone,
+ private net: EgNetService,
+ private auth: EgAuthService
+ ) {}
+
+ ngOnInit() {
+
+ console.debug('EgStaffComponent:ngOnInit()');
+
+ // Fires on all in-app router navigation, but not initial page load.
+ this.router.events.subscribe(routeEvent => {
+ if (routeEvent instanceof NavigationEnd) {
+ //console.debug(`EgStaffComponent routing to ${routeEvent.url}`);
+ this.basicAuthChecks(routeEvent.url);
+ }
+ });
+
+ // Redirect to the login page on any auth timeout events.
+ this.net.authExpired$.subscribe(expireEvent => {
+
+ // If the expired authtoken was identified locally (i.e.
+ // in this browser tab) notify all tabs of imminent logout.
+ if (!expireEvent.viaExternal) this.auth.broadcastLogout();
+
+ console.debug('Auth session has expired. Redirecting to login');
+ this.auth.redirectUrl = this.router.url;
+
+ // https://github.com/angular/angular/issues/18254
+ // When a tab redirects to a login page as a result of
+ // another tab broadcasting a logout, ngOnInit() fails to
+ // fire in the login component, until the user interacts
+ // with the page. Fix it by wrapping it in zone.run().
+ // This is the only navigate() where I have seen this happen.
+ this.zone.run(() => {
+ this.router.navigate([this.loginPath]);
+ });
+ });
+
+ this.route.data.subscribe((data: {staffResolver : any}) => {
+ // Data fetched via EgStaffResolver is available here.
+ });
+ }
+
+ /**
+ * Verifying the auth token on every route is overkill, since
+ * an expired token will make itself known with the first API
+ * call or when the auth session poll discovers it, but we do
+ * want to prevent navigation from the login or workstation admin
+ * page, since these can be accessed without a valid authtoken or
+ * workstation, respectively, once the initial route resolvers have
+ * done their jobs.
+ */
+ basicAuthChecks(url: string): void {
+
+ // Access to login page is always granted
+ if (url == this.loginPath) return;
+
+ if (!this.auth.token())
+ this.router.navigate([this.loginPath]);
+
+ // Access to workstation admin page is granted regardless
+ // of workstation validity.
+ if (url.indexOf(this.wsAdminBasePath) >= 0) return;
+
+ if (this.auth.workstationState != EgAuthWsState.VALID)
+ this.router.navigate([this.wsAdminBasePath]);
+ }
+}
+
+
diff --git a/Open-ILS/src/eg2/src/app/staff/staff.module.ts b/Open-ILS/src/eg2/src/app/staff/staff.module.ts
new file mode 100644
index 0000000000..52f6abdd31
--- /dev/null
+++ b/Open-ILS/src/eg2/src/app/staff/staff.module.ts
@@ -0,0 +1,24 @@
+import {NgModule} from '@angular/core';
+import {EgStaffCommonModule} 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';
+
+@NgModule({
+ declarations: [
+ EgStaffComponent,
+ EgStaffNavComponent,
+ EgStaffSplashComponent,
+ EgStaffLoginComponent
+ ],
+ imports: [
+ EgStaffCommonModule.forRoot(),
+ EgStaffRoutingModule
+ ]
+})
+
+export class EgStaffModule {}
+
diff --git a/Open-ILS/src/eg2/src/app/welcome.component.html b/Open-ILS/src/eg2/src/app/welcome.component.html
index 3ce97cc247..eaa1c71896 100644
--- a/Open-ILS/src/eg2/src/app/welcome.component.html
+++ b/Open-ILS/src/eg2/src/app/welcome.component.html
@@ -5,7 +5,7 @@