This is a JavaScript helpers module that supports external AJAX Apps like the Map Component or the Table Component that are embedded as External iFrame into the CLARITY CSIS Drupal Site to communicate with the CSIS Drupal API and the AIT EMIKAT API.
The module exports the following libraries:
- CSISHelpers: Methods to extract Resources assigned to specific taxonomies from the Data Package associated with a specific Study. This is e.g. used by the HazardMap to create map layers from hazard characterization resources and group them according to the Hazards Taxonomy.
- CSISRemoteHelpers: Methods to support the communication with the Drupal API. In particular provides convenient access to Data Packages, Studies, etc.
- EMIKATHelpers: Methods for communicating with the EMIKAT API. In particular, support the parametrisation of template URLs with values from the variables taxonomy, e.g.
time_period
andemissions_scenario
.
Unit Tests are executed against a local express.js server which emulates some of the APIs. Testing against the remote CSIS is performed when the ENV file .env.test.local
with the following ENV vars is available in the repository root:
- ORIGIN=http://localhost:3000 # access-control-allow-origin as specified in CSIS Drupal /web/sites/default/settings.php
- CSIS_USERNAME=
- CSIS_PASSWORD=
Note: Unit tests are performed using both the libraries in src and the bundled module dist.
The application uses a rollup.js-based build process that bundles the source files as ES6 modules which can be easily imported into other applications. Node v12.x and yarn v1.x has to be installed locally.
Building and installing the module is straightforward:
yarn install
yarn build
yarn test
The dev branch is automatically built on cismet CI based on this pipeline definition.
The module is not published in any registry, it can be installed directly from GitHub. Of course, a respective release (tag) has to exist. The release version can be referenced in the dependencies section of package.json
as follows
"csis-helpers-js": "git://github.com/clarity-h2020/csis-helpers-js.git#semver:^0.6.5",
MIT © cismet GmbH