ppppub v0.1.1
Datapub
React-based framework for building data publishing flows (esp for CKAN). This application will communicate with ckanext-external-storage.
Prerequisites
Built with
Usage
There are several ways of using this library:
Automatically mount the app
Define a HTML element with id ResourceEditor
where the app will mounted. You also need to have data-dataset-id
and data-resource
attributes:
<div id="ResourceEditor" data-dataset-id="test-id" data-resource="{}"></div>
Where data-dataset-id
is an id of a CKAN dataset and data-resource
is a descriptor of a resource. When creating a new resource, you can just skip that attribute.
Explicitly mounting
You can also explicitly call a function to mount the app to specific place in your page:
const elementId = 'root';
const datasetId = 'test-id'
// Make sure the module is loaded first, otherwise, this function won't be available
mountResourceEditorApp(myElementId, datasetId);
Import specific components
Another way of using the library is to import specific components for your needs:
import React from 'react';
import { ResourceEditor } from 'datapub';
const MyComponent = (props) => {
return (
<ResourceEditor datasetId={} resource={} />
)
}
Developers
Install
First, clone the repo via git:
$ git clone git@github.com:datopian/datapub.git
And then install dependencies with npm.
$ cd datapub
$ npm install
Run
$ npm run start
Run the app in the development mode. Open http://localhost:3000/ to view it in the browser.
The page will reload if you make edits.
Storybook
Storybook is a tool that prepares a development environment for UI components. It allows you to develop and design your graphical interfaces quickly, isolated, and independently. Making it possible to define different states for components, thus documenting their states.
Note: Every push will run GitHub actions to deploy in GitHub pages. You can check online at https://datopian.github.io/datapub
Run storybook
$ npm run storybook
or
$ yarn storybook
Run Tests
$ npm test
or
$ yarn test
To run tests + coverage
$ yarn test:watch
Contributing
Please make sure to read the CONTRIBUTING.md Guide before making a pull request.
License
This project is licensed under the MIT License - see the LICENSE file for details