0.5.4 • Published 3 years ago

@statisticsnorway/dapla-variable-search v0.5.4

Weekly downloads
16
License
Apache-2.0
Repository
github
Last release
3 years ago

dapla-variable-search

npm version Build Status

This application is built for in-house use in Statistics Norway and it aims to create a smart and interactive variable and dataset search with the help of the graphql-api exposed by Linked Data Store.

Functionality includes:

  • Searching through variables and datasets
  • Listing connections between variables and datasets (which datasets use which variables and vice versa)

The project makes limited use of the ssb-component-library and is based upon react-reference-app.

Use as a library

If you want to use this application as a library in your project, simply add it with yarn.

yarn add @statisticsnorway/dapla-variable-search

The component requires a few peer dependencies to work, namely:

  • @statisticsnorway/dapla-js-utilities
  • axios-hooks
  • graphql-hooks
  • React
  • SemanticUI

In your application import the component.

import { VariableSearch } from '@statisticsnorway/dapla-variable-search'

The component needs two properties to function correctly, lineageUrl and language.

<VariableSearch lineageUrl='http://localhost:3001' language='en' />

lineageUrl is the base url for creating links to a dapla-lineage-viewer and language sets the language of the component. en (English) and nb (Norwegian) is available.

In your application housing this component you also need to set up graphql-hooks in a React Context. You can checkout how to do it in /src/utilities/ContextHandling.js in this project. This is done because the component needs several instances of graphql-hooks to run, and without setting up a GraphQLClient that, is impossible.

Try this application locally

The first time you clone the repository, remember to run yarn or yarn install.

Run yarn start and navigate to http://localhost:3000/.

yarn test runs all tests and yarn coverage calculates (rather unreliably) test coverage.

Docker locally

  • yarn build
  • docker build -t dapla-variable-search .
  • docker run -p 8000:80 dapla-variable-search:latest
    • Alternatively with custom environment variables: docker run -p 8000:80 -e REACT_APP_API=http://localhost:29090 dapla-variable-search:latest
  • Navigate to http://localhost:8000

Note that this application requires dapla-project (localstack) running to function locally (or atleast a running instance of Linked Data Store). It also needs a running instance of dapla-lineage-viewer running for the lineage links to work.

Publish library

To publish to npm you need a user and a membership in the statisticsnorway organization on npm. The user must also have 2FA authentication enabled. Steps to follow:

  1. Login into your npm account in a terminal with npm login
  2. Make sure all tests works (test components in the example application aswell, if you made a new one)
  3. Bump version in package.json
  4. Run yarn package
  5. Dry run a release with npm pack
  6. Publish with npm publish --access public --otp=<code> (<code> is your 2FA code, without <>)
0.5.4

3 years ago

0.5.3

3 years ago

0.5.2

3 years ago

0.5.1

3 years ago

0.5.0

4 years ago

0.4.6

4 years ago

0.4.5

4 years ago

0.4.4

4 years ago

0.4.3

4 years ago

0.4.2

4 years ago

0.4.1

4 years ago

0.4.0

4 years ago

0.3.1

4 years ago

0.3.0

4 years ago

0.2.1

4 years ago

0.2.0

4 years ago