Upgrade angular version in UICommons

Hi,

Are there any future plans of upgrading the angular version in uicommons? The current version is 1.3.0

-Andrew

1 Like

The reason that the current version is stuck there is that I made an unwise choice years ago, and created a filter called “omrs.display”. Code here. Unfortunately in the next Angular version it no longer works to have a filter with a dot in its name (which was a dumb idea in the first place.

I’d support renaming this filter to “omrs-display” (and then upgrading angular), but someone will have to do the legwork of doing the communications around this, and helping code-heavy implementations that contribute to uicommons (e.g. PIH) to make the necessary changes on their end.

So far nobody has prioritized doing that, and nobody has really complained about the existing old angular version. (Except of course for Angular 1.x vs 2.x, but that’s a different topic!)

1 Like

Thanks Darius. We can upgrade ones more devs request for an update

According to Angular filter documentation, using a hyphen would not be any better:

Note: Filter names must be valid angular Expressions identifiers, such as uppercase or orderBy. Names with special characters, such as hyphens and dots, are not allowed. If you wish to namespace your filters, then you can use capitalization (myappSubsectionFilterx) or underscores (myapp_subsection_filterx).

Would something like this work?

Phase One

  1. Rename omrs.display filter to omrsDisplay
  2. Deprecate `omrs.display’:
.filter('omrs.display', function(omrsDisplayFilter) {
    return function(text) {
      console.log('OpenMRS Angular filter "omrs.display" is deprecated. See http://om.rs/omrsDisplay for details.');
      return omrsDisplayFilter(text);
    }
})
  1. Backport these changes to all supported versions of uicommons module

Phase Two

Run these commands on any/all modules using Angular + uicommons (we’d point http://om.rs/omrsdisplay to a wiki page with an explanation and these instructions):

$ find . -type f -print0 | xargs -0 sed -i '' 's/omrs\.display/omrsDisplay/g'
$ git commit -am "upgrade angular omrsDisplay filter"
$ git push

Final Phase

After key modules have been upgraded (could probably be done on the next version of uicommons, since modules can be patched with a single sed command), drop the deprecated omrs.display filter and you’re free to upgrade Angular.

1 Like

I’m in favor of upgrading the angular version as well some third party solutions like fullCalendar, dataTables, ngDialog, etc. to make use of new features in ongoing and future implementations.

1 Like

I would even simplify that, in that for modules I don’t think we need to deprecate, but we can just change this and release a new version, as long as we quickly release new versions of the dependent openmrs modules (mainly this will be coreapps).

This can be done as soon as someone wants to volunteer to do it!

1 Like

I would like to volunteer to make the changes to uicommons and coreapps.

Bear in mind that I only have a few hours a week to work on this and I am still working to release reference application 2.4.

I may be a good option if no one else volunteers who can get it done sooner.

2 Likes

@jdegraft, I think it would be great for you to pick this up, unless @themoonraker13 or @insiderish is actively interested in doing the work sooner.

@themoonraker13 or @insiderish, could one of you please create a ticket for this, in the UICM project in JIRA?

1 Like

@themoonraker13 & @insiderish, I am ready to start work on this. Unless you are going to work on this, can you create a ticket in JIRA so I can start?

Is this good enough?

Thanks

@insiderish, thanks.

At some point, the ticket has to be marked ready to work so I can claim. I am not sure who will do this.

However I will start working on it by investigating what needs to be done.

Reading through this thread, it seems like some coordination is needed between key users/implementers of uicommons to support this upgrade.

Though I am yet to review the code to determine the extent of changes needed to upgrade uicommons, I will like to invite users and implementers to comment on this upgrade. How it will impact them, how they need to be supported etc.

@mogoodrich, @mksd/@mksrom, any concerns about this? (You’ll want to skim the thread, especially focusing on this message from Burke: Upgrade angular version in UICommons)

@jdegraft if you read Burke’s message you’ll see he lays out a way of doing this that protects the downstream users as much as possible. So in practice the coordination part won’t be a bottleneck.

Hi @darius,

Thanks for pinging us. This will happen over the next release of UI Commons, correct (1.9)? In which case it is ok with us, we are quite looking forward to seeing Angular being upgraded! :+1:

Yes, this would happen in the next uicommons release.

Burke’s message mentions backporting, but actually we don’t support past versions of modules (only core), so you can ignore that one line.

-Darius (by phone)

I had half an eye on this thread, but thanks for the ping @darius.

I don’t have any major concerns around this–all we really should need to do is a global replace of omrs.display with omrsDisplay, correct?

We should do a uicommons release before making the change… I can kick off that release now if there are no objections?

Take care, Mark

@mogoodrich, (@darius correct me if I am wrong) however I will have to make that change to omrsDisplay in uicommons and make a pull request before uicommons can be released. (Hoping to do that this weekend.)

I meant I thought it would make sense to release UI Commons as-is now, before making the change to omrsDisplay or the angular update, just to have a stable version of the module with all the recent changes prior to upgrading angular.

Take care, Mark

That would be a great idea.

Yes, @mogoodrich please do a “before” release now. (Of course you should peek to see if there is actually anything new since the last one.)

-Darius (by phone)