Migrate Browser Client to Angular 1.5 + Dependencies

Bug #1554714 reported by Bill Erickson on 2016-03-08
14
This bug affects 3 people
Affects Status Importance Assigned to Milestone
Evergreen
Medium
Unassigned

Bug Description

Evergreen master (circa 2.10)

The browser client uses AngularJS 1.2. It also uses a variety of dependencies (e.g. angular-bootstrap, etc.) that depend on the version of AngularJS in use. To better prepare for the pending release of Angular 2.0, and to avoid the pitfalls of falling too far behind, we should update the browser client code and dependencies to use the latest stable version of Angular (1.5).

Opening this now to kick things off. Will follow up with more details on what steps I expect will be needed and hopefully some initial code.

As a heads up, once the ball is rolling, I believe we'll need a good bit of community assistance with testing the existing code to ensure that no stones are left unturned.

Bill Erickson (berick) wrote :

Updated the target version from Ang 1.4 to 1.5, which was recently released.

summary: - Migrate Browser Client to Angular 1.4 + Dependencies
+ Migrate Browser Client to Angular 1.5 + Dependencies
description: updated
Bill Erickson (berick) wrote :

Getting started here:

http://git.evergreen-ils.org/?p=working/Evergreen.git;a=shortlog;h=refs/heads/user/berick/lp1554714-angular-deps-1.5

Code is partially functional, but some UI's / components still need work. More to follow.

Bill Erickson (berick) wrote :

The update is causing problems with our local eg-date-input directive. After some futzing I'm unable to get it working. As a solution, I would like to propose that we start using angular-bootstrap's native calendar widget, which works much better in the newer code.

https://angular-ui.github.io/bootstrap/ -- Search down for "Datepicker".

I pushed an example of porting an existing date to the date picker:

http://git.evergreen-ils.org/?p=working/Evergreen.git;a=commitdiff;h=4e16ff0c896b5df2adaf23af2221f6260d7d0108

This change has the added benefit of resolving bug #1436983

Galen Charlton (gmc) wrote :

Testing will reveal all, but on the face of it, I'm +1 for trying the angular-bootstrap date picker (and time picker, presumably).

Mike Rylander (mrylander) wrote :

Bill, would you propose replacing all input type=date elements with this? (and time, as appropriate)

Bill Erickson (berick) wrote :

Thanks to both of you for the input. Mike, to answer your question, yes, my plan is replace the internals of eg-date-input to use the date (and optionally) time picker internally.

I pushed a commit to the tip of the working branch as a first stab at this. It required some mild HTML refactoring in some cases to correct layout changes. I also modified any <input eg-date-input..> elements to be <eg-date-input..> elements, to better emphasize that it's not a single input, but a full blown widget in its own right.

Testing looks good so far.

Otherwise, the only other big thing remaining I'm aware of for the 1.5 migration is to repair the dropdown buttons. They're not opening for some reason. This happened once before and just required a change an attribute change.

Bill Erickson (berick) wrote :

Steps for repairing dropdown menus:

1. Elements that have class="dropdown" need to also have a value-less "uib-dropdown" attribute.

<li class="dropdown" uib-dropdown>...</li>

2. Elements that have class="dropdown-menu", replace with a value-less "uib-dropdown-menu" attribute.

<ul uib-dropdown-menu>...</ul>

3. Elements that have class="dropdown-toggle" and/or data-toggle="dropdown", replace either/both with a value-less "uib-dropdown-toggle" attribute.

<a href uib-dropdown-toggle>...</a>

I have implemented these fixes for the main nav bar:

 http://git.evergreen-ils.org/?p=working/Evergreen.git;a=commitdiff;h=70640bf93ec872992ba09ff11d4c111fe8478553

Will work on others as I can. Patches appreciated!

===

A quick note on running the new code: the simplest way to update your local angular + dependencies is to delete the bower components and rebuild.

