Unable to Add Navigation Group When Configuring Application with JSON

I am attempting to customize the application using a JSON configuration. After watching a video and reviewing the documentation on the OpenMRS wiki “Configure the Patient Chart Navigation: Pages & Dashboards”(O3 Implementer Documentation: Set Up, Configure & Deploy - Projects - OpenMRS Wiki).

However, I noticed that the JSON code provided in the documentation was incorrect, so I fixed it and used the updated code instead

{
  "@openmrs/esm-patient-chart-app": {
    "extensionSlots": {
      "patient-chart-dashboard-slot": {
        "add": [
          "nav-group#HIVAdultReturn",
          "nav-group#NCDOutpatient"
        ],
        "configure": {
          "nav-group#HIVAdultReturn": {
            "navGroup": {
              "title": "HIV Adult Return",
              "slotName": "hiv-nav-group-slot"
            }
          },
          "nav-group#NCDOutpatient": {
            "navGroup": {
              "title": "NCD Outpatient",
              "slotName": "heart-nav-group-slot"
            }
          }
        }
      }
    }
  }
}

However, I was unable to add a new group to the patient chart navigation. Instead, I only saw an empty ‘My Group’ section

Thanks. I’ve updated the Wiki.

Looks like a bug of some kind. Are you able to open a ticket in the O3 project for this?

I would be happy to add it as soon as I gain access. :slight_smile: Currently, I have requested access to the tracker issue.

I have created a bug issue, I would appreciate it if someone could review/revise it if necessary. This is my first issue in OpenMRS and I’m really looking forward to contributing to the project! :slight_smile:

https://issues.openmrs.org/browse/O3-2065

1 Like

That’s a very well-written issue! Thank you!

Hey @ibacher @yaroslav. Taking up on this, I found out that the specified title at some point is not returned, instead, we get back the default specified in the generic navGroup config schema.

Consoling the entire config object, noticed another error Screenshot from 2023-04-20 11-29-09

Could you please enlight more about what might be causing the error @ibacher

image

Changed the default to WAt Group just to test out

can you kindly share the updated config obj you used again pliz!

can you update the configure section;

That should work perfectly fine according to error; unknown config key nav-group.navGroup class could not recognise that!!

yeah definitely, just figured that out now, and everything now works perfectly.

image

One with the default title WAt Group is where I left the navGroup property. So @yaroslav and @ibacher, I think we need to update this implementation if it is referenced somewhere.

i suppose we just have to use the correct format for the properties you want to configure. Otherwise using the nav-group property too has use-cases, but yes there needs a clarification.

I think we don’t need that extra navGroup property following the genericNavGroupConfigSchema

given this specific implementation we just dont need nested nav-group!

Cool! In that case, I think we can just update the Wiki (whenever that’s back) and call it a day.

@yaroslav Could you try out:

{
  "@openmrs/esm-patient-chart-app": {
    "extensionSlots": {
      "patient-chart-dashboard-slot": {
        "add": [
          "nav-group#HIVAdultReturn",
          "nav-group#NCDOutpatient"
        ],
        "configure": {
          "nav-group#HIVAdultReturn": {
            "title": "HIV Adult Return",
            "slotName": "hiv-nav-group-slot"
          },
          "nav-group#NCDOutpatient": {
            "title": "NCD Outpatient",
            "slotName": "heart-nav-group-slot"
          }
        }
      }
    }
  }
}
1 Like

@ibacher @jexsie @thembo42 Thank you, guys!! That is now working like a charm.

I also found a commit that may have caused the functionality to break. I’m not sure of the reason behind these changes, but it may be worth taking a closer look at it.

06c9d11c (feat) Should be able to create dashboards using config (#653)

can you link that up?

There’s a change in the config schema, but that commit is actually what made things work.

So, @thembo42, @ibacher and @yaroslav. I have marked the ticket as done and linked this thread.

1 Like

Did you also update the wiki?

never done that before. Anyways, let me check it out