As per the vocabulary, the Registry is designed as a storage place for apps outside of ui-dashboard to register resources. These will then become available to dashboard for the purposes of dynamic interactions between different frontend apps.
...
A RegistryResource is a class containing information about a particular resource of the registry. It has fields that are technically publically available, but they should only be accessed through the requisite getters and setters.
Once https://github.com/tc39/proposal-private-methods#private-methods-and-fields or equivalent become available and supported, these fields should be made private. This class contains the following methods with which to interact with it:
Warning |
---|
getLink/setLink are implemented, but their shape is not yet finalised in generality. It is HIGHLY recommended that these are not utilised, and any early implementors confine their use to get/set for ViewResource and ViewResources. |
...
This function sets a string OR function entry on the above Map.
getLink(linkName)
This function returns the string OR function entry set on the above Map.
Note |
---|
Currently it is presumed that a string link implies a direct URL which can be followed, and a function link is to be passed one parameter, namely the resource in question. See the agreements implementation for an example. |
setViewResources(linkName, link)
...
A function for the special case of setLink which should reflect a basic URL path for a "view" page for a resource. In the case of agreements it would be "/erm/agreements/{id}".
...
getViewResources(
...
linkName)
Sets a function field "viewAllTemplate", which should take some parameters, such as filterList, or a backend search query, and returns a URL which reflects that search in the frontend.
addViewTemplate(template)
Sets a function field, "viewTemplate" which will take an object representing the resource in question and will return a URL to find that resource in the frontend. For example agreements would take an agreement, and use its ID field to return something of the form "/erm/agreements/03b7f730-66fe-4bfa-9838-062e903d36fa"
getViewAll()
Returns the viewAll field above.
getViewAllTemplate()
Returns the "viewAllTemplate" field above
getViewTemplate()
Returns the "viewTemplate" field above
...
A function which fetches 'viewResources' from above.
getViewResource(linkName)
A function which fetches 'viewResource' from above.
setLookupComponent(component)
Takes in a react component and assigns it to the field "lookupComponent".
...
Warning |
---|
The methods above for templating links and customRendering custom rendering are essentially just code injection, so it is vitally important that implementers consider that their code is just going to be run within ui-dashboard, and potentially elsewhere too. The risk here is minimal, with no user defined methods, but it's still worth noting and taking care when implementing a custom render function. |
...