Skip to content

BLSQ/blsq-report-components

Repository files navigation

blsq-report-components

blsq-report-components

NPM JavaScript Style Guide Build Status

Install

yarn add "@blsq/blsq-report-components"

or if you are more extreme, living on the edge, use the github repo and yarn

yarn add https://github.com/BLSQ/blsq-report-components

Usage

Sorry we don't have yet documentation.

This is a skeleton app component where you can contribute custom routes, invoices & reports.

Sample invoice app

Your best chance is to look at the code and running the example app:

It's now "plugin" based.

a npm module can contain several plugins

  • invoices : orgunit selector and specific plugin can contribute "invoices" to it
  • incentives : a special data entry to fill in incentives for a pbf (seeing future and past values in the same screen)
  • contracts : dhis2 contract management (stored as event, allowing a kind of versionning of groups)
  • dataentry : can contribute custom data entry (optionally linked to hesabu)
  • browsedata : allow clients to access their data (through datavaluesets api, no analytics required)

then a specific plugins can "configure/define/wire" all these plugins into a working pbf manager. see https://github.com/BLSQ/blsq-report-specific-sandox

the plugin system allows theses plugins to contribute to each others

core plugin contributions

 "core.dhis2": [dhis2], // some dhis2 need extra config, enforce https, use categoryCombo for multipayer scheme,...
 "core.routes": [defaultRoute], // all plugins contributes to this, by adding their own routes
 "core.headerRoutes": [customHeader] // plugins can fill the header with custom components depending of their needs.
 "core.drawerLinks": [DrawerLinks], // left menu content in the app
 "core.config": [config],  // general config for date formatting,...
 "core.i18n": [i18n],   // translations, containing the default but can provide their own

invoices plugin contributions

"invoices.invoices": [Invoices] // specific code contributing invoices to orgunit based on their contracts or groups and invoice templates/components
"invoices.actions": [BackBtn, Contract]   //
"invoices.orgUnitsResolver" : [new ContractBasedResolver()] // specific code to lookup orgunits for  eg consolidated invoices
"invoices.selectionLinks" : [ContractLink, DataEntryLink]  // when in orgunit selection page, show extra content (not only invoices, eg contrat or data entry links, receive orgUnit and period as props)

contracts plugin contributions

"contracts.config": [
    {
    programId: "xxx",
    allEventsSqlViewId: "xxxyyyy"
    }
],
"contracts.validator":  // custom validator for contract, field cross validation see

see DefaultValidator

dataentry plugin contributions

"dataentry.dataEntries": [DataEntries]  // same role as for invoices but for data entry : which data entry is allowed per orgunit and which component, should be used.

Allowing contribution points or access contributed items

if it's code or config data you can access it

import { PluginRegistry } from "@blsq/blsq-report-components";

const i18n = PluginRegistry.extension("core.i18n");

const contractService = PluginRegistry.extension("contracts.service");

if its a component you can drop that in your jsx all the "core.drawerLinks" will be fetched

<ExtensionsComponent extensionKey="core.drawerLinks" {...props} />

Development

git clone git@github.com:BLSQ/blsq-report-components.git
cd blsq-report-components
yarn install
yarn test
yarn link
yarn start
cd example
yarn start
yarn link @blsq/blsq-report-components
yarn link ../node_modules/react

you might need to upgrade jest snapshots (assertion based on latest recorded data)

yarn test -- --updateSnapshot

Release

  1. Adapt the CHANGELOG.md
  2. Release the package on npm
yarn publish
  1. Update downstream application using it : https://bitbucket.org/bluesquare_org/report-inventory/src/master/

License

MIT © BLSQ

About

blsq-report-components

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published