Commit bbab5166 authored by Axel Bocciarelli's avatar Axel Bocciarelli

Flatten config folder

parent 2aa60a4e
Pipeline #32495 failed with stage
in 3 minutes and 10 seconds
......@@ -17,7 +17,7 @@ Currently, datahub depends on:
- [Installation](#installation)
- [Configuration](#configuration)
- [Developments](#developments)
- [Development](#development)
# Installation
......@@ -39,11 +39,10 @@ Currently, datahub depends on:
Datahub configuration is spread among different files located in <kbd>src/config</kbd>. 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) : configuration file for the logbook (to be moved to config.js)
- [config.js](#configjs) : UI general configuration of the GUI
- `icat.js` - configure access to metadata catalogue
- `icatPlus.js` - configure access to ICAT+ server
- [`techniques.js`](#techniquesjs) - configure known techniques
- [`ui.js`](#uijs) - general UI configuration
Some of the configuration options in these files are stored in [environment variables](#environment-variables).
......@@ -61,7 +60,7 @@ The following portal configuration variables are declared in <kbd>.env</kbd>:
In development, you can override any of these variables by creating a file called `.env.local`. This file is ignored from version control.
## techniques.js
## `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.
......@@ -81,23 +80,12 @@ 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
```
<!--END configurationGUI -->
## ui.config.js
## `ui.js`
<!--START config -->
```js
var UI = {
const UI = {
status: {
offline: {
enabled: false,
......@@ -105,20 +93,21 @@ var UI = {
},
},
menu: {
applicationTittle: 'Data Portal',
applicationTitle: 'Data Portal',
isSearchVisible: true,
isClosedDataVisible: true,
isOpenDataVisible: true,
isMySelectionVisible: true,
},
sampleTracking: {
//** Makes visible or invisible the menus and tabs related to sample tracking */
enabled: true,
},
loginForm: {
header: '',
/** Text displayed on top of the username sigin form. Someone can customize the text as: User office account, ESRF Account, Umbrella account, etc... */
usernameLabel: 'Username',
sso: {
title: 'Sign in with SSO',
buttonText: 'ESRF SSO',
},
ssoBtnLabel: 'Sign in with ESRF SSO',
},
investigationContainer: {
isDatasetListVisible: true,
......@@ -147,11 +136,14 @@ var UI = {
* When it is set to false, the event list is not refreshed but the amount of new events which arriived is shown.*/
AUTOREFRESH_EVENTLIST: true,
/* Time interval between requests checking whether new events arrived. (in milliseconds) */
AUTOREFRESH_DELAY: 20000,
AUTOREFRESH_DELAY: 60000,
},
dangerousGoodsHelp:
'Please ensure you reply correctly to this question after consultation with your lab safety referent and/or the transport company. This question is for ESRF internal use only - you must correctly declare your parcel in the official transport documents',
footer: {
text: 'European Synchrotron Radiation Facility',
},
samplePageTemplateURL: 'https://smis.esrf.fr/misapps/SMISWebClient/protected/samplesheet/view.do?pk=',
};
export default UI;
......@@ -159,7 +151,7 @@ export default UI;
<!--END config -->
# Developments
# Development
- [Tests](#tests)
- [Code quality](#code-quality)
......
......@@ -2,7 +2,7 @@ import React, { useEffect } from 'react';
import { useSelector, useDispatch } from 'react-redux';
import { Route, Switch, Redirect, useLocation } from 'react-router-dom';
import Footer from './components/Footer';
import UI from './config/ui/config';
import UI from './config/ui';
import AddressesPage from './containers/AddressesPage';
import LoginPage from './containers/LoginPage';
import MyDataPage from './containers/MyDataPage';
......
import axios from 'axios';
import ICATPLUS from '../config/icat/icatPlus';
import ICATPLUS from '../config/icatPlus';
import {
LOGGED_IN,
LOGIN_ERROR,
......@@ -7,7 +7,7 @@ import {
LOG_OUT,
} from '../constants/actionTypes';
import keycloak from '../keycloak';
import ICAT from '../config/icat/icat';
import ICAT from '../config/icat';
export function doLogOut(params = { expired: false }) {
return { type: LOG_OUT, ...params };
......
import ICATPLUS from '../../config/icat/icatPlus';
import ICATPLUS from '../../config/icatPlus';
/** To be removed from here */
const IDS = {
......
......@@ -8,7 +8,7 @@ import {
} from '../../constants/parameterTypes';
import DOIBadge from '../doi/DOIBadge';
import ResponsiveTable from '../Table/ResponsiveTable';
import UI from '../../config/ui/config';
import UI from '../../config/ui';
class DataCollectionTable extends React.Component {
doiFormatter(cell) {
......
......@@ -2,7 +2,7 @@ import PropTypes from 'prop-types';
import React from 'react';
import { Glyphicon } from 'react-bootstrap';
import moment from 'moment';
import TECHNIQUES from '../../config/techniques/techniques';
import TECHNIQUES from '../../config/techniques';
import { FILE_COUNT, VOLUME } from '../../constants/parameterTypes';
import { getDatasetParameterByName, stringifyBytesSize } from '../../helpers';
import ResponsiveTable from '../Table/ResponsiveTable';
......
import React from 'react';
import { Badge, Panel, Tab, Tabs } from 'react-bootstrap';
import TECHNIQUES from '../../config/techniques/techniques';
import TECHNIQUES from '../../config/techniques';
import { FILE_COUNT } from '../../constants/parameterTypes';
import { getDatasetParameterByPrefixName } from '../../helpers';
import DatasetFileTree from '../File/DatasetFileTree';
......
import React from 'react';
import UI from '../config/ui/config';
import UI from '../config/ui';
import logo from '../images/ebs.gif';
import styles from './Footer.module.css';
......
......@@ -16,7 +16,7 @@ import {
LOCALSTORAGE_KEY_EDITED_EVENT_CONTENT_IN_PLAINTEXT_FORMAT,
LOCALSTORAGE_KEY_EDITED_EVENT_CONTENT_IN_HTML_FORMAT,
} from '../../../constants/eventTypes';
import UI from '../../../config/ui/config';
import UI from '../../../config/ui';
import { getFileByEventId, uploadFile } from '../../../api/icat/icatPlus';
const EDITOR_ID_FOR_CREATION = 'myEditorForCreation';
......
import PropTypes from 'prop-types';
import React from 'react';
import ReactPaginate from 'react-paginate';
import UI from '../../config/ui/config';
import UI from '../../config/ui';
/* This class handles the display of pages for the logbook */
class LogbookPager extends React.Component {
......
......@@ -14,7 +14,7 @@ import {
Row,
} from 'react-bootstrap';
import { GithubPicker } from 'react-color';
import UI from '../../../config/ui/config';
import UI from '../../../config/ui';
function renderPopoverColorPickerBottom(callback) {
return (
......
......@@ -2,7 +2,7 @@ import { intersectionWith } from 'lodash-es';
import PropTypes from 'prop-types';
import React from 'react';
import CreatableSelect from 'react-select/lib/Creatable';
import UI from '../../../config/ui/config';
import UI from '../../../config/ui';
class TagSelector extends React.Component {
constructor(props) {
......
import React from 'react';
import { Button } from 'react-bootstrap';
import ICAT from '../../config/icat/icat';
import ICAT from '../../config/icat';
import { doSignIn } from '../../actions/login';
import { useDispatch } from 'react-redux';
......
......@@ -8,7 +8,7 @@ import {
FormGroup,
ControlLabel,
} from 'react-bootstrap';
import UI from '../../config/ui/config';
import UI from '../../config/ui';
import ErrorUserMessage from '../UserMessages/ErrorUserMessage';
import AnonymousSignIn from './AnonymousSignIn';
import { useSelector, useDispatch } from 'react-redux';
......
import React from 'react';
import { Panel, Tab, Tabs } from 'react-bootstrap';
import ICAT from '../../config/icat/icat';
import ICAT from '../../config/icat';
import SSO from './SSO';
import LoginForm from './LoginForm';
......
import React from 'react';
import UI from '../../config/ui/config';
import UI from '../../config/ui';
import Loader from '../Loader';
import ErrorUserMessage from '../UserMessages/ErrorUserMessage';
import AnonymousSignIn from './AnonymousSignIn';
......@@ -49,7 +49,7 @@ function SSO() {
bsSize="large"
onClick={handleClick}
>
{UI.loginForm.sso.title}
{UI.loginForm.ssoBtnLabel}
</Button>
<AnonymousSignIn />
......
......@@ -2,7 +2,7 @@ import React from 'react';
import { Glyphicon, Nav, Navbar, NavDropdown, NavItem } from 'react-bootstrap';
import { LinkContainer } from 'react-router-bootstrap';
import { Link } from 'react-router-dom';
import UI from '../../config/ui/config';
import UI from '../../config/ui';
import BreadCrumbs from '../Breadcrumbs/BreadCrumbs';
import ManagerMenu from './ManagerMenu';
import keycloak from '../../keycloak';
......
import React, { useState } from 'react';
import { Alert, Button, HelpBlock, Modal } from 'react-bootstrap';
import { useForm } from 'react-hook-form';
import UI from '../../config/ui/config';
import UI from '../../config/ui';
function DangerousGoodsModal(props) {
const { onConfirm, onCloseModal, isProcessing } = props;
......
......@@ -3,7 +3,7 @@ import { Badge, Glyphicon, Nav, NavItem } from 'react-bootstrap';
import { useSelector } from 'react-redux';
import { useParams } from 'react-router';
import { LinkContainer } from 'react-router-bootstrap';
import UI from '../../config/ui/config';
import UI from '../../config/ui';
function TabContainerMenu(props) {
const { doi } = props;
......
const ICAT_PLUS = {
const ICATPLUS = {
/** URL of ICAT+ server */
server: process.env.REACT_APP_ICATPLUS_URL,
};
export default ICAT_PLUS;
export default ICATPLUS;
const ALIAS = {
const PARAMETERS = {
InstrumentMonochromator_energy: 'Energy',
InstrumentMonochromator_wavelength: 'Wavelength',
InstrumentMonochromatorCrystal_d_spacing: 'd_spacing',
......@@ -7,4 +7,4 @@ const ALIAS = {
InstrumentMonochromatorCrystal_usage: 'Usage',
};
export default ALIAS;
export default PARAMETERS;
......@@ -20,10 +20,7 @@ const UI = {
header: '',
/** Text displayed on top of the username sigin form. Someone can customize the text as: User office account, ESRF Account, Umbrella account, etc... */
usernameLabel: 'Username',
sso: {
title: 'Sign in with ESRF SSO',
buttonText: 'ESRF SSO', // deprecated
},
ssoBtnLabel: 'Sign in with ESRF SSO',
},
investigationContainer: {
isDatasetListVisible: true,
......
......@@ -16,7 +16,7 @@ import NewOrEditEventPanel from '../../components/Logbook/NewOrEditEventPanel';
import OverlayBox from '../../components/Logbook/OverlayBox';
import PublicEventPanel from '../../components/Logbook/PublicEventPanel';
import UserMessage from '../../components/UserMessage';
import UI from '../../config/ui/config';
import UI from '../../config/ui';
import {
ERROR_MESSAGE_TYPE,
INFO_MESSAGE_TYPE,
......
import escapeStringRegexp from 'escape-string-regexp';
import UI from '../../config/ui/config';
import UI from '../../config/ui';
import { DOC_VIEW } from '../../constants/eventTypes';
import moment from 'moment';
......
......@@ -4,7 +4,7 @@ import maintenanceImage from '../images/maintenance.jpg';
import maintenanceImage2 from '../images/maintenance2.jpg';
import maintenanceImage3 from '../images/maintenance3.jpg';
import maintenanceImage4 from '../images/maintenance4.jpg';
import UI from '../config/ui/config';
import UI from '../config/ui';
import Menu from '../components/Menu/Menu';
import Footer from '../components/Footer';
......
......@@ -12,8 +12,8 @@ import { Col, Grid, Label, Row } from 'react-bootstrap';
import { connect } from 'react-redux';
import { setBreadCrumbs } from '../actions/breadcrumbs';
import { getFileByEventId } from '../api/icat/icatPlus';
import ICATPLUS from '../config/icat/icatPlus';
import TECHNIQUES from '../config/techniques/techniques';
import ICATPLUS from '../config/icatPlus';
import TECHNIQUES from '../config/techniques';
import { stringifyBytesSize } from '../helpers';
import { INVESTIGATION_DATE_FORMAT } from '../constants';
......
......@@ -2,7 +2,7 @@ import moment from 'moment';
import { store } from '../store';
import { doLogOut, doSignIn } from '../actions/login';
import keycloak from '../keycloak';
import ICAT from '../config/icat/icat';
import ICAT from '../config/icat';
export function getRemainingSessionTime(expirationTime) {
return moment(expirationTime).diff(moment());
......
......@@ -4,8 +4,9 @@ import {
ITEM_TYPES,
ITEM_TYPE_DEFS,
} from '../constants';
import ALIAS from '../config/parameters/alias';
import uiConfig from '../config/ui/config';
import uiConfig from '../config/ui';
import PARAMETERS from '../config/parameters';
export function filterInvestigations(investigations, predicate) {
return {
......@@ -32,7 +33,7 @@ export function getDatasetParameterByPrefixName(dataset, prefix) {
const parameters = JSON.parse(JSON.stringify(dataset.parameters));
return parameters
.filter((p) => p.name.startsWith(prefix))
.map((p) => ({ ...p, name: ALIAS[p.name] || p.name }));
.map((p) => ({ ...p, name: PARAMETERS[p.name] || p.name }));
}
export function getDatasetParameterValueByName(dataset, name) {
......
import Keycloak from 'keycloak-js';
import ICAT from './config/icat/icat';
import ICAT from './config/icat';
const keycloak = ICAT.authentication.sso.enabled
? new Keycloak(ICAT.authentication.sso.configuration)
......
import { Resource } from 'rest-hooks';
import ICATPLUS from '../config/icat/icatPlus';
import ICATPLUS from '../config/icatPlus';
import { store } from '../store';
export default class AddressResource extends Resource {
......
import { Resource } from 'rest-hooks';
import ICATPLUS from '../config/icat/icatPlus';
import ICATPLUS from '../config/icatPlus';
import { store } from '../store';
export default class ItemResource extends Resource {
......
import { Resource } from 'rest-hooks';
import ICATPLUS from '../config/icat/icatPlus';
import ICATPLUS from '../config/icatPlus';
import { store } from '../store';
import AddressResource from './address';
......
import { Resource } from 'rest-hooks';
import ICATPLUS from '../config/icat/icatPlus';
import ICATPLUS from '../config/icatPlus';
import { store } from '../store';
export default class SampleResource extends Resource {
......
import { Resource } from 'rest-hooks';
import ICATPLUS from '../config/icat/icatPlus';
import ICATPLUS from '../config/icatPlus';
import { store } from '../store';
import AddressResource from './address';
......
......@@ -19,7 +19,7 @@ export default function getUIConfiguration(config) {
isMySelectionVisible: true,
},
loginForm: {
text: "Sign in with your ESRF's user account",
header: "Sign in with your ESRF's user account",
},
investigationContainer: {
isDatasetListVisible: true,
......
......@@ -10,7 +10,7 @@ import {
updateTagsByInvestigationId,
uploadFile,
} from '../../api/icat/icatPlus';
import ICATPLUS from '../../config/icat/icatPlus';
import ICATPLUS from '../../config/icatPlus';
describe('Tests URL generation used to hit ICAT+', () => {
describe('Events', () => {
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment