Failed to map Rest endpoints for Fragment Controller using the UI Framework

Hi everyone.
I’m working on a series (Epic) of issues . This is an Epic of importing Module management from the legacy-ui to the new emr-ui of the reference application through an extension provided by the adminui module. Currently some work is done on this.

Blocker
I added and a manageModules page its page controller and a ManageModulesFragmentController which handles Ajax calls. I was blessed to find this documentation on How to Use AJAX in a Fragment but uncertainly it needs to be updated because its deprecated. It refers to APIs that were refactored. But I logically configured every thing and expect stuff to work fine, unless otherwise. However when I make an Ajax call here, it returns ‘500’ status and throws this exception at the back end. Could I be missing something?

Note
The actionLink() is invoked from here
cc : @dkayiwa , @darius , @mksd

1 Like

When I pass the FragmentController name like

    `${ui.actionLink("adminui", "ManageModulesFragmentController", "manageDependencies")}`

I get this error.
@dkayiwa , @mogoodrich , @darius Any advise here?

The parameter path here seems to be provided as a relative path as per the error:

java.net.MalformedURLException:
  no protocol: /adminui/myaccount/manageModules.page

I guess it should rather be something like this: https://[domain]/openmrs/adminui/myaccount/manageModules.page

As for here there is a typo on "manageDependecies", that could possibly be a problem.

Thanks for looking in this.

Are you sure of the typo, if so whats the correct value?

I am sure there is an English typo, but perhaps was it always there:
manageDependeciesmanageDependencies

Before you go fast with this please note that there are already two streams of work about this. One is in adminui (I think) and @suthagar23 has commented on it a lot.

Then there is more recent work on an OWA by Andela (but maybe open for work now) that combines managing owas and modules. I think this is the one we want to focus on.

Thanks @darius for clarifying this, I personally didn’t know that the recommended approach is through OWA, So perhaps I should just unassigned mySelf and the ticket description should be updated or even closed since the tickets of type OWA existing.
cc: @wyclif

FYI, I know the proper way to use the actionLink is,

ui.actionLink("moduleid", "fragmentName", "method")

That is instead of what you used above, it should be

${ui.actionLink("adminui", "manageModules", "manageDependencies"}

But I looked at the current state of your code before giving this answer and seems you fixed it. From the thread I couldn’t tell if you are still facing this problem https://pastebin.com/mGZKwSsa but if indeed you are, then my guess will be that you are relying on live reload. If you are using InteliJ Idea, gsp pages will be loaded automatically when you make changes but you may have to recompile the .java classes before they can be reloaded. So I think your view has been updated but there is no ManageModulesFragmentController available at runtime so the ui framework try’s to instantiate one but can’t find any.

3 Likes