ang2 notes
authorBill Erickson <berickxx@gmail.com>
Fri, 16 Mar 2018 18:57:46 +0000 (14:57 -0400)
committerBill Erickson <berickxx@gmail.com>
Fri, 16 Mar 2018 18:57:46 +0000 (14:57 -0400)
Signed-off-by: Bill Erickson <berickxx@gmail.com>
NOTES.adoc

index e6b0658..28195b6 100644 (file)
@@ -132,6 +132,11 @@ import * as $ from 'jquery';
 == Integrated service workers
  * Not yet researched
 
+== Baked-in page title service
+
+* https://angular.io/guide/set-document-title
+* this solves the problem of our ang1 title service not working.
+
 == Configure Apache for lazy-loading / nested modules
 
 * Assumes ng-build is compiling to /openils/var/web/e2 (or symlinked)
@@ -167,15 +172,6 @@ import * as $ from 'jquery';
  * Minifying
  * i18n translation file generation
 
-=== Development w/ Apache
-
- * https://github.com/angular/angular-cli/wiki/stories-disk-serve
- * Basically, use 'ng build --watch' -- it will compile the build
-   into .js, etc. files and recompile as the code is updated.  
- * Beware --deploy-url for setting base path for JS, etc. src's.
-   ng build --deploy-url /webby/ --base-href /webby/ --output-path  ../web/webby/  --watch
-
-
 == ng-bootstrap / Bootstrap 4
 * No more glyphicons -- note also licensing issues.
 * https://material.io/icons/ -- apache license
@@ -190,11 +186,56 @@ import * as $ from 'jquery';
 
 == ng-upgrade, etc.
 
-* Start w/ an ang5 shell, integrate a simple angjs hello world 
-directive.
-* Add an ang5 service and use from the angjs directive.
-* Add an angjs service and use from ang5 component.
-
+* Ang2 bootstraps ang1.
+* Beware an1 page-level controllers (see patron search app failure to load).
+* 
+
+=== Migration Plan
+
+* Phase I: separate branch/repo
+** Make /eg2/ a viable parallel structure
+*** Mainly navbar w/ hotkeys that link back to ang1
+** Enable ang2 mixed mode on ang1 apps.
+* Phase II 
+** Merge to master and start running in mixed mode.
+** Migrate core services to ang2 and "downgrade" 
+** Migrate core components to ang2 and "downgrade" 
+*** TODO: how will mixing bootstrap versions behave?
+* Phase III
+** Migrate existing apps to /eg2/
+** All new apps are built in /eg2/
+* Phase IV
+** Remove any remaining /eg/staff/ code / templates
+
+We may find that some ang1 apps are not quickly amenable to running
+in mixed mode.  In such cases, it make sense to leave them as ang1-only
+apps during phases I and II, then port them directly to ang2 once /eg2/
+is viable.  This approach means we'd be retaining both ang1 and ang2 
+versions of shared services until all of the ang1-only apps were migrated.
+
+=== Complications with full mixed-use approach
+* Use of EGWeb and TT2
+* Using base href /eg/staff complicates the process of creating a framework
+  for sharing new ang2 with non-staff apps.
+* lazy-loaded ang2 components that depend on route-resolvers would not be 
+  available to ang1 code unless they were pre-loaded and any data they
+  depend on loaded by route resolvers would have to be replicated in 
+  ang1 somehow.
+* Dependencies for both ang versions have to be handled separately regardless.
+* Mixing bootstrap 3 and 4 ? (TODO test)
+
+== If we give up TT
+
+Can get org fall through magic with apache via:
+
+[source,conf]
+---------------------------------------------------------------------------
+RewriteEngine on
+RewriteCond %{DOCUMENT_ROOT}/child_org/%{REQUEST_URI} -f
+RewriteRule ^(.+) %{DOCUMENT_ROOT}/child_org/$1 [L]
+RewriteCond %{DOCUMENT_ROOT}/root_org/%{REQUEST_URI} -f
+RewriteRule ^(.+) %{DOCUMENT_ROOT}/root_org/$1 [L]
+---------------------------------------------------------------------------
 
 == 0 to 60
 
@@ -203,9 +244,10 @@ directive.
 * mkdir Open-ILS/web/eg2
 * opensrf: ln -s /home/berick/code/Evergreen/Open-ILS/web/eg2 /openils/var/web/eg2
 * sudo npm install -g @angular/cli
-* cd Open-ILS/eg2-src
+* cd Open-ILS/src/eg2
 * npm install
-* ng build --deploy-url /eg2/ --base-href /eg2/ --output-path  ../web/eg2/  --watch
+* ng build --app eg-migration --output-path ../../web/js/ui/default/staff/ng2-shell
+* ng build --app eg --deploy-url /eg2/ --base-href /eg2/ --output-path  ../../web/eg2/  --watch
 
 ==
 
@@ -214,11 +256,10 @@ to review the /eg/ work and reassess some things.
 
 * many deps are the same as we're already using -- jasmine, karma
 
-== Integrationg JS to angjs
- * main thing is
-[source,js]
--------------------------------------------------------------------------
-var service = {};
-var service: any = {};
-# branch user/berick/lp1626157-webstaff-typescript
--------------------------------------------------------------------------
+==
+
+Dependencies can be a bear.  Should we consider pinning and posting the
+ang1 and ang2 node_modules dirs somewhere so we can just fetch them and
+not have to rely on npm for dependency fetching.
+
+