Upgrade angular version in UICommons

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 Upgrade angular version in UICommons - Development - OpenMRS Talk 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