Module example using UI Framework

0 views
Skip to first unread message

Stephen Po-Chedley

unread,
May 28, 2014, 8:34:24 AM5/28/14
to d...@openmrs.org
Hi Everyone,

I'm wondering if anyone has a good example module that uses the UI Framework and UI Commons modules? 

It would be helpful to look at a module that has used the features in both of these modules as I work on my module. The UI Commons module has some great examples, but it would be nice to see some of these features in use (e.g. search or date functions). Some of the wiki topics and example code from OpenMRS University, though very helpful, is a little out of date with the more recent versions of the UI Framework. 

Thanks, 

Stephen

Darius Jazayeri

unread,
May 28, 2014, 9:47:17 PM5/28/14
to dev
The most recent UI work that Mark and I have been doing heavily uses AngularJS, and you can see that at https://github.com/openmrs/openmrs-module-appointmentschedulingui and https://github.com/openmrs/openmrs-module-reportingui . (These are probably both on the complex side.)

-Darius


--
OpenMRS Developers: http://go.openmrs.org/dev
Post: d...@openmrs.org | Unsubscribe: dev+uns...@openmrs.org
Manage your OpenMRS subscriptions at https://id.openmrs.org/

judy wawira

unread,
May 29, 2014, 8:34:32 PM5/29/14
to d...@openmrs.org
Darius , looking at the appointment scheduling , i see the code below. If i wanted to access a resource eg patient or identifier provided in core, do i need to pass a username and password for authentication  and have you tried this in angular - example would be appreciated

Thanks

var appointmentResource = angular.module('appointmentscheduling.appointmentResources', ['ngResource']);

appointmentResource.config(function ($httpProvider) {

    // to prevent the browser from displaying a password pop-up in case of an authentication error

    $httpProvider.defaults.headers.common['Disable-WWW-Authenticate'] = 'true';

});

appointmentResource.factory('AppointmentType', function($resource) {

    return $resource("/" + OPENMRS_CONTEXT_PATH  + "/ws/rest/v1/appointmentscheduling/appointmenttype/:uuid", {

        'uuid' : '@uuid'

    },{

            query: { method:'GET' }     // override query method to specify that it isn't an array that is returned

    });

});

Darius Jazayeri

unread,
May 29, 2014, 8:40:07 PM5/29/14
to dev
Hi Judy,

Our use case for this code assumes you've viewed a gsp-backed page, thus your browser has an active session when you make REST calls. (And I believe there's some code that applies a global handler somewhere that redirects you to the login page if you get timed out.)

If you're trying to do something similar, but purely client-side, you'll need to authenticate as described in the REST module's documentation.

Mark can say more about that specific code, as he's the most familiar with it.

-Darius
Reply all
Reply to author
Forward
0 new messages