From afe441eea0c926b7226e641e066ab51b3bdaf5f1 Mon Sep 17 00:00:00 2001 From: Bill Erickson Date: Wed, 4 Apr 2018 20:39:18 +0000 Subject: [PATCH] LP#1626157 Dependancy cleanup ; avoid importing parent modules Importing the route-parent module wreaks havoc with the router. Instead, put shared imports into separate "Common" modules for direct import of child modules. Signed-off-by: Bill Erickson --- Open-ILS/src/eg2/src/app/app.module.ts | 2 ++ Open-ILS/src/eg2/src/app/common.module.ts | 31 ++++++++++++++++++++++ Open-ILS/src/eg2/src/app/routing.module.ts | 14 +++++----- .../workstation/workstations/app.component.html | 2 ++ .../admin/workstation/workstations/app.module.ts | 13 +++------ Open-ILS/src/eg2/src/app/staff/app.module.ts | 28 ++++--------------- .../src/eg2/src/app/staff/catalog/app.module.ts | 6 ++--- .../eg2/src/app/staff/catalog/routing.module.ts | 2 +- .../staff/circ/patron/bcsearch/app.component.html | 24 ++++++++++++----- .../staff/circ/patron/bcsearch/app.component.ts | 27 +++++++------------ .../app/staff/circ/patron/bcsearch/app.module.ts | 12 ++++----- .../staff/circ/patron/bcsearch/routing.module.ts | 10 +++---- .../src/eg2/src/app/staff/circ/routing.module.ts | 14 +++++----- Open-ILS/src/eg2/src/app/staff/common.module.ts | 23 ++++++++++++++++ .../src/app/staff/share/staff-banner.component.ts | 15 +++++++++++ Open-ILS/src/templates/staff/navbar.tt2 | 6 +++++ 16 files changed, 141 insertions(+), 88 deletions(-) create mode 100644 Open-ILS/src/eg2/src/app/common.module.ts create mode 100644 Open-ILS/src/eg2/src/app/staff/common.module.ts create mode 100644 Open-ILS/src/eg2/src/app/staff/share/staff-banner.component.ts diff --git a/Open-ILS/src/eg2/src/app/app.module.ts b/Open-ILS/src/eg2/src/app/app.module.ts index 146cd30f72..47c2093c49 100644 --- a/Open-ILS/src/eg2/src/app/app.module.ts +++ b/Open-ILS/src/eg2/src/app/app.module.ts @@ -8,6 +8,7 @@ import {NgModule} from '@angular/core'; import {NgbModule} from '@ng-bootstrap/ng-bootstrap'; // ng-bootstrap import {CookieModule} from 'ngx-cookie'; // import CookieMonster +import {EgCommonModule} from './common.module'; import {EgBaseComponent} from './app.component'; import {EgBaseRoutingModule} from './routing.module'; import {WelcomeComponent} from './welcome.component'; @@ -28,6 +29,7 @@ import {EgOrgService} from '@eg/core/org'; WelcomeComponent ], imports: [ + EgCommonModule, EgBaseRoutingModule, BrowserModule, NgbModule.forRoot(), diff --git a/Open-ILS/src/eg2/src/app/common.module.ts b/Open-ILS/src/eg2/src/app/common.module.ts new file mode 100644 index 0000000000..b64758dd0b --- /dev/null +++ b/Open-ILS/src/eg2/src/app/common.module.ts @@ -0,0 +1,31 @@ +import {CommonModule} from '@angular/common'; +import {NgModule} from '@angular/core'; +import {FormsModule} from '@angular/forms'; +import {NgbModule} from '@ng-bootstrap/ng-bootstrap'; +import {EgOrgSelectComponent} from '@eg/share/org-select.component'; +import {EgConfirmDialogComponent} from '@eg/share/confirm-dialog.component'; + +/** + * Collection of common modules and components used by all apps. + */ + +@NgModule({ + declarations: [ + EgOrgSelectComponent, + EgConfirmDialogComponent + ], + imports: [ + CommonModule, + FormsModule, + NgbModule + ], + exports: [ + CommonModule, + NgbModule, + FormsModule, + EgOrgSelectComponent, + EgConfirmDialogComponent + ] +}) + +export class EgCommonModule {} diff --git a/Open-ILS/src/eg2/src/app/routing.module.ts b/Open-ILS/src/eg2/src/app/routing.module.ts index ba784490c1..a1547f824f 100644 --- a/Open-ILS/src/eg2/src/app/routing.module.ts +++ b/Open-ILS/src/eg2/src/app/routing.module.ts @@ -1,7 +1,7 @@ -import { NgModule } from '@angular/core'; -import { RouterModule, Routes } from '@angular/router'; -import { EgBaseResolver } from './resolver.service'; -import { WelcomeComponent } from './welcome.component'; +import {NgModule} from '@angular/core'; +import {RouterModule, Routes} from '@angular/router'; +import {EgBaseResolver} from './resolver.service'; +import {WelcomeComponent} from './welcome.component'; /** * Avoid loading all application JS up front by lazy-loading sub-modules. @@ -21,9 +21,9 @@ const routes: Routes = [ ]; @NgModule({ - imports: [ RouterModule.forRoot(routes) ], - exports: [ RouterModule ], - providers: [ EgBaseResolver ] + imports: [RouterModule.forRoot(routes)], + exports: [RouterModule], + providers: [EgBaseResolver] }) export class EgBaseRoutingModule {} diff --git a/Open-ILS/src/eg2/src/app/staff/admin/workstation/workstations/app.component.html b/Open-ILS/src/eg2/src/app/staff/admin/workstation/workstations/app.component.html index 859c70c461..490f9a614c 100644 --- a/Open-ILS/src/eg2/src/app/staff/admin/workstation/workstations/app.component.html +++ b/Open-ILS/src/eg2/src/app/staff/admin/workstation/workstations/app.component.html @@ -1,3 +1,5 @@ + + Search for Patron by Barcode -Barcode: + + + +
+
+
+ Barcode: +
+ +
+ +
+
+
+ -
-
    -
  • {{str}}
  • -
