Versions Compared

Key

  • This line was added.
  • This line was removed.
  • Formatting was changed.

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.

...

Note

Information on how stripes eventing works can be found here: https://github.com/folio-org/stripes/blob/master/doc/dev-guide.md#handlers-and-events

Not mentioned in that document are the necessary additions to the package.json of an implementing module. The string "handler" will need to be added to the "actsAs" array, and "handlerName" will need to reflect the name of the event method in the module's index.js, most likely "eventHandler".

Code Block
"actsAs": [
  "app",
  "handler",
  "settings"
],
"handlerName": "eventHandler",


Registry API

The implementation details above cover some of the registry's API, namely how to register a resource and provide a lookupComponent. This section will cover more in depth how an implementing module can interact with the registry.

"The registry" is currently comprised of two objects and one exception:

  • Registry
  • RegistryResource
  • RegistryException

Registry, as mentioned above is a singleton, and so all additions/manipulations made by any module are reflected for all of its consumers. It does not have any publically available fields, and so all interactions must take place via its methods:

getRegistry()

Returns a Javascript Map with keys of the resources available and values of a RegistryResource.

getRegistryCount()

Returns the number of entries in the Map above.

registerResource(resourceName)

Assigns a new RegistryResource to the Map above with the key "resourceName" and returns that RegistryResource.

getResource(resourceName)

Returns the RegistryResource with that key from the Map (or unassigned if the resource does not exist).

setRenderFunction(resourceName, fieldName, func)

This is a passthrough of the same method on a particular RegistryResource.

getRenderFunction(resourceName, fieldName)

This is a passthrough of the same method on a particular RegistryResource.


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

The templating parts below are not yet implemented and are likely to change as the project iterates forwards.


addViewAll(getAllPath)

This function sets a string field, which should reflect a basic URL path for a "view all" page for the resource. In the case of agreements it would be "/erm/agreements/"

addViewAllTemplate(template)

Sets a function field, 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 which will take an object representing the resource in question and wi

getViewAll()

saffsa

getViewAllTemplate()

adsgsdg

getViewTemplate()

dagag

addLookupComponent(component)

adgadgdsg

getLookupComponent()

asdgadgds

setRenderFunction(name, func)

dsgsdg

getRenderFunction(name)

sfahf