From: Bill Erickson Date: Tue, 21 Nov 2017 03:28:07 +0000 (-0500) Subject: LP#626157 Ang2 experiments X-Git-Url: https://old-git.evergreen-ils.org/?a=commitdiff_plain;h=5afdfec01b7ad7472768f7571b0507d89ded1e45;p=working%2FEvergreen.git LP#626157 Ang2 experiments Signed-off-by: Bill Erickson --- diff --git a/Open-ILS/webby-src/src/app/core/eg-auth.service.ts b/Open-ILS/webby-src/src/app/core/eg-auth.service.ts index 920a48c67f..8501133ccb 100644 --- a/Open-ILS/webby-src/src/app/core/eg-auth.service.ts +++ b/Open-ILS/webby-src/src/app/core/eg-auth.service.ts @@ -23,7 +23,8 @@ class EgAuthUser { interface EgAuthArgs { username : String, password : String, - workstation : String + workstation : String, + type : String } @Injectable() diff --git a/Open-ILS/webby-src/src/app/staff/circ/patron/bcsearch/bcsearch.component.ts b/Open-ILS/webby-src/src/app/staff/circ/patron/bcsearch/bcsearch.component.ts index e93db6e5e5..cb95c1fe57 100644 --- a/Open-ILS/webby-src/src/app/staff/circ/patron/bcsearch/bcsearch.component.ts +++ b/Open-ILS/webby-src/src/app/staff/circ/patron/bcsearch/bcsearch.component.ts @@ -65,7 +65,8 @@ export class EgBcSearchComponent implements OnInit { this.egAuth.login({ username: 'admin', password: 'demo123', - workstation : 'BR1-skiddoo' + workstation : 'BR1-skiddoo', + type : 'staff' }).then(res => { console.log('login OK with auth ' + this.egAuth.token()); }); diff --git a/Open-ILS/webby-src/src/app/staff/login.component.html b/Open-ILS/webby-src/src/app/staff/login.component.html new file mode 100644 index 0000000000..8bb9cd66fc --- /dev/null +++ b/Open-ILS/webby-src/src/app/staff/login.component.html @@ -0,0 +1,37 @@ +
+
+
+
+ Sign In +
+ +
+ + +
+ +
+ + +
+ + +
+
+
+
+
diff --git a/Open-ILS/webby-src/src/app/staff/login.component.ts b/Open-ILS/webby-src/src/app/staff/login.component.ts new file mode 100644 index 0000000000..fa96cfafe1 --- /dev/null +++ b/Open-ILS/webby-src/src/app/staff/login.component.ts @@ -0,0 +1,35 @@ +import { Component, OnInit, Renderer } from '@angular/core'; +import { EgAuthService } from '@eg/core/eg-auth.service'; + +@Component({ + templateUrl : './login.component.html' +}) + +export class EgStaffLoginComponent implements OnInit { + + args = { + username : '', + password : '', + type : 'staff', + workstation : 'BR1-skiddoo' + }; + + constructor( + private egAuth: EgAuthService, + private renderer: Renderer + ) {} + + ngOnInit() { + // Focus username + this.renderer.selectRootElement('#username').focus(); + } + + handleSubmit() { + this.egAuth.login(this.args).then( + res => console.log('Authtoken: ' + this.egAuth.token()) + ); + } +} + + + diff --git a/Open-ILS/webby-src/src/app/staff/staff-routing.module.ts b/Open-ILS/webby-src/src/app/staff/staff-routing.module.ts index 5b45c0a393..85452c76bf 100644 --- a/Open-ILS/webby-src/src/app/staff/staff-routing.module.ts +++ b/Open-ILS/webby-src/src/app/staff/staff-routing.module.ts @@ -1,7 +1,8 @@ -import { NgModule } from '@angular/core'; -import { RouterModule, Routes } from '@angular/router'; -import { EgStaffComponent } from './staff.component'; -import { EgStaffResolver } from './staff-resolver.service'; +import { NgModule } from '@angular/core'; +import { RouterModule, Routes } from '@angular/router'; +import { EgStaffComponent } from './staff.component'; +import { EgStaffLoginComponent } from './login.component'; +import { EgStaffResolver } from './staff-resolver.service'; const routes: Routes = [ { path: '', @@ -10,8 +11,12 @@ const routes: Routes = [ // complete before any child resolvers are started. resolve : {startup : EgStaffResolver}, children : [ - { path : 'circ', - loadChildren : '@eg/staff/circ/circ.module#EgCircModule' + { + path: 'login', + component: EgStaffLoginComponent + }, { + path : 'circ', + loadChildren : '@eg/staff/circ/circ.module#EgCircModule' } ] } diff --git a/Open-ILS/webby-src/src/app/staff/staff.module.ts b/Open-ILS/webby-src/src/app/staff/staff.module.ts index f7dd6b1ace..1ce80fce0e 100644 --- a/Open-ILS/webby-src/src/app/staff/staff.module.ts +++ b/Open-ILS/webby-src/src/app/staff/staff.module.ts @@ -3,14 +3,16 @@ import { NgModule } from '@angular/core'; import { FormsModule } from '@angular/forms'; import { NgbModule } from '@ng-bootstrap/ng-bootstrap'; -import { EgStaffComponent } from './staff.component'; -import { EgStaffRoutingModule } from './staff-routing.module'; -import { EgStaffNavComponent } from './nav.component'; +import { EgStaffComponent } from './staff.component'; +import { EgStaffRoutingModule } from './staff-routing.module'; +import { EgStaffNavComponent } from './nav.component'; +import { EgStaffLoginComponent } from './login.component'; @NgModule({ declarations: [ EgStaffComponent, - EgStaffNavComponent + EgStaffNavComponent, + EgStaffLoginComponent ], imports: [ EgStaffRoutingModule,