* cd Open-ILS/web/js/ui/default/staff/
* rm -r bower_components
* bower install
* grunt build
* cp -r build/* /openils/var/web/js/ui/default/staff/build/ # or do a regular install

==

Note that 'grunt all' will fail. Something is dying within the unit tests. Pending investigation.

Mike Rylander (mrylander) wrote :

Bill, I was looking over this and noticed a minor thinko ... seems small enough that a branch would be overkill.

diff --git a/Open-ILS/src/templates/staff/circ/share/t_hold_dates.tt2 b/Open-ILS/src/templates/staff/circ/share/t_hold_dates.tt2
index b145d0e..edcbda4 100644 (file)
   ...
@@ -61,8 +64,9 @@
         <label for='shelf_expire_time'>[% l("Shelf Expire Date") %]</label>
       </div>
       <div class="col-md-7">
- <input id='shelf_expire_time' eg-date-input
+ <ng-date-input id='shelf_expire_time'
           ng-disabled="!args.modify_shelf_expire_time" ng-model="args.shelf_expire_time"/>
+ </eg-date-input>
       </div>
     </div>
   </div>

That <ng-date-input> opening tag is a typo, I think.

Bill Erickson (berick) wrote :

Thanks, Mike. I have rebased the branch to master to resolve conflicts with the recently merged patron editor code. Pushed another fix to address the issue Mike raised. Plus one more fix to repair org unit dropdown widget.

Galen Charlton (gmc) wrote :

I've worked out why the unit tests were failing, and I've started a new collab branch:

collab/gmcharlt/lp1554714-angular-deps-1.5

Galen Charlton (gmc) wrote :

I've also pushed some drop-down menu repairs to the collab branch; I intentionally didn't touch cat templates yet pending merge of the final sprint2 branch.

Galen Charlton (gmc) wrote :

The collab branch now contains:

- a merge of master that includes the final sprint2 stuff
- more dropdown repairs
- final $modal => $uibModal changes

Galen Charlton (gmc) wrote :

The collab branch now also includes an update of our use of Collapse

Galen Charlton (gmc) wrote :

I've started a new collab branch, collab/gmcharlt/lp1554714-angular-deps-1.5-signedoff, replacing the previous one. The two differences:

- it's rebased against master
- it includes my signoff

http://git.evergreen-ils.org/?p=working/Evergreen.git;a=shortlog;h=refs/heads/collab/gmcharlt/lp1554714-angular-deps-1.5-signedoff

Bill Erickson (berick) wrote :

Updated instructions for running the new branch:

1. cd Open-ILS/web/js/ui/default/staff/
2. Remove or rename the "bower_components" and "node_modules" directories.
3. sudo npm install
4. bower install

You may not have to remove the directories, but if you don't, it will ask questions about which versions you want to install. With the dependency directories gone, it handles all of that for you by rebuilding everything.

Bill Erickson (berick) wrote :

Signed off on Galen's final commits and merged the lot into master. Thanks, Galen!

Changed in evergreen:
milestone: none → 2.next
status: New → Fix Committed
Ben Shum (bshum) wrote :

Reopening this bug per IRC discussions (http://irc.evergreen-ils.org/evergreen/2016-05-04). As discovered at the Evergreen conference, we found that attempts to compile the web staff client with these patches for Angular 1.5 merged to master failed for Debian Jessie and Ubuntu 14.04 and 16.04.

An error like PhantomJS 2.1.1 (Linux 0.0.0): Executed 27 of 27 (27 FAILED) (pulled from Debian Wheezy live test server link: http://testing.evergreen-ils.org/~live/test.16.html)

Changed in evergreen:
status: Fix Committed → Triaged
importance: Undecided → Wishlist
Bill Erickson (berick) wrote :

Branch pushed that allows this to build for me now:

http://git.evergreen-ils.org/?p=working/Evergreen.git;a=shortlog;h=refs/heads/user/berick/lp1554714-ang-1.5-hotkeys-fix

In short, the hotkeys plugin went through some renaming, similar to the ui-bootstrap stuff.

Changed in evergreen:
status: Triaged → Confirmed
importance: Wishlist → Medium
tags: added: pullrequest
Ben Shum (bshum) wrote :

Build works fine on Ubuntu 14.04, but on testing with Ubuntu 16.04, it complains about phantomjs-launcher unmet dependency.

Something like:

└── UNMET PEER DEPENDENCY phantomjs-prebuilt@>=1.9
npm WARN karma-phantomjs-launcher@1.0.0 requires a peer of phantomjs-prebuilt@>=1.9 but none was installed.

If I install phantomjs-prebuilt manually with "npm install phantomjs-prebuilt", then re-run the steps "npm install", "grunt all" then the grunt all is happy and it appears to build successfully.

Jason Stephenson (jstephenson) wrote :

After applying the above fix branch, it now builds on Ubuntu 14.04.

However, just going to the login page results in the attached screen shot.

Bill Erickson (berick) wrote :

I have not tested the above branch on 14.04. It should work in theory, but needs confirmation.

Bill Erickson (berick) wrote :

More fixes coming for the hotkeys stuff...

Bill Erickson (berick) wrote :

Force pushed a functional (*gasp*) solution to the hotkeys issue back to same branch. Solution was simpler than I originally though.

http://git.evergreen-ils.org/?p=working/Evergreen.git;a=shortlog;h=refs/heads/user/berick/lp1554714-ang-1.5-hotkeys-fix

==

Also force pushed the same phantomjs fix, but including the modified hotkeys fix for testing them together.

http://git.evergreen-ils.org/?p=working/Evergreen.git;a=shortlog;h=refs/heads/user/berick/lp1554714-phantomjs-deps-update

Ben Shum (bshum) wrote :

Tested both commits with Ubuntu 14.04 and 16.04. Web staff compiled without error and was usable for basic function testing (i.e. logging in, clicking through menus).

This is my signoff branch (didn't feel comfortable pushing tonight without one more independent check by someone else): user/bshum/lp1554714-phantomjs-deps-update-signoff

http://git.evergreen-ils.org/?p=working/Evergreen.git;a=shortlog;h=refs/heads/user/bshum/lp1554714-phantomjs-deps-update-signoff

Jason Stephenson (jstephenson) wrote :

Tested the above commits, via Ben's signoff branch, and they fix the issues on Ubuntu 14.04 and 16.04 for me. I assume they resolve the issues on Debian, also.

Signed off and pushed to master for great justice!

Changed in evergreen:
status: Confirmed → Fix Committed
Ben Shum (bshum) wrote :

With the release of angular 1.5.6, the deps fail to locate this version cause we are looking specifically for angular 1.5.5 in the bower.json file.

Patch at the top of this working branch changes it to look for ~1.5.5 (aka, minimally angular 1.5.5, but any higher version of 1.5.x will do).

working/user/bshum/angular155andup

http://git.evergreen-ils.org/?p=working/Evergreen.git;a=shortlog;h=refs/heads/user/bshum/angular155andup

Bill Erickson (berick) wrote :

Tested and pushed Ben's 155andup patch. Looks good. Thanks, Ben.

Changed in evergreen:
milestone: 2.next → 2.11-alpha
Changed in evergreen:
status: Fix Committed → Fix Released
To post a comment you must log in.
This report contains Public information  Edit
Everyone can see this information.

Duplicates of this bug

Other bug subscribers