Hide/Display or Activate/Deactivate apps or extensions

We are able to currently extend OpenMRS Reference application using either apps or extensions and determine who can view our extension areas using requiredPrivilege attribute, i wonder whether there’s actually an attribute to set a condition which would evaluate to either hiding or displaying (activating or de-activating) either an app or extension.

When this is achievable, we solve the use case; Although i have loaded a module that adds a specific extension, i want to be able to trigger either its activation or de-activation

Can you give an example of such a condition?

@k_joseph

  1. Use the module activator which would check the value of an attribute to set whether to show the app if the change happens then

  2. Override the home page controller and add the required functionality

  3. Add a Javascript function to do this check - not sure where this can be hooked

  4. Use an event hook within OpenMRS server-side - not sure what this can be though

the condition can be as simple as what it should evaluate to, in this case true or false

I recall as though what @k_joseph is saying is supported but @darius might know better

1 Like

(Sorry, just getting to this now as I dig out from my vacation-induced email hole.)

You can enable/disable an app. You can do it from the UI on the Manage Apps page, or you can do it programmatically via AppFrameworkService. You can also enable/disable an extension programmatically (or in the DB), because there’s no UI for it yet. (The ticket is RA-923.)

There is also a require property on the app or extension where you can provide an expression that will be dynamically evaluated every time we decide whether or not to show the app/extension. See the wiki page on Conditionally Displaying Apps and Extensions.

I hope this answers your question @k_joseph.

2 Likes

very helpful @darius and at the right time, i will go either ways and thanks

Here is a commit i have made to activate/de-activate some extensions: https://github.com/IsantePlus/openmrs-module-isantepluspatientdashboard/commit/1f9b74ff959c95d3f0b605c938ad48a5d7ad765d