openmrs / openmrs-esm-cli

Defunct. See https://github.com/openmrs/openmrs-esm-core/tree/master/packages/tooling
0 stars 3 forks source link

Add support for arrays and arrays of objects #10

Closed brandones closed 4 years ago

brandones commented 4 years ago

Not the most elegant code I've ever written, but it does the trick.

Nested objects within arrays is still TODO.

Generates the following for esm-home:

"@openmrs/esm-home-app": {
  "buttons": {
    "enabled": true,
    "list": [
      {
        "label": "Active Visits",  // required
          // must be a string.
        "link": {"spa": false, "url": "/openmrs/coreapps/activeVisits.page?app=coreapps.activeVisits"},  // required
        "requiredPrivilege": "App:  coreapps.activeVisits"  // default: null
          // must be a string.
      },
      {"label": "Patient Registration", "link": {"spa": true, "url": "/patient-registration"}},
      {"label": "Capture Vitals", "link": {"spa": false, "url": "/openmrs/coreapps/findpatient/findPatient.page?app=referenceapplication.vitals"}, "requiredPrivilege": "App:  referenceapplication.vitals"},
      {"label": "Appointment Scheduling", "link": {"spa": false, "url": "/openmrs/appointmentschedulingui/home.page"}, "requiredPrivilege": "App:  appointmentschedulingui.home"},
      {"label": "Reports", "link": {"spa": false, "url": "/openmrs/reportingui/reportsapp/home.page"}, "requiredPrivilege": "View Reports"},
      {"label": "Data Management", "link": {"spa": false, "url": "/openmrs/coreapps/datamanagement/dataManagement.page"}, "requiredPrivilege": "App:  coreapps.dataManagement"},
      {"label": "Configure Metadata", "link": {"spa": false, "url": "/openmrs/adminui/metadata/configureMetadata.page"}, "requiredPrivilege": "App:  coreapps.configuremetadata"},
      {"label": "System Administration", "link": {"spa": false, "url": "/openmrs/coreapps/systemadministration/systemAdministration.page"}, "requiredPrivilege": "App:  coreapps.systemAdministration"},
    ],
  }
}
brandones commented 4 years ago

Not sure why the "Branch" build errored, it looks like it was using yarn, which this project doesn't use...?

brandones commented 4 years ago

Merging. Someone please take a look if you have a minute.