Newer
Older
Maxime Chaillet
committed
# datahub
datahub is a frontend available as a [Node.js](https://nodejs.org/en/) package. It is based on the [React](https://reactjs.org/) framework. Through a web interface, this application provides:
- a user authentication portal
- a GUI for scientific metadata management
- a GUI for the electronic logbook which can complement data
- experimental data downloading feature
- manual DOI minting feature
Currently, datahub depends on:
- ICAT+ package. ICAT+ is the backend which stores logbook events
- [ICAT](https://icatproject.org) metadata catalogue. ICAT stores metadata and handles the user authentication mechanism
# Menu
1. [Installation](#installation)
2. [Configuration](#configuration)
3. [Developments](#developments)
# Installation
## Prerequisite:
Maxime Chaillet
committed
1. Make sure the dependencies mentioned above are installed and properly configured.
Maxime Chaillet
committed
## Installation procedure
1. Download the source code from [gitlab](https://gitlab.esrf.fr/icat/E-DataPortal) repository
Maxime Chaillet
committed
2. Install dependencies
Maxime Chaillet
committed
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
```bash
npm install
```
3. Configure datahub app. See this [section](#configuration).
4. Run the app
```bash
npm start
```
# Configuration
Datahub configuration is spread among different files located in the folder **src/config**. These files are:
- [icat.js](#icatjs) : configure access to the metadata catalogue.
- [icatPlus.js](#icatplusjs) : configure access to the ICAT+ server
- [techniques.js](#techniquesjs) : configure the known techniques
- [gui.config.js](#guiconfigjs) : configure datahub GUI
Example files for [icat.js](src/config/icat/icat.example.js) and [icatPlus.js](src/config/icat/icatPlus.example.js) are provided and needs to be copied in configuration file:
```bash
cp src/config/icat/icat.example.js src/config/icat/icat.js
cp src/config/icat/icatPlus.example.js src/config/icat/icatPlus.js
```
## icat.js
Edit the file **icat.js** with your favorite text editor and set the configuration to access the metadata catalogue following the indications below.
<!--START configurationICAT -->
```js
/**
* icat.example.js configuration file
*/
var ICAT =
{
/** URL of the metadata catalogue */
server: "https://icat.esrf.fr",
/** Connexion settings for none anonymous users */
connection: {
/** ICAT plugin used for authentication. */
plugin: 'esrf'
},
/** Anonymous user's credentials*/
anonymous: {
/** ICAT plugin used for authentication. */
plugin: '**',
/** Username for the anonymous user */
username: '***',
/** Password for the anonymous user */
password: '****'
}
};
export default ICAT;
```
<!--END configurationICAT -->
## icatPlus.js
Edit the file **icatPlus.js** with your favorite text editor and set the configuration to access the ICAT+ application following the indications below.
<!--START configurationICATPlus -->
```js
/**
* icatPlus.example.js configuration file
*/
var ICATPLUS =
{
/** URL of ICAT+ server */
server: "http://lindemaria.esrf.fr:8000",
};
export default ICATPLUS;
```
<!--END configurationICATPlus -->
## techniques.js
The file [techniques.js](src/config/techniques/techniques.js) complements short named techniques as stored in ICAT metadata catalogue. It maps a short name to a description and display settings.
To add a new technique, use the following object to fully define the technique.
```js
/** Object defining the new technique */
{
/** Full name of the technique */
name: "Ptychography",
/** Short name of the technique as stored in ICAT */
shortname: "PTYCHO",
/** Full description of the technique */
description: "Ptychography is a technique invented by Walter Hoppe that aims to solve the diffraction-pattern phase problem by interfering adjacent Bragg reflections coherently and thereby determine their relative phase.",
/** Font color */
color: "#97E0FE"
},
```
## gui.config.js
Edit the file [gui.config.js](src/config/gui.config.js) with your favorite text editor and set the GUI configuration following the indications below.
<!--START configurationGUI -->
```js
/**
* gui.config.js
* GUI configuration file
*/
export function GUI_CONFIG() {
return {
/** Number of logbook events to display per page. EVENTS_PER_PAGE should be lower than EVENTS_PER_DOWNLOAD */
EVENTS_PER_PAGE: 200,
/** Maximum number of logbook events downloaded from the server. This enables to store a larger set of
events than those required for a single page thus reducing HTTP requests to the server. */
EVENTS_PER_DOWNLOAD: 400,
/** Default sorting filter for logbook events.
The format:
{ nameOftheMongoDBFieldToSortAgainst : theSortingOrder }
Possible values for **sortingOrder**:
1, for an ascending sorting of nameOftheMongoDBFieldToSortAgainst
-1, for a descending sorting of nameOftheMongoDBFieldToSortAgainst
*/
DEFAULT_SORTING_FILTER: {
createdAt: -1
},
/** Panel maximum height during logbook event creation */
NEW_EVENT_MAX_HEIGHT: "500px",
Maxime Chaillet
committed
/* Default tag color used in the logbook when tag color is not set */
DEFAULT_TAG_COLOR: "#a6bded"
Maxime Chaillet
committed
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
}
}
```
<!--END configurationGUI -->
# Developments
- [Widgets](#Widgets)
- [ResponsiveTable](#responsivetable)
- [Loader](#loader)
## Widgets
### ResponsiveTable
This widget is based on react-bootstrap-table2 (https://react-bootstrap-table.github.io/react-bootstrap-table2/) but adds responsiveness.
Columns can now be configured based on the size of the device as bootstrap does (xs, sm, md, lg)
Configuration:
```js
const columns = [{
text: 'Proposal',
dataField: 'name',
headerStyle: (column, colIndex) => {
return { width: '50%', textAlign: 'center' };
},
responsiveHeaderStyle: {
xs : {width: '20%', textAlign: 'center' },
sm : {width: '50%', textAlign: 'center' },
md : {width: '70%', textAlign: 'center' },
lg : {width: '90%', hidden : true, textAlign: 'center' }
}
}]
var pageOptions = {
showTotal : true,
hidePageListOnlyOnePage : true,
sizePerPageList: [ {
text: '5', value: 5
}, {
text: '10', value: 10
}, {
text: 'All', value: data.length
} ]
};
<ResponsiveTable
keyField='id'
data={data }
columns={columns}
pageOptions={pageOptions}
/>
```
If there is no responsiveHeaderStyle then headerStyle will be used as default. If there is no the used screen size (xs, sm, md, lg) configured in the responsiveHeaderStyle attribute then headerStyle will be used by default.
### Loader
It informs users that data are still been loaded
```js
import Loader from 'react-loader-advanced';
const message = <span>Loading list of authors</span>;
<Loader show={this.state.fetching} message={message}>
<some components>
</Loader>