From 8ed3ea3376ee682ac57e5431c0eb73e14e5c63da Mon Sep 17 00:00:00 2001 From: Bill Erickson Date: Thu, 8 Mar 2018 16:29:21 +0000 Subject: [PATCH] LP#1626157 more service downgrades; docs Signed-off-by: Bill Erickson --- Open-ILS/eg2-src/src/app/migration.module.ts | 16 ++++++++++++++-- Open-ILS/eg2-src/src/app/resolver.service.ts | 12 ++++++------ Open-ILS/eg2-src/src/app/routing.module.ts | 4 +++- Open-ILS/web/js/ui/default/staff/circ/checkin/app.js | 16 +++++++++------- 4 files changed, 32 insertions(+), 16 deletions(-) diff --git a/Open-ILS/eg2-src/src/app/migration.module.ts b/Open-ILS/eg2-src/src/app/migration.module.ts index 2c0c73f465..f6783eb79b 100644 --- a/Open-ILS/eg2-src/src/app/migration.module.ts +++ b/Open-ILS/eg2-src/src/app/migration.module.ts @@ -1,6 +1,9 @@ /** * EgMigrationModule * + * This module has no internal components or routing. It's just a + * pass-through for AngularJS. + * * 1. Loads the ang1 => ang2 upgrade components. * 2. Downgrades and injects shared ang2 services and components for use * by ang1. @@ -15,6 +18,7 @@ import {UpgradeModule, downgradeInjectable, downgradeComponent} from '@angular/upgrade/static'; // Import and provide some Angular built-ins +// TODO: string interpolation a la ang1 egStrings titles import {Title} from '@angular/platform-browser'; // Import and 'provide' globally required Evergreen services. @@ -55,7 +59,7 @@ export class EgMigrationModule { constructor(private upgrade: UpgradeModule) {} ngDoBootstrap() { - let myWin: any = window; // make TS happy + let myWin: any = window; // avoid TS compiler warnings if (!myWin.ang1PageApp) { console.error('NO PAGE APP DEFINED'); @@ -69,7 +73,15 @@ export class EgMigrationModule { .directive('heroDetail', downgradeComponent({ component: HeroDetailComponent }) */ - .factory('eg2Net', downgradeInjectable(EgNetService)) + + .factory('eg2Event', downgradeInjectable(EgEventService)) + .factory('eg2Store', downgradeInjectable(EgStoreService)) + .factory('eg2Idl', downgradeInjectable(EgIdlService)) + .factory('eg2Net', downgradeInjectable(EgNetService)) + .factory('eg2Auth', downgradeInjectable(EgAuthService)) + .factory('eg2Perm', downgradeInjectable(EgPermService)) + .factory('eg2Pcrud', downgradeInjectable(EgPcrudService)) + .factory('eg2Org', downgradeInjectable(EgOrgService)) .factory('ng2Title', downgradeInjectable(Title)) ; diff --git a/Open-ILS/eg2-src/src/app/resolver.service.ts b/Open-ILS/eg2-src/src/app/resolver.service.ts index 7ffa74bccb..8fd14d778d 100644 --- a/Open-ILS/eg2-src/src/app/resolver.service.ts +++ b/Open-ILS/eg2-src/src/app/resolver.service.ts @@ -13,19 +13,19 @@ export class EgBaseResolver implements Resolve> { private org: EgOrgService, ) {} + /** + * Loads pre-auth data common to all applications. + * No auth token is available at this level. When needed, auth is + * enforced by application/group-specific resolvers at lower levels. + */ resolve( route: ActivatedRouteSnapshot, state: RouterStateSnapshot): Promise { console.debug('EgBaseResolver:resolve()'); - // Load data common to all applications. - this.idl.parseIdl(); - return this.org.fetchOrgs(); - // Note that authentication happens at a deeper level, since - // some applications (e.g. a public catalog) do not require - // up-front authentication to access. + return this.org.fetchOrgs(); // anonymous PCRUD. } } diff --git a/Open-ILS/eg2-src/src/app/routing.module.ts b/Open-ILS/eg2-src/src/app/routing.module.ts index 7d7e70e71f..ba784490c1 100644 --- a/Open-ILS/eg2-src/src/app/routing.module.ts +++ b/Open-ILS/eg2-src/src/app/routing.module.ts @@ -4,9 +4,11 @@ import { EgBaseResolver } from './resolver.service'; import { WelcomeComponent } from './welcome.component'; /** - * Avoid requiring all apps to load all JS by lazy-loading sub-modules. + * Avoid loading all application JS up front by lazy-loading sub-modules. * When lazy loading, no module references should be directly imported. * The refs are encoded in the loadChildren attribute of each route. + * These modules are encoded as separate JS chunks that are fetched + * from the server only when needed. */ const routes: Routes = [ { path: '', diff --git a/Open-ILS/web/js/ui/default/staff/circ/checkin/app.js b/Open-ILS/web/js/ui/default/staff/circ/checkin/app.js index 0c7b1bbd8c..a9afc99953 100644 --- a/Open-ILS/web/js/ui/default/staff/circ/checkin/app.js +++ b/Open-ILS/web/js/ui/default/staff/circ/checkin/app.js @@ -35,9 +35,11 @@ angular.module('egCheckinApp', ['ngRoute', 'ui.bootstrap', */ .controller('CheckinCtrl', ['$scope','$q','$window','$location', '$timeout','egCore', - 'checkinSvc','egGridDataProvider','egCirc','egItem','eg2Net','ng2Title', + 'checkinSvc','egGridDataProvider','egCirc','egItem','eg2Net', + 'eg2Store','ng2Title', function($scope , $q , $window , $location , $timeout , egCore , - checkinSvc , egGridDataProvider , egCirc, itemSvc , eg2Net , ng2Title) { + checkinSvc , egGridDataProvider , egCirc, itemSvc , eg2Net , + eg2Store , ng2Title) { // TODO: TESTING eg2Net.request('open-ils.actor', 'opensrf.system.echo', 'Hello, Ang2') @@ -57,7 +59,7 @@ function($scope , $q , $window , $location , $timeout , egCore , $scope.grid_persist_key = $scope.is_capture ? 'circ.checkin.capture' : 'circ.checkin.checkin'; - egCore.hatch.getItem('circ.checkin.strict_barcode') + eg2Store.getItem('circ.checkin.strict_barcode') .then(function(sb){ $scope.strict_barcode = sb }); egCore.org.settings([ @@ -97,7 +99,7 @@ function($scope , $q , $window , $location , $timeout , egCore , // set modifiers from stored preferences angular.forEach(modifiers, function(mod) { - egCore.hatch.getItem('eg.circ.checkin.' + mod) + eg2Store.getItem('eg.circ.checkin.' + mod) .then(function(val) { if (val) $scope.modifiers[mod] = true }); }); @@ -106,10 +108,10 @@ function($scope , $q , $window , $location , $timeout , egCore , $scope.toggle_mod = function(mod) { if ($scope.modifiers[mod]) { $scope.modifiers[mod] = false; - egCore.hatch.removeItem('eg.circ.checkin.' + mod); + eg2Store.removeItem('eg.circ.checkin.' + mod); } else { $scope.modifiers[mod] = true; - egCore.hatch.setItem('eg.circ.checkin.' + mod, true); + eg2Store.setItem('eg.circ.checkin.' + mod, true); } } @@ -162,7 +164,7 @@ function($scope , $q , $window , $location , $timeout , egCore , } } - egCore.hatch.setItem('circ.checkin.strict_barcode', $scope.strict_barcode); + eg2Store.setItem('circ.checkin.strict_barcode', $scope.strict_barcode); var options = { check_barcode : $scope.strict_barcode, no_precat_alert : $scope.modifiers.no_precat_alert, -- 2.11.0