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.

...

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.

...

Code Block
agreementReg.setRenderFunction('currentPeriodStartDate', record => {
  const date = record.periods.find(p => p.periodStatus === 'current')?.startDate;
  return date ?
    <FormattedUTCDate value={date} /> :
    <NoValue />;
});

This function takes in an agreement record, and then finds a period from the array "periods" with a "periodStatus" of 'current'. It then returns that as a FormattedUTCDate.

In this way, ui-agreements can specify the method of returning a value for "currentPeriodStartDate", and other modules can consume that, cutting down on repeated code. Furthermore, it can be used in modules such as dashboard to allow for dynamic rendering of complicated object fields without ui-dashboard needing to be aware of anything about that object or its structure.

getRenderFunction(name)

...

This method returns the renderFunction for a given name as above.



Warning

The methods above for templating and customRendering 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. 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.

Future work

The largest changes