/**
* 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.
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.
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');
.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))
;
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<void> {
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.
}
}
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: '',
*/
.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')
$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([
// 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 });
});
$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);
}
}
}
}
- 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,