Cross-distro UI for OWA

Thanks Paweł! Looking much better now!

Can we move

//'angular.module(...)' throws exception if specified module cannot be found
var dependencies = [ uiRouter, 'openmrs-contrib-uicommons',...];
try {
    distroModuleName = angular.module('distro').name;
    dependencies.push(distroModuleName);
} catch(err) {
    console.log('No distro module');
}

let crossdistroModule = angular.module('crossdistro', dependencies)

into openmrs-contrib-uicommons so that it is handled by our library instead of copying it to each OWA?

We could have a convention, which says the distro module should be named “openmrs-contrib-uicommons-customized” for the sake of calling angular.module(‘openmrs-contrib-uicommons-customized’).name.

I’d also suggest deploying the customized js and css files simply as an OWA with just those 2 files so that they can be used by all other OWAs. We could call the OWA uicommons-customized and then you would just have to declare in all OWAs:

<!--last stylesheets have the highest precedence, effectively distribution can take over app styling -->
<link rel="stylesheet" type="text/css" href="/owa/uicommons-customized/uicommons.css"/>

<!--As with stylesheets, angular modules from distro bundle override app submodules-->
<script src="/owa/uicommons-customized/uicommons.js" type="text/javascript"></script>

How does it feel?

If you want to customize components or css for all OWAs in your distribution you would only have to create uicommons-customized OWA and deploy it to your server.

1 Like