Upgrade angular version in UICommons

I had already checked, and it looked like there was one fix I made, hence why I wanted to do the release… will take care of it now…

Done! Version 1.9 released.

@burke, @darius, does this upgrade include changing the angular.js files? Also any ideas on how this upgrade can be tested?

Yes, this upgrade involves downloading the latest released version of Angular (and Angular UI, and maybe a couple more), and putting these into the uicommons module, in place of what is there now.

Then you should change the standardIncludes.gsp file (maybe in the appui module?) to refer to these new files.

Then you’ll have to change the “omrs.display” filter to “omrsDisplay” as Burke describes in his post.

I would then update the coreapps module to use the new display filter, and then verify that the pages you change in coreapps do work as intended.

(There are some more steps after this, but is this making sense so far?)

-Darius (by phone)

yes it does.

My strategy will be to upgrade uicommons, make minor changes to core apps for the purposes of testing the changes to uicommons.

I need to do some more research on upgrading to angular2, but from what I know already, it is better to perform the upgrade so angular and angluar2 components can sit together, which is possible, so after the upgrade, all use of angular does not have to be upgraded immediately, @darius, @burke any thoughts on this?

Can the the owners of core apps make a stable release of the module before I make changes?

It seems like it is going to be difficult to make the upgrade in plain javascript, most of the examples available are in typescript.

My research indicates that to get a hybrid (angular/angular2) upgrade, one js file will have to become a ts file. There are additional changes as indicated in this thread.

The good news is uicommons includes the tests needed to verify the upgrade so no other module needs to change. The javascript includes are automatically detected so we don’t need to update any file.

@burke, @darius, does this approach sound good?

Hmm, let me be specific, we want to upgrade to the latest version of AngularJS 1.x, i.e. at the moment that looks to be version 1.5.8.

Upgrading to angular2 would be much bigger, and is out of scope for this ticket.

That makes it much simpler. Likely the only changes will be confined to uicommons. Could be done by the end of the week.

Progress Update !!!

Simple substitution of angular 1.5.8 causes tests to fail. My research indicates that in angular 1.4, an attempt to instantiate a module which has already been instantiated is reported as an error whereas in 1.3 this was not the case. I am getting this error on ng/angular module, so I need to take the time to figure out where this duplicate instantiation is occurring, whether in the tests or in the code and how to resolve it.

I have some commitments this weekend, so it will not be at least until next weekend before significant progress can be made.

Thanks for the update!

Mark

Some results.

There is an OpenMRS jQuery plugin toast message, and this is causes emr tests to fail. I suggest we comment out and discourage use of jquery.toastmessage.js.

There are additional failing tests which I will proceed to investigate.

I have substituted knockout and jQuery to latest versions which I can revert before the final pull request if necessary.

Upgrade successful.

In addition to changing angular files, I upgraded phantomjs which made the tests pass.

Pull request made.

What exactly was the error/problem? Toast messages are used in certain pages of the Ref App and we also have used them in our own modules (mimicking the Ref App). What else should be used instead then?

The final pull request made no changes except to upgrade the angular files and the phantomjs version in the pom.

My early messages in this thread arose as I worked my way through the problem and are no longer relevant to the final pull request.

When I first upgraded the angular files and got errors in the tests, I tried upgrading the version of jasmine. Later when I reverted the version of jasmine the failing tests passed with only the upgrade of phantomjs.

My guess is jquery toast is used in the emr object to provide clean message alerts. We use it extensively in our modules.

My pull request leaves jQuery.toast.js alone, unchanged. My initial concerns that it was the cause of the problem was unfounded.

2 Likes

Cool, thanks!

Do we have a plan for going forward? Identifying all the uses of omrs.display in dependent modules, and then attempting to merge in the changes across all the modules in one go?

Mark

Thanks @jdegraft for the pull request. Did you try to identify all the uses of omrs.display in dependent modules?

@dkayiwa, @mogoodrich, I am not sure how to do this? @darius mentioned in that backporting of modules was not supported,

@jdegraft, we don’t need to backport anything in modules, but we still need to upgrade those modules so that the next version works with the upcoming uicommons release.

This quick github search would be a first set of modules that need changes: https://github.com/search?utf8=✓&q=org%3Aopenmrs+"omrs.display"&type=Code&ref=searchresults