mksrom
(Romain Buisson)
January 15, 2018, 9:11am
1
Hi Bahmni devs!
In Bahmni Connect my Registration and Clinical screens are showing empty pages.
I am not sure what happens because there is no error in the Chrome console.
Does anyone have had the same problem?
Here is the contents of the sources on the registration blank page https://localhost/bahmni-connect/registration/index.html#/search:
Anything obvious? Where could I start to look at?
(cc: @sumanmaity112 )
Hi @mksrom ,
Is it your dev environment? If yes, to build bahmni-connect-apps
you have to follow given steps
Do the steps suggested here
grunt chrome
grunt generate-sw
Also, run the following commands in your vagrant/docker machine
bahmni -i <inventory file> create-connect-artifacts
bahmni -i <inventory file> concat-configs
mksrom
(Romain Buisson)
January 15, 2018, 11:56am
3
I have installed Bahmni Connect within my Docker container (not a Vagrant box actually) using the inventory file as I am not doing dev work on it yet. So the installer just took care of that. And the sources seems correctly copied in /var/www/bahmni-connect-apps/
[root@bahmni /]# tree /var/www/bahmni-connect-apps/registration/
/var/www/bahmni-connect-apps/registration/
βββ index.html
βββ registration.min.android.js
βββ registration.min.chrome.js
βββ registration.min.css
βββ registration.min.js
βββ views
βββ addressFields.html
βββ age.html
βββ customIdentifierConfirmation.html
βββ dob.html
βββ editpatient.html
βββ header.html
βββ layout.html
βββ newpatient.html
βββ nolayoutfound.html
βββ notimplemented.html
βββ patientAction.html
βββ patientcommon.html
βββ patientDeathInformation.html
βββ patientRelationships.html
βββ printOptions.html
βββ search.html
βββ topDownAddressFields.html
βββ visit.html
1 directory, 23 files
The steps you mention refer to Bahmni Apps.
Does it mean that Bahmni Connect is just a specific build of Bahmni Apps?
If so, what is Bahmni Connect repo for? (It looks like this repo is anyway a copy of Bahmni Apps)
When doing grunt chrome
:
/ui$ grunt chrome
Warning: Task "chrome" not found. Use --force to continue.
Aborted due to warnings.
Same with grunt generate-sw
/ui$ grunt generate-sw
Warning: Task "generate-sw" not found. Use --force to continue.
Aborted due to warnings.
(on master)
mksrom
(Romain Buisson)
January 15, 2018, 11:59am
4
sumanmaity112:
Also, run the following commands in your vagrant/docker machine
bahmni -i <inventory file> create-connect-artifacts
bahmni -i <inventory file> concat-configs
I have had done those steps already. Redone them just now but doesnβt change anything
mksd
(Dimitri R)
January 15, 2018, 12:05pm
5
The grunt tasks chrome
, generate-sw
, β¦ etc are specific to Bahmni Connect (see here ) and are not defined in Bahmni Apps.
I suspect that Bahmni Connect is an offline friendly subset of Bahmni Apps with ad-hoc dependencies and builds. But @sumanmaity112 will certainly clarify that.
Hi @mksrom , @mksd ,
bahmni-connect repo is subset of openmrs-module-bahmniapps . bahmni-connect
repo only holds specific offline (PWA
and android
) related client side code.
grunt chrome
, grunt generate-sw
etc are specific to bahmni-connect.
All the steps present here you have to do it inside bahmni-connect/ui
folder
mksrom
(Romain Buisson)
January 15, 2018, 2:33pm
7
Thanks @sumanmaity112 @mksd for clarifying this.
I have now just built the bahmni-connect project following @sumanmaity112 βs instructions and it went through without errors.
Then I copied the newly built sources in /opt/bahmni-offline/bahmni-connect-apps/
[root@bahmni ~]# ll /var/www/
total 24
lrwxrwxrwx 1 bahmni bahmni 31 Jan 4 17:48 bahmniapps -> /opt/bahmni-web/etc/bahmniapps/
lrwxrwxrwx 1 bahmni bahmni 34 Jan 4 17:48 bahmni_config -> /opt/bahmni-web/etc/bahmni_config/
lrwxrwxrwx 1 bahmni bahmni 40 Jan 4 17:48 bahmni-connect-apps -> /opt/bahmni-offline/bahmni-connect-apps/
drwxr-xr-x 2 bahmni bahmni 4096 Jan 4 17:47 bahmni_revisions
drwxr-xr-x 2 root root 4096 Jan 4 17:48 cgi-bin
lrwxrwxrwx 1 bahmni bahmni 40 Jan 4 17:48 client_side_logging -> /opt/bahmni-web/etc/client_side_logging/
drwxr-xr-x 3 root root 4096 Jan 4 17:47 error
drwxr-xr-x 2 root root 4096 Jan 15 21:08 html
drwxr-xr-x 3 root root 4096 Jan 4 17:47 icons
lrwxrwxrwx 1 bahmni bahmni 60 Jan 4 17:48 implementer_interface -> /opt/bahmni-implementer-interface/etc/implementer_interface/
[root@bahmni ~]# ll /var/www/bahmni-connect-apps/
total 3616
-rw-r--r-- 1 bahmni bahmni 3110550 Jan 15 21:06 bahmni-connect.tar.gz
drwxrwxr-x 8 bahmni bahmni 4096 Jan 15 20:32 clinical
drwxrwxr-x 13 bahmni bahmni 4096 Jan 15 20:31 common
-rw-rw-r-- 1 bahmni bahmni 196702 Jan 15 20:31 common.background.min.js
-rw-rw-r-- 1 bahmni bahmni 265210 Jan 15 20:31 common.offline.min.js
drwxrwxr-x 41 bahmni bahmni 4096 Jan 15 20:31 components
-rw-rw-r-- 1 bahmni bahmni 6285 Jan 15 18:37 favicon.ico
drwxrwxr-x 3 bahmni bahmni 4096 Jan 15 20:32 home
drwxrwxr-x 6 bahmni bahmni 4096 Jan 15 20:31 i18n
drwxrwxr-x 2 bahmni bahmni 4096 Jan 15 20:31 images
-rw-rw-r-- 1 bahmni bahmni 1125 Jan 15 20:32 index.html
drwxrwxr-x 6 bahmni bahmni 4096 Jan 15 20:31 lib
drwxrwxr-x 3 bahmni bahmni 4096 Jan 15 20:32 offline
drwxrwxr-x 3 bahmni bahmni 4096 Jan 15 20:32 registration
-rw-rw-r-- 1 bahmni bahmni 423 Jan 15 18:37 service-worker-events.js
-rw-rw-r-- 1 bahmni bahmni 56782 Jan 15 20:33 service-worker.js
-rw-rw-r-- 1 bahmni bahmni 3283 Jan 15 18:37 service-worker-reg.js
drwxrwxr-x 3 bahmni bahmni 4096 Jan 15 20:31 styles
No better.
Continuing investigationβ¦
Hi @mksrom ,
Which folder did you copy dist
or app
?
If you copy app
folder it will not work. You have to copy dist
folder.
Can you clean browsers local storage
and unregister
the PWA?
Also, check network calls during initial sync is something failing or not.
After initial sync, if you go to clinical module, the network/source
will look like the following image
mksrom
(Romain Buisson)
January 15, 2018, 7:25pm
9
I have copied the dist
folder yes.
I have also cleared the local storage from the Chrome console, however, I havenβt βunregisteredβ the PWA, how can this be done?
What I have done too is use the βDelete Connect Appβ button in the βlogoutβ menu. Not sure what thatβs doing in the background though. That seems to wipe all the caches.
Here is the sources after clearing all app caches etcβ¦:
Seems to be the same as yours
Investigating more tomorrowβ¦
Hi @mksrom ,
When you click on Clinical module, what is the URL then?
It should be something like this https://<host name>/bahmni-connect/clinical/index.html#/default/patient/search
Did you changed any bahmni-connect
app side? If not, can you install bahmni-connect
using bahmni
command and check if its working or not
mksrom
(Romain Buisson)
January 16, 2018, 1:33pm
11
Yes, the URL is right.
It seems that the problem is related to my config though. With the default config, it works fine.
When I load my config and run the bahmni concat-config
on it, I get the problem.
Now I will try to strip down my config to a minimum and see if there is a particular element that triggers the problem.
mksrom
(Romain Buisson)
January 16, 2018, 1:41pm
12
Actually what is the operation bahmni concat-configs
doing?
Itβs copy and minify config presents in `bahmni_config/offline/openmrs/apps/".
When you run bahmni -i < inventory file name> concat-configs
, its go through all the folder present in the above location (bahmni_config/offline/openmrs/apps/)
and creates minified config file. The file name will be <folder name>.json
.
Here I have 3 folder - clinical
, home
, registration
. If I run bahmni -i <inventory file name> concat-configs
, it will create openmrs/apps/clinical/clinical.json
, openmrs/apps/dbNameCondition/dbNameCondition.json
, openmrs/apps/home/home.json
, openmrs/apps/registration/registration.json
in bahmni_config
1 Like
mksrom
(Romain Buisson)
January 17, 2018, 5:33pm
14
Thanks for all the help.
Have had headaches for this one!
Found that the problem is coming from my formConditions.js
file.
This is because of missing β;β at the end of some lines in this file. Indeed, because it is minified by the bahmni -i <inventory file name> concat-configs
command the βend of linesβ are removed so Javascript then does not know where a line stops of course.
-> tip of the day: always use β;β at the end a of line in JS.
4 Likes
mksd
(Dimitri R)
January 18, 2018, 1:11pm
16
@mksrom yes we should probably run some validation build(s) on our Bahmni configs.
@angshuonline there is not such thing for the default config though?
no. We donβt run default config through JSLINT
mksd
(Dimitri R)
January 18, 2018, 1:15pm
18
I suspect that we will want to do that for our configs. Thatβll be the opportunity to do a PR on the default config as well.