OWA generator improvement

@pascal Ticket link for the 404 error with openmrs-standalone platform :

Great, thanks @ankitkumar. I also created OMRSJS-19 for another bug I found. You’re welcome to fix it, along with OWA-18 if you like.

1 Like

@pascal OMRSJS-19 issue fixed

1 Like

PR link : https://github.com/psbrandt/generator-openmrs-owa/pull/26

Great work @ankitkumar. Due to this problem, I want to manually configure all the related files for my project :joy:

1 Like

@pascal @darius Hii !!

I have introduced some of the components from the “openmrs-contrib-uicommons” library into the owa generator. And also ensured the angularjs best practices by introducing different components for each of the controllers I have created and also by following the ES6 best practices (so that it could easily be converted to the Angularjs v2.0 in future)

My PR link : https://github.com/psbrandt/generator-openmrs-owa/pull/28

Thanks !!

Thanks @ankitkumar for this work. :slight_smile: Do you plan to also include some message localisation? That is where text could be translated into the selected language:

Haven’t planned yet, but yeah may be, I could do that. :slight_smile:

There is also an “openmrs-choose-language” component in the ui-commons library that will be used to choose and activate the languages, but I wasn’t able to find that into my “node-modules” “openmrs-contrib-uicommons” library. It’s present at the github but was not in the node modules which was generated by the yo openmrs-owa command. So, that tag was unrecognised by my IDE.

May be that component could help doing that (just an idea, haven’t gone through that yet) :slight_smile:

@pascal Hii !!

This week, I have started practicing the REST API part and currently I am going to work on adding a “Patient search” component ( which is a part of my next month deliverables according to my timeline here ) !!

I have few questions in my mind :

  1. In case, If I complete the patient search component part within this month, then could I commit that into the PR, which you are currently reviewing or I have to create a new PR after you review that PR ?

  2. Mid term evaluations are starting from 26th, so do I need to prepare some kind of presentation or anything for that ?

Sorry, was traveling this weekend. I think create another PR for the component. I’ll get to the review this week.

For the evaluation, just make sure you’ve covered everything that is required by GSoC (e.g. blog posts).

1 Like

Sure ! Thanks :slight_smile:

@raff @pascal Hii !!

I am implementing the patient search component which looks like this :

Designing my own rest modules could have been a cumbersome process, so for rest calls, I am using the openmrsRest.listFull from the rest module at the openmrs-contrib-uicommons library. But I guess there is something wrong with the rest module because, I have tried this (below image) but couldn’t fetch any desired data !

My codes are :

Component :

Controller :

And html file :

Am I doing something wrong ?? or the fault is with the openmrsRest module ??

Note : I am currently using openmrs-standalone v2.6.0 due to lack of data in the openmrs sdk !!

Edit : the filter is vm.query (but still not fetching data)

It may be a bug in openmrsRest, but since it is quite widely used, I doubt it’s completely broken. What exactly is happening? What do the HTTP requests looks like? Are there any JavaScript errors?

Can you post your code somewhere so we can take a look?

No, there are no javascript errors related to it !! ok I am committing the code to my github repository in a few minutes, you may take a look at it ! Sending the link in few minutes !

Are you sure you need the template ('{{vm.query}}') in your controller code? Also check that you’re not using "vm.query" when you’re supposed to be using "query".

yes, I need that template (’{{vm.query}}’) in my controller because I am binding my text field with that. I have used ng-model as vm.query so in order to fetch that from the search field to the rest query, I guess I need that !! And I have used that “query” instead of “vm.query” by mistake. I already resolved that !! Still not working

Here is the link to my repository where codes are placed :

main repository : https://github.com/Ankitkumar94/generator-test

Can you generate an app that has the broken patient search component on the home screen, and then push that code to a different repo? Then I can build and install the app and look at just that part of the code.

OK sure :relieved:

This is what I had to do to make it work:

diff --git a/app/js/home/controllers/patientSearch.controller.js b/app/js/home/controllers/patientSearch.controller.js
index 2455eb6..ea481b3 100644
--- a/app/js/home/controllers/patientSearch.controller.js
+++ b/app/js/home/controllers/patientSearch.controller.js
@@ -4,7 +4,7 @@ class PatientSearchController {
     var vm = this;
     vm.patients = [];
     vm.onsearch = () => {
-      openmrsRest.listFull('patient', {q: '{{vm.query}}', includeAll: true}).then(function (response) {
+      openmrsRest.listFull('patient', {q: vm.query, includeAll: true}).then(function (response) {
         if(response.results.length > 0){
           vm.patients = response.results;
diff --git a/app/js/home/patientSearch.html b/app/js/home/patientSearch.html
index b971ccd..1fa9013 100644
--- a/app/js/home/patientSearch.html
+++ b/app/js/home/patientSearch.html
@@ -1,7 +1,7 @@
 <div style="width: auto; height: 250px; overflow: scroll ">
   <input type="text" ng-model="vm.query" /> <br/>
   <small> ** search by patient name </small> <br/><br/>
-  <button ng-click="onsearch"> Search </button> <br/><br/>
+  <button ng-click="vm.onsearch()"> Search </button> <br/><br/>
@@ -11,7 +11,7 @@
       <th> Location </th>
       <th> uuid </th>
-    <tr ng-repeat="patient in patients | filter: vm.query">
+    <tr ng-repeat="patient in vm.patients | filter: vm.query">
       <td> {{patient.auditInfo}} </td>
       <td> {{patient.identifier}} </td>
       <td> {{patient.display}} </td>
1 Like