From 5b62351063b76701c595aa3cc47fe69a4d8b58a6 Mon Sep 17 00:00:00 2001 From: Bill Erickson Date: Thu, 30 Nov 2017 07:59:21 -0500 Subject: [PATCH] LP#626157 Ang2 experiments Signed-off-by: Bill Erickson --- Open-ILS/webby-src/src/app/base.module.ts | 12 ++++---- .../src/app/core/{auth.service.ts => auth.ts} | 6 ++-- .../src/app/core/{event.service.ts => event.ts} | 0 .../src/app/core/{idl.service.ts => idl.ts} | 0 Open-ILS/webby-src/src/app/core/net.service.ts | 2 +- .../src/app/core/{org.service.ts => org.ts} | 4 +-- .../src/app/core/{pcrud.service.ts => pcrud.ts} | 4 +-- .../src/app/core/{store.service.ts => store.ts} | 0 Open-ILS/webby-src/src/app/resolver.service.ts | 4 +-- .../admin/workstation/workstations.component.ts | 17 +++++++----- .../circ/patron/bcsearch/bcsearch.component.ts | 2 +- .../webby-src/src/app/staff/login.component.ts | 4 +-- .../webby-src/src/app/staff/resolver.service.ts | 4 +-- .../src/app/staff/share/org-select.component.html | 7 ++++- .../src/app/staff/share/org-select.component.ts | 32 ++++++++++++++-------- .../webby-src/src/app/staff/staff.component.ts | 2 +- 16 files changed, 59 insertions(+), 41 deletions(-) rename Open-ILS/webby-src/src/app/core/{auth.service.ts => auth.ts} (97%) rename Open-ILS/webby-src/src/app/core/{event.service.ts => event.ts} (100%) rename Open-ILS/webby-src/src/app/core/{idl.service.ts => idl.ts} (100%) rename Open-ILS/webby-src/src/app/core/{org.service.ts => org.ts} (97%) rename Open-ILS/webby-src/src/app/core/{pcrud.service.ts => pcrud.ts} (98%) rename Open-ILS/webby-src/src/app/core/{store.service.ts => store.ts} (100%) diff --git a/Open-ILS/webby-src/src/app/base.module.ts b/Open-ILS/webby-src/src/app/base.module.ts index 0bd2a07278..7f2df7c7ec 100644 --- a/Open-ILS/webby-src/src/app/base.module.ts +++ b/Open-ILS/webby-src/src/app/base.module.ts @@ -14,13 +14,13 @@ import {EgBaseRoutingModule} from './routing.module'; import {WelcomeComponent} from './welcome.component'; // Import and 'provide' globally required services. -import {EgEventService} from '@eg/core/event.service'; -import {EgStoreService} from '@eg/core/store.service'; -import {EgIdlService} from '@eg/core/idl.service'; +import {EgEventService} from '@eg/core/event'; +import {EgStoreService} from '@eg/core/store'; +import {EgIdlService} from '@eg/core/idl'; import {EgNetService} from '@eg/core/net.service'; -import {EgAuthService} from '@eg/core/auth.service'; -import {EgPcrudService} from '@eg/core/pcrud.service'; -import {EgOrgService} from '@eg/core/org.service'; +import {EgAuthService} from '@eg/core/auth'; +import {EgPcrudService} from '@eg/core/pcrud'; +import {EgOrgService} from '@eg/core/org'; @NgModule({ declarations: [ diff --git a/Open-ILS/webby-src/src/app/core/auth.service.ts b/Open-ILS/webby-src/src/app/core/auth.ts similarity index 97% rename from Open-ILS/webby-src/src/app/core/auth.service.ts rename to Open-ILS/webby-src/src/app/core/auth.ts index 4a956a598e..6d94d80169 100644 --- a/Open-ILS/webby-src/src/app/core/auth.service.ts +++ b/Open-ILS/webby-src/src/app/core/auth.ts @@ -4,9 +4,9 @@ import { Injectable, EventEmitter } from '@angular/core'; import { Observable } from 'rxjs/Rx'; import { EgNetService } from './net.service'; -import { EgEventService, EgEvent } from './event.service'; -import { EgIdlService, EgIdlObject } from './idl.service'; -import { EgStoreService } from './store.service'; +import { EgEventService, EgEvent } from './event'; +import { EgIdlService, EgIdlObject } from './idl'; +import { EgStoreService } from './store'; // Models a login instance. class EgAuthUser { diff --git a/Open-ILS/webby-src/src/app/core/event.service.ts b/Open-ILS/webby-src/src/app/core/event.ts similarity index 100% rename from Open-ILS/webby-src/src/app/core/event.service.ts rename to Open-ILS/webby-src/src/app/core/event.ts diff --git a/Open-ILS/webby-src/src/app/core/idl.service.ts b/Open-ILS/webby-src/src/app/core/idl.ts similarity index 100% rename from Open-ILS/webby-src/src/app/core/idl.service.ts rename to Open-ILS/webby-src/src/app/core/idl.ts diff --git a/Open-ILS/webby-src/src/app/core/net.service.ts b/Open-ILS/webby-src/src/app/core/net.service.ts index b7b3648f27..0d98d17222 100644 --- a/Open-ILS/webby-src/src/app/core/net.service.ts +++ b/Open-ILS/webby-src/src/app/core/net.service.ts @@ -17,7 +17,7 @@ */ import { Injectable, EventEmitter } from '@angular/core'; import { Observable, Observer } from 'rxjs/Rx'; -import { EgEventService, EgEvent } from './event.service'; +import { EgEventService, EgEvent } from './event'; // Global vars from opensrf.js // These are availavble at runtime, but are not exported. diff --git a/Open-ILS/webby-src/src/app/core/org.service.ts b/Open-ILS/webby-src/src/app/core/org.ts similarity index 97% rename from Open-ILS/webby-src/src/app/core/org.service.ts rename to Open-ILS/webby-src/src/app/core/org.ts index d641555243..460b1e35d1 100644 --- a/Open-ILS/webby-src/src/app/core/org.service.ts +++ b/Open-ILS/webby-src/src/app/core/org.ts @@ -1,7 +1,7 @@ import {Injectable} from '@angular/core'; import {Observable} from 'rxjs/Rx'; -import {EgIdlObject, EgIdlService} from './idl.service'; -import {EgPcrudService} from './pcrud.service'; +import {EgIdlObject, EgIdlService} from './idl'; +import {EgPcrudService} from './pcrud'; type EgOrgNodeOrId = number | EgIdlObject; diff --git a/Open-ILS/webby-src/src/app/core/pcrud.service.ts b/Open-ILS/webby-src/src/app/core/pcrud.ts similarity index 98% rename from Open-ILS/webby-src/src/app/core/pcrud.service.ts rename to Open-ILS/webby-src/src/app/core/pcrud.ts index efe1d3e796..42a93ef9fb 100644 --- a/Open-ILS/webby-src/src/app/core/pcrud.service.ts +++ b/Open-ILS/webby-src/src/app/core/pcrud.ts @@ -1,9 +1,9 @@ import {Injectable} from '@angular/core'; import {Observable, Observer} from 'rxjs/Rx'; //import {toPromise} from 'rxjs/operators'; -import {EgIdlService, EgIdlObject} from './idl.service'; +import {EgIdlService, EgIdlObject} from './idl'; import {EgNetService, EgNetRequest} from './net.service'; -import {EgAuthService} from './auth.service'; +import {EgAuthService} from './auth'; // Used for debugging. declare var js2JSON: (jsThing:any) => string; diff --git a/Open-ILS/webby-src/src/app/core/store.service.ts b/Open-ILS/webby-src/src/app/core/store.ts similarity index 100% rename from Open-ILS/webby-src/src/app/core/store.service.ts rename to Open-ILS/webby-src/src/app/core/store.ts diff --git a/Open-ILS/webby-src/src/app/resolver.service.ts b/Open-ILS/webby-src/src/app/resolver.service.ts index 984e888ed1..c63b2d5ed6 100644 --- a/Open-ILS/webby-src/src/app/resolver.service.ts +++ b/Open-ILS/webby-src/src/app/resolver.service.ts @@ -1,8 +1,8 @@ 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 {EgIdlService} from '@eg/core/idl'; +import {EgOrgService} from '@eg/core/org'; @Injectable() export class EgBaseResolver implements Resolve> { diff --git a/Open-ILS/webby-src/src/app/staff/admin/workstation/workstations.component.ts b/Open-ILS/webby-src/src/app/staff/admin/workstation/workstations.component.ts index 4e212cf090..231bcb4e4f 100644 --- a/Open-ILS/webby-src/src/app/staff/admin/workstation/workstations.component.ts +++ b/Open-ILS/webby-src/src/app/staff/admin/workstation/workstations.component.ts @@ -1,10 +1,10 @@ import {Component, OnInit} from '@angular/core'; import {ActivatedRoute} from '@angular/router'; -import {EgStoreService} from '@eg/core/store.service'; -import {EgIdlObject} from '@eg/core/idl.service'; +import {EgStoreService} from '@eg/core/store'; +import {EgIdlObject} from '@eg/core/idl'; import {EgNetService} from '@eg/core/net.service'; -import {EgAuthService} from '@eg/core/auth.service'; -import {EgOrgService} from '@eg/core/org.service'; +import {EgAuthService} from '@eg/core/auth'; +import {EgOrgService} from '@eg/core/org'; // Slim version of the WS that's stored in the cache. interface Workstation { @@ -21,7 +21,6 @@ export class EgWorkstationsComponent implements OnInit { selectedId: Number; workstations: Workstation[] = []; isRemoving: boolean = false; - newOwner: EgIdlObject; newName: String; @@ -29,12 +28,15 @@ export class EgWorkstationsComponent implements OnInit { private route: ActivatedRoute, private egNet: EgNetService, private egAuth: EgAuthService, - private egStore: EgStoreService + private egStore: EgStoreService, + private egOrg: EgOrgService ) {} ngOnInit() { this.egStore.getItem('eg.workstation.all') .then(res => this.workstations = res); + + this.newOwner = this.egOrg.root(); } selected(): Workstation { @@ -59,7 +61,8 @@ export class EgWorkstationsComponent implements OnInit { } registerWorkstation(): void { - console.log('registering ' + this.newName); + console.log(this.newOwner); + console.log('registering ' + this.newName + ' : ' + this.newOwner.shortname()); } } 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 21bb111e67..3b2cfe1695 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 @@ -1,7 +1,7 @@ import { Component, OnInit } from '@angular/core'; import { ActivatedRoute } from '@angular/router'; import { EgNetService } from '@eg/core/net.service'; -import { EgAuthService } from '@eg/core/auth.service'; +import { EgAuthService } from '@eg/core/auth'; @Component({ templateUrl: 'bcsearch.component.html' diff --git a/Open-ILS/webby-src/src/app/staff/login.component.ts b/Open-ILS/webby-src/src/app/staff/login.component.ts index 599562d91a..3dd94940aa 100644 --- a/Open-ILS/webby-src/src/app/staff/login.component.ts +++ b/Open-ILS/webby-src/src/app/staff/login.component.ts @@ -1,8 +1,8 @@ import { Component, OnInit, Renderer } from '@angular/core'; import { Location } from '@angular/common'; import { Router } from '@angular/router'; -import { EgAuthService, EgAuthWsState } from '@eg/core/auth.service'; -import { EgStoreService } from '@eg/core/store.service'; // TODO: testing +import { EgAuthService, EgAuthWsState } from '@eg/core/auth'; +import { EgStoreService } from '@eg/core/store'; // TODO: testing @Component({ templateUrl : './login.component.html' diff --git a/Open-ILS/webby-src/src/app/staff/resolver.service.ts b/Open-ILS/webby-src/src/app/staff/resolver.service.ts index 83dba49a46..21eddec7ce 100644 --- a/Open-ILS/webby-src/src/app/staff/resolver.service.ts +++ b/Open-ILS/webby-src/src/app/staff/resolver.service.ts @@ -3,9 +3,9 @@ import { Location } from '@angular/common'; import { Observable, Observer } from 'rxjs/Rx'; import { Router, Resolve, RouterStateSnapshot, ActivatedRouteSnapshot } from '@angular/router'; -import { EgStoreService } from '@eg/core/store.service'; +import { EgStoreService } from '@eg/core/store'; import { EgNetService } from '@eg/core/net.service'; -import { EgAuthService } from '@eg/core/auth.service'; +import { EgAuthService } from '@eg/core/auth'; /** * Apply configuration, etc. required by all staff components. diff --git a/Open-ILS/webby-src/src/app/staff/share/org-select.component.html b/Open-ILS/webby-src/src/app/staff/share/org-select.component.html index b8fb2d574e..50ec19bb39 100644 --- a/Open-ILS/webby-src/src/app/staff/share/org-select.component.html +++ b/Open-ILS/webby-src/src/app/staff/share/org-select.component.html @@ -1,4 +1,9 @@ - +
): Observable => { return text$ .debounceTime(100) .distinctUntilChanged() - .map(term => this.states.filter( - v => v.toLowerCase().indexOf(term.toLowerCase()) > -1) - ); + .map(term => { + return this.egOrg.list().filter(org => { + let sn = org.shortname().toLowerCase(); + return sn.indexOf(term.toLowerCase()) > -1 + }).map(org => { + // The browser won't collapse multiple spaces when + // using a space-ish unicode char instead of regular spaces. + let space = ' '; // U+2007 + let sn = org.shortname(); + for (var i = 0; i < org.ou_type().depth(); i++) { + sn = space + sn; + } + return sn; + }) + }); } } - diff --git a/Open-ILS/webby-src/src/app/staff/staff.component.ts b/Open-ILS/webby-src/src/app/staff/staff.component.ts index 6f7ba18616..836a92bbd1 100644 --- a/Open-ILS/webby-src/src/app/staff/staff.component.ts +++ b/Open-ILS/webby-src/src/app/staff/staff.component.ts @@ -1,6 +1,6 @@ import { Component, OnInit } from '@angular/core'; import { Router, ActivatedRoute, NavigationEnd } from '@angular/router'; -import { EgAuthService, EgAuthWsState } from '@eg/core/auth.service'; +import { EgAuthService, EgAuthWsState } from '@eg/core/auth'; import { EgNetService } from '@eg/core/net.service'; @Component({ -- 2.11.0