diff --git a/Open-ILS/src/eg2/src/app/staff/circ/patron/bcsearch/app.component.ts b/Open-ILS/src/eg2/src/app/staff/circ/patron/bcsearch/app.component.ts index 43d36daf97..294a88e3c8 100644 --- a/Open-ILS/src/eg2/src/app/staff/circ/patron/bcsearch/app.component.ts +++ b/Open-ILS/src/eg2/src/app/staff/circ/patron/bcsearch/app.component.ts @@ -1,7 +1,7 @@ -import { Component, OnInit } from '@angular/core'; -import { ActivatedRoute } from '@angular/router'; -import { EgNetService } from '@eg/core/net'; -import { EgAuthService } from '@eg/core/auth'; +import {Component, OnInit, Renderer} from '@angular/core'; +import {ActivatedRoute} from '@angular/router'; +import {EgNetService} from '@eg/core/net'; +import {EgAuthService} from '@eg/core/auth'; @Component({ templateUrl: 'app.component.html' @@ -9,36 +9,27 @@ import { EgAuthService } from '@eg/core/auth'; export class EgBcSearchComponent implements OnInit { - barcode: String = ''; - strList: String[] = []; + barcode: string = ''; constructor( private route: ActivatedRoute, + private renderer: Renderer, private net: EgNetService, private auth: EgAuthService ) {} ngOnInit() { + this.renderer.selectRootElement('#barcode-search-input').focus(); this.barcode = this.route.snapshot.paramMap.get('barcode'); if (this.barcode) { - // Find the user and redirect to the + this.findUser(); } - - this.route.data.subscribe((data: { startup : any }) => { - console.debug('EgBcSearch ngOnInit complete'); - }); - - this.net.request( - 'open-ils.actor', - 'opensrf.system.echo', - 'hello', 'goodbye', 'in the middle' - ).subscribe(res => this.strList.push(res)); } findUser(): void { - // find user by this.barcode; + alert('Searching for user ' + this.barcode); } } diff --git a/Open-ILS/src/eg2/src/app/staff/circ/patron/bcsearch/app.module.ts b/Open-ILS/src/eg2/src/app/staff/circ/patron/bcsearch/app.module.ts index f119697292..bb5f6881fb 100644 --- a/Open-ILS/src/eg2/src/app/staff/circ/patron/bcsearch/app.module.ts +++ b/Open-ILS/src/eg2/src/app/staff/circ/patron/bcsearch/app.module.ts @@ -1,17 +1,15 @@ -import { CommonModule } from '@angular/common'; -import { NgModule } from '@angular/core'; -import { FormsModule } from '@angular/forms'; -import { EgBcSearchComponent } from './app.component'; -import { EgBcSearchRoutingModule } from './routing.module'; +import {NgModule} from '@angular/core'; +import {EgStaffCommonModule} from '@eg/staff/common.module'; +import {EgBcSearchRoutingModule} from './routing.module'; +import {EgBcSearchComponent} from './app.component'; @NgModule({ declarations: [ EgBcSearchComponent ], imports: [ + EgStaffCommonModule, EgBcSearchRoutingModule, - CommonModule, - FormsModule ], }) diff --git a/Open-ILS/src/eg2/src/app/staff/circ/patron/bcsearch/routing.module.ts b/Open-ILS/src/eg2/src/app/staff/circ/patron/bcsearch/routing.module.ts index 2a685f321e..a8c5a040d7 100644 --- a/Open-ILS/src/eg2/src/app/staff/circ/patron/bcsearch/routing.module.ts +++ b/Open-ILS/src/eg2/src/app/staff/circ/patron/bcsearch/routing.module.ts @@ -1,6 +1,6 @@ -import { NgModule } from '@angular/core'; -import { RouterModule, Routes } from '@angular/router'; -import { EgBcSearchComponent } from './app.component'; +import {NgModule} from '@angular/core'; +import {RouterModule, Routes} from '@angular/router'; +import {EgBcSearchComponent} from './app.component'; const routes: Routes = [ { path: '', @@ -12,8 +12,8 @@ const routes: Routes = [ ]; @NgModule({ - imports: [ RouterModule.forChild(routes) ], - exports: [ RouterModule ] + imports: [RouterModule.forChild(routes)], + exports: [RouterModule] }) export class EgBcSearchRoutingModule {} diff --git a/Open-ILS/src/eg2/src/app/staff/circ/routing.module.ts b/Open-ILS/src/eg2/src/app/staff/circ/routing.module.ts index 1b0a0f0cbe..a61417a923 100644 --- a/Open-ILS/src/eg2/src/app/staff/circ/routing.module.ts +++ b/Open-ILS/src/eg2/src/app/staff/circ/routing.module.ts @@ -1,20 +1,18 @@ import { NgModule } from '@angular/core'; import { RouterModule, Routes } from '@angular/router'; -const routes: Routes = [{ - path: '', - children : [{ - path: 'patron', +const routes: Routes = [ + { path: 'patron', children: [{ path: 'bcsearch', loadChildren: '@eg/staff/circ/patron/bcsearch/app.module#EgBcSearchModule' }] - }] -}]; + } +]; @NgModule({ - imports: [ RouterModule.forChild(routes) ], - exports: [ RouterModule ] + imports: [RouterModule.forChild(routes)], + exports: [RouterModule] }) export class EgCircRoutingModule {} diff --git a/Open-ILS/src/eg2/src/app/staff/common.module.ts b/Open-ILS/src/eg2/src/app/staff/common.module.ts new file mode 100644 index 0000000000..97a72a3222 --- /dev/null +++ b/Open-ILS/src/eg2/src/app/staff/common.module.ts @@ -0,0 +1,23 @@ +import {NgModule} from '@angular/core'; +import {EgCommonModule} from '@eg/common.module'; +import {EgStaffBannerComponent} from './share/staff-banner.component'; +import {EgConfirmDialogComponent} from '@eg/share/confirm-dialog.component'; + +/** + * Imports the EG common modules and adds modules common to all staff UI's. + */ + +@NgModule({ + declarations: [ + EgStaffBannerComponent, + ], + imports: [ + EgCommonModule + ], + exports: [ + EgCommonModule, + EgStaffBannerComponent + ] +}) + +export class EgStaffCommonModule {} diff --git a/Open-ILS/src/eg2/src/app/staff/share/staff-banner.component.ts b/Open-ILS/src/eg2/src/app/staff/share/staff-banner.component.ts new file mode 100644 index 0000000000..b11cadb100 --- /dev/null +++ b/Open-ILS/src/eg2/src/app/staff/share/staff-banner.component.ts @@ -0,0 +1,15 @@ +import {Component, OnInit, Input} from '@angular/core'; + +@Component({ + selector: 'eg-staff-banner', + template: + '' +}) + +export class EgStaffBannerComponent { + @Input() public bannerText: string; +} + + diff --git a/Open-ILS/src/templates/staff/navbar.tt2 b/Open-ILS/src/templates/staff/navbar.tt2 index a6a65ad58c..794d01156e 100644 --- a/Open-ILS/src/templates/staff/navbar.tt2 +++ b/Open-ILS/src/templates/staff/navbar.tt2 @@ -252,6 +252,12 @@
  • + + + [% l('Staff Catalog (Experimental)') %] + +
  • +
  • [% l('Record Buckets') %] -- 2.11.0