It improves #145

parent e7595f0a
...@@ -14,12 +14,8 @@ import SearchContainer from './containers/SearchContainer.js'; ...@@ -14,12 +14,8 @@ import SearchContainer from './containers/SearchContainer.js';
import SelectionContainer from './containers/Selection/SelectionContainer.js'; import SelectionContainer from './containers/Selection/SelectionContainer.js';
import MintSelectionContainer from './containers/Selection/MintSelectionContainer.js'; import MintSelectionContainer from './containers/Selection/MintSelectionContainer.js';
import Footer from './components/Footer.js'; import Footer from './components/Footer.js';
import _ from 'lodash';
import { BrowserRouter as Router, Route } from "react-router-dom"; import { BrowserRouter as Router, Route } from "react-router-dom";
import TagContainer from './containers/TagContainer'; import TagContainer from './containers/TagContainer';
import { fetchDatasetsByDOI } from './actions/datasets.js';
import { TAG_MANAGER_CONTEXT } from './constants/EventTypes'; import { TAG_MANAGER_CONTEXT } from './constants/EventTypes';
class App extends Component { class App extends Component {
...@@ -61,19 +57,6 @@ class App extends Component { ...@@ -61,19 +57,6 @@ class App extends Component {
class WelcomePage extends React.Component {
render() {
return (
<div>
<MenuContainer />
<LoginContainer />
<ExpirationLoginContainer></ExpirationLoginContainer>
</div>
);
}
}
class DOIPage extends React.Component { class DOIPage extends React.Component {
render() { render() {
return ( return (
...@@ -217,8 +200,7 @@ class OpenDataPage extends React.Component { ...@@ -217,8 +200,7 @@ class OpenDataPage extends React.Component {
<Panel.Body> <Panel.Body>
<InvestigationsContainer <InvestigationsContainer
linkProposal={false} linkProposal={false}
investigations={this.props.releasedInvestigations} investigations={this.props.releasedInvestigations}
linkProposal={true}
closedData={false} closedData={false}
/> />
</Panel.Body> </Panel.Body>
......
import React from 'react'; import React from 'react';
import { BootstrapTable, TableHeaderColumn } from 'react-bootstrap-table';
import { Grid, Row, Col,Label, Glyphicon } from 'react-bootstrap'; import { Grid, Row, Col,Label, Glyphicon } from 'react-bootstrap';
import { Link } from 'react-router-dom'; import { Link } from 'react-router-dom';
import Loading from '../../components/Loading.js';
import DOIBadge from '../../components/doi/DOIBadge.js'; import DOIBadge from '../../components/doi/DOIBadge.js';
import _ from 'lodash'; import _ from 'lodash';
import { TITLE, INVESTIGATION_NAMES, INSTRUMENT_NAMES } from '../../constants/ParameterTypes.js'; import { TITLE, INVESTIGATION_NAMES, INSTRUMENT_NAMES } from '../../constants/ParameterTypes.js';
......
...@@ -9,7 +9,6 @@ class DatasetMetadataTab extends React.Component { ...@@ -9,7 +9,6 @@ class DatasetMetadataTab extends React.Component {
} }
getColumns(){ getColumns(){
return [ return [
{ {
text: "id", text: "id",
...@@ -53,29 +52,15 @@ class DatasetMetadataTab extends React.Component { ...@@ -53,29 +52,15 @@ class DatasetMetadataTab extends React.Component {
} }
render() { render() {
const options = {
paginationSize: 10,
sizePerPage: 10,
paginationShowsTotal: true,
hidePageListOnlyOnePage: true
};
/** Data sorted by name */ /** Data sorted by name */
let data = this.props.dataset.parameters.sort((a, b) => a.name.localeCompare(b.name, undefined, {sensitivity: 'base'})); let data = this.props.dataset.parameters.sort((a, b) => a.name.localeCompare(b.name, undefined, {sensitivity: 'base'}));
return <div style={{ 'margin': '20px'}}> return <div style={{ 'margin': '20px'}}>
<ResponsiveTable <ResponsiveTable
keyField="id" keyField="id"
data={ data } data={ data }
columns={ this.getColumns() } columns={ this.getColumns() }
/></div>; /></div>;
} }
} }
......
...@@ -6,7 +6,6 @@ import axios from "axios"; ...@@ -6,7 +6,6 @@ import axios from "axios";
import Moment from 'react-moment'; import Moment from 'react-moment';
import TECHNIQUES from '../../config/techniques/techniques.js'; import TECHNIQUES from '../../config/techniques/techniques.js';
import Loading from '../../components/Loading.js'; import Loading from '../../components/Loading.js';
import { BootstrapTable, TableHeaderColumn } from 'react-bootstrap-table';
import { getDatasetStatus } from "../../api/icat/icatPlus.js" import { getDatasetStatus } from "../../api/icat/icatPlus.js"
import { stringifyBytesSize } from "../Helpers.js" import { stringifyBytesSize } from "../Helpers.js"
import { VOLUME, FILE_COUNT } from '../../constants/ParameterTypes.js'; import { VOLUME, FILE_COUNT } from '../../constants/ParameterTypes.js';
...@@ -52,7 +51,7 @@ class DatasetTable extends React.Component { ...@@ -52,7 +51,7 @@ class DatasetTable extends React.Component {
downloadFormatter(cell, dataset, rowIndex, extraData) { downloadFormatter(cell, dataset, rowIndex, extraData) {
let dataArchived = extraData.getParameter(dataset, "__dataArchived"); let dataArchived = extraData.getParameter(dataset, "__dataArchived");
if (dataArchived == "False") { if (dataArchived === "False") {
return "N/A"; return "N/A";
} }
return <DownloadButton sessionId={extraData.props.sessionId} id={dataset.id} ></DownloadButton>; return <DownloadButton sessionId={extraData.props.sessionId} id={dataset.id} ></DownloadButton>;
...@@ -212,14 +211,6 @@ class DatasetTable extends React.Component { ...@@ -212,14 +211,6 @@ class DatasetTable extends React.Component {
return <Loading message="Loading datasets"></Loading>; return <Loading message="Loading datasets"></Loading>;
} }
const options = {
paginationSize: 10,
sizePerPage: 200,
paginationShowsTotal: true,
hidePageListOnlyOnePage: true
};
const selectRow = { const selectRow = {
mode: 'checkbox', mode: 'checkbox',
clickToSelect: false, clickToSelect: false,
...@@ -352,7 +343,7 @@ class DownloadButton extends React.Component { ...@@ -352,7 +343,7 @@ class DownloadButton extends React.Component {
render() { render() {
var downloadURL = getDownloadURLByDatasetId(this.props.sessionId, this.props.id); var downloadURL = getDownloadURLByDatasetId(this.props.sessionId, this.props.id);
if (this.state.status == 'ONLINE') { if (this.state.status === 'ONLINE') {
return <a style={{ color: 'black' }} href={downloadURL}> return <a style={{ color: 'black' }} href={downloadURL}>
<Button bsStyle="primary" bsSize="xsmall"> <Button bsStyle="primary" bsSize="xsmall">
<span className="glyphicon glyphicon-download-alt"></span> <span className="glyphicon glyphicon-download-alt"></span>
...@@ -361,7 +352,7 @@ class DownloadButton extends React.Component { ...@@ -361,7 +352,7 @@ class DownloadButton extends React.Component {
</a>; </a>;
} }
if (this.state.status == 'RESTORING') { if (this.state.status === 'RESTORING') {
return <a style={{ color: 'black' }} href={downloadURL}> return <a style={{ color: 'black' }} href={downloadURL}>
<Button variant="dark" bsSize="xsmall" > <Button variant="dark" bsSize="xsmall" >
<span bsSize="xsmall" className="glyphicon glyphicon-repeat fast-right-spinner"></span> <span bsSize="xsmall" className="glyphicon glyphicon-repeat fast-right-spinner"></span>
...@@ -370,20 +361,18 @@ class DownloadButton extends React.Component { ...@@ -370,20 +361,18 @@ class DownloadButton extends React.Component {
</a>; </a>;
} }
if (this.state.status == 'ARCHIVED') { if (this.state.status === 'ARCHIVED') {
return <Button variant="light" bsSize="xsmall" onClick={(e) => { this.restore(e) }}> return <Button variant="light" bsSize="xsmall" onClick={(e) => { this.restore(e) }}>
<span style={{ color: 'black' }} className="glyphicon glyphicon-tasks"></span> <span style={{ color: 'black' }} className="glyphicon glyphicon-tasks"></span>
<span style={{ color: 'black', marginLeft: '10px' }} >Restore</span> <span style={{ color: 'black', marginLeft: '10px' }} >Restore</span>
</Button>; </Button>;
} }
if (this.state.status == 'FETCHING') { if (this.state.status === 'FETCHING') {
return <span><span style={{ marginLeft: '10px' }} className="glyphicon glyphicon-repeat fast-right-spinner"></span></span>; return <span><span style={{ marginLeft: '10px' }} className="glyphicon glyphicon-repeat fast-right-spinner"></span></span>;
} }
return <span>{this.state.status}</span>; return <span>{this.state.status}</span>;
} }
}; };
......
...@@ -39,7 +39,7 @@ class DatasetWidget extends React.Component { ...@@ -39,7 +39,7 @@ class DatasetWidget extends React.Component {
if (definition){ if (definition){
if (definition.length > 0){ if (definition.length > 0){
if (definition[0].value == "Publication"){ if (definition[0].value === "Publication"){
return <PublicationSummary dataset={dataset} sessionId={this.props.sessionId} ></PublicationSummary>; return <PublicationSummary dataset={dataset} sessionId={this.props.sessionId} ></PublicationSummary>;
} }
} }
......
import React from 'react'; import React from 'react';
import Moment from 'react-moment';
import { Grid, Row, Col, Image } from 'react-bootstrap'; import { Grid, Row, Col, Image } from 'react-bootstrap';
import './PublicationSummary.css'; import './PublicationSummary.css';
import { getFileByEventId } from '../../../api/icat/icatPlus.js'; import { getFileByEventId } from '../../../api/icat/icatPlus.js';
class PublicationSummary extends React.Component { class PublicationSummary extends React.Component {
componentDidMount() {
}
getImageFromGalleyByIndex(index) { getImageFromGalleyByIndex(index) {
/** Checking gallery **/ /** Checking gallery **/
var gallery = this.props.dataset.parameters.filter(function (o) { return o.name === "ResourcesGallery" }); var gallery = this.props.dataset.parameters.filter(function (o) { return o.name === "ResourcesGallery" });
...@@ -25,7 +18,6 @@ class PublicationSummary extends React.Component { ...@@ -25,7 +18,6 @@ class PublicationSummary extends React.Component {
} }
} }
return null; return null;
} }
getParameterValue(name){ getParameterValue(name){
......
...@@ -3,44 +3,44 @@ import { getDatasetParameterByName, getDatasetParameterByPrefixName } from '../. ...@@ -3,44 +3,44 @@ import { getDatasetParameterByName, getDatasetParameterByPrefixName } from '../.
import ParameterTableWidget from './ParameterTableWidget.js'; import ParameterTableWidget from './ParameterTableWidget.js';
class InstrumentDetectorWidget extends React.Component { class InstrumentDetectorWidget extends React.Component {
constructor(props) {
super(props);
}
getDetectorWidget(index){ getDetectorWidget(index){
var parameters = getDatasetParameterByPrefixName(this.props.dataset, "InstrumentDetector0" + index); var parameters = getDatasetParameterByPrefixName(this.props.dataset, "InstrumentDetector0" + index);
if (parameters){ if (parameters){
if (parameters.length > 0){ if (parameters.length > 0){
return <DetectorWidget return <DetectorWidget
detectorIndex={index} detectorIndex={index}
name = {getDatasetParameterByName(this.props.dataset, "InstrumentDetector0" + index + "_name")} name = {getDatasetParameterByName(this.props.dataset, "InstrumentDetector0" + index + "_name")}
positionersValue = {getDatasetParameterByName(this.props.dataset, "InstrumentDetector0" + index + "Positioners_value")} positionersValue = {getDatasetParameterByName(this.props.dataset, "InstrumentDetector0" + index + "Positioners_value")}
positionersName = {getDatasetParameterByName(this.props.dataset, "InstrumentDetector0" + index + "Positioners_name")} positionersName = {getDatasetParameterByName(this.props.dataset, "InstrumentDetector0" + index + "Positioners_name")}
positionersRoisValue = {getDatasetParameterByName(this.props.dataset, "InstrumentDetector0" + index + "PositionersRois_value")} positionersRoisValue = {getDatasetParameterByName(this.props.dataset, "InstrumentDetector0" + index + "PositionersRois_value")}
positionersRoisName = {getDatasetParameterByName(this.props.dataset, "InstrumentDetector0" + index + "PositionersRois_name")} positionersRoisName = {getDatasetParameterByName(this.props.dataset, "InstrumentDetector0" + index + "PositionersRois_name")}
></DetectorWidget>; ></DetectorWidget>;
} }
} }
} }
render(){ render(){
var detectors = []; var detectors = [];
for(var i = 1; i < 10; i++){ for(var i = 1; i < 10; i++){
var detector = this.getDetectorWidget(i); var detector = this.getDetectorWidget(i);
if (detector){ if (detector){
detectors.push(detector); detectors.push(detector);
} }
} }
return <div className="container-fluid"> if (detectors.length == 0){
<h3>Detectors</h3> return null;
<div className="row"> }
{detectors.map(function (detector, i) { return <div className="container-fluid">
return <div>{detector}</div> <h3>Detectors</h3>
})} <div className="row">
</div> {detectors.map(function (detector, i) {
</div>; return <div>{detector}</div>
})}
</div>
</div>;
} }
} }
...@@ -49,16 +49,11 @@ export default InstrumentDetectorWidget; ...@@ -49,16 +49,11 @@ export default InstrumentDetectorWidget;
class DetectorWidget extends React.Component { class DetectorWidget extends React.Component {
render(){ render(){
return <div className="col-sm-1"> return <div className="col-sm-1">
<table className="table table-condensed"> <ParameterTableWidget header={"#" + this.props.detectorIndex + this.props.name} names={this.props.positionersName} values={this.props.positionersValue} ></ParameterTableWidget>
<thead>
<tr>
<th colspan="2"># {this.props.detectorIndex} {this.props.name}</th>
</tr>
</thead>
<ParameterTableWidget names={this.props.positionersName} values={this.props.positionersValue} ></ParameterTableWidget>
</table>
</div>; </div>;
} }
}; };
import React from 'react';
import { Panel, Grid, Row, Col } from 'react-bootstrap';
import { getDatasetParameterByName, getDatasetParameterByPrefixName } from '../../helpers/DatasetHelper.js';
class InstrumentMonochromatorWidget extends React.Component {
constructor(props) {
super(props);
}
getParameter(parameterName){
return getDatasetParameterByName(this.props.dataset, parameterName);
}
render(){
var monochromatorParameters = getDatasetParameterByPrefixName(this.props.dataset, "InstrumentMonochromator");
return <div className="container-fluid">
<h3>Monochromator</h3>
<div className="row">
<div className="col-sm-2">
<table className="table table-condensed">
<tbody>
<tr><td>Energy</td><td>{getDatasetParameterByName(this.props.dataset, "InstrumentMonochromator_energy")}</td></tr>
<tr><td>Wavelength</td><td>{getDatasetParameterByName(this.props.dataset, "InstrumentMonochromator_wavelength")}</td></tr>
<tr><td>d_spacing</td><td>{getDatasetParameterByName(this.props.dataset, "InstrumentMonochromatorCrystal_d_spacing")}</td></tr>
<tr><td>Reflection</td><td>{getDatasetParameterByName(this.props.dataset, "InstrumentMonochromatorCrystal_reflection")}</td></tr>
<tr><td>Type</td><td>{getDatasetParameterByName(this.props.dataset, "InstrumentMonochromatorCrystal_type")}</td></tr>
<tr><td>Usage</td><td>{getDatasetParameterByName(this.props.dataset, "InstrumentMonochromatorCrystal_usage")}</td></tr>
</tbody>
</table>
</div>
</div>
</div>;
}
}
export default InstrumentMonochromatorWidget;
\ No newline at end of file
import React from 'react';
import { Panel, Grid, Row, Col } from 'react-bootstrap';
import { getDatasetParameterByName, getDatasetParameterByPrefixName } from '../../helpers/DatasetHelper.js';
import ParameterTableWidget from './ParameterTableWidget.js';
class InstrumentOpticsWidget extends React.Component {
constructor(props) {
super(props);
}
render(){
var values = getDatasetParameterByPrefixName(this.props.dataset, "InstrumentOpticsPositioners_value");
var names = getDatasetParameterByPrefixName(this.props.dataset, "InstrumentOpticsPositioners_name");
if (values && names){
if (values.length > 0 && names.length > 0){
return <div className="container-fluid">
<h3>Optics</h3>
<div class="row">
<ParameterTableWidget names={names[0].value} values={values[0].value} ></ParameterTableWidget>
</div>
</div>;
}
}
return null;
}
}
export default InstrumentOpticsWidget;
\ No newline at end of file
import React from 'react';
import { Panel, Grid, Row, Col } from 'react-bootstrap';
import { getDatasetParameterByName, getDatasetParameterByPrefixName } from '../../helpers/DatasetHelper.js';
import ParameterTableWidget from './ParameterTableWidget.js';
class InstrumentPositionersWidget extends React.Component {
constructor(props) {
super(props);
}
render(){
var values = getDatasetParameterByPrefixName(this.props.dataset, "InstrumentPositioners_value");
var names = getDatasetParameterByPrefixName(this.props.dataset, "InstrumentPositioners_name");
if (values && names){
if (values.length > 0 && names.length > 0){
return <div className="container-fluid">
<h3>Positioners</h3>
<div class="row">
<ParameterTableWidget names={names[0].value} values={values[0].value} ></ParameterTableWidget>
</div>
</div>;
}
}
return null;
}
}
export default InstrumentPositionersWidget;
\ No newline at end of file
import React from 'react'; import React from 'react';
import { Panel, Grid, Row, Col } from 'react-bootstrap'; import { getDatasetParameterByName } from '../../helpers/DatasetHelper.js';
import { getDatasetParameterByName, getDatasetParameterByPrefixName } from '../../helpers/DatasetHelper.js'; import ParameterTableWidget from './ParameterTableWidget.js';
class InstrumentSlitWidget extends React.Component { class InstrumentSlitWidget extends React.Component {
constructor(props) {
super(props);
}
getParameter(parameterName){ getParameter(parameterName){
return getDatasetParameterByName(this.props.dataset, parameterName); return getDatasetParameterByName(this.props.dataset, parameterName);
} }
render(){ getJSONKeyValuePair(name, value){
var parameters = getDatasetParameterByPrefixName(this.props.dataset, "InstrumentSlit"); return {
return <div class="container-fluid"> name : name,
<h3>Slits</h3> value : value
<div class="row"> };
<div class="col-sm-2"> }
<table class="table table-condensed">
<thead>
<tr>
<th colSpan="2">Primary slit</th>
</tr>
</thead>
<tbody>
<tr><td>Blade Front</td><td>{getDatasetParameterByName(this.props.dataset, "InstrumentSlitPrimary_blade_front")}</td></tr>
<tr><td>Blade Back</td><td>{getDatasetParameterByName(this.props.dataset, "InstrumentSlitPrimary_blade_back")}</td></tr>
<tr><td>Blade Up</td><td>{getDatasetParameterByName(this.props.dataset, "InstrumentSlitPrimary_blade_up")}</td></tr>
<tr><td>Blade Down</td><td>{getDatasetParameterByName(this.props.dataset, "InstrumentSlitPrimary_blade_down")}</td></tr>
<tr><td>Horizontal Gap</td><td>{getDatasetParameterByName(this.props.dataset, "InstrumentSlitPrimary_horizontal_gap")}</td></tr>
<tr><td>Horizontal Offset</td><td>{getDatasetParameterByName(this.props.dataset, "InstrumentSlitPrimary_horizontal_offset")}</td></tr>
<tr><td>Vertical Gap</td><td>{getDatasetParameterByName(this.props.dataset, "InstrumentSlitPrimary_vertical_gap")}</td></tr>
<tr><td>Vertical Offset</td><td>{getDatasetParameterByName(this.props.dataset, "InstrumentSlitPrimary_vertical_offset")}</td></tr>
</tbody>
</table>
</div>
<div class="col-sm-2">
<table class="table table-condensed">
<thead>
<tr>
<th colSpan="2">Secondary slit</th>
</tr>
</thead>
<tbody>
<tr><td>Blade Front</td><td>{getDatasetParameterByName(this.props.dataset, "InstrumentSlitSecondary_blade_front")}</td></tr>
<tr><td>Blade Back</td><td>{getDatasetParameterByName(this.props.dataset, "InstrumentSlitSecondary_blade_back")}</td></tr>
<tr><td>Blade Up</td><td>{getDatasetParameterByName(this.props.dataset, "InstrumentSlitSecondary_blade_up")}</td></tr>
<tr><td>Blade Down</td><td>{getDatasetParameterByName(this.props.dataset, "InstrumentSlitSecondary_blade_down")}</td></tr>
<tr><td>Horizontal Gap</td><td>{getDatasetParameterByName(this.props.dataset, "InstrumentSlitSecondary_horizontal_gap")}</td></tr>
<tr><td>Horizontal Offset</td><td>{getDatasetParameterByName(this.props.dataset, "InstrumentSlitSecondary_horizontal_offset")}</td></tr>
<tr><td>Vertical Gap</td><td>{getDatasetParameterByName(this.props.dataset, "InstrumentSlitSecondary_vertical_gap")}</td></tr>
<tr><td>Vertical Offset</td><td>{getDatasetParameterByName(this.props.dataset, "InstrumentSlitSecondary_vertical_offset")}</td></tr>
</tbody>
</table>
</div>
<div class="col-sm-8">
<table class="table table-condensed">
<thead>
<tr>
<th colSpan="2">Slits</th>
</tr>
</thead>
<tbody>
<tr><td>Blade Front</td><td>{getDatasetParameterByName(this.props.dataset, "InstrumentSlits_blade_front")}</td></tr>
<tr><td>Blade Back</td><td>{getDatasetParameterByName(this.props.dataset, "InstrumentSlits_blade_back")}</td></tr>
<tr><td>Blade Up</td><td>{getDatasetParameterByName(this.props.dataset, "InstrumentSlits_blade_up")}</td></tr>
<tr><td>Blade Down</td><td>{getDatasetParameterByName(this.props.dataset, "InstrumentSlits_blade_down")}</td></tr>
<tr><td>Horizontal Gap</td><td>{getDatasetParameterByName(this.props.dataset, "InstrumentSlits_horizontal_gap")}</td></tr>
<tr><td>Horizontal Offset</td><td>{getDatasetParameterByName(this.props.dataset, "InstrumentSlits_horizontal_offset")}</td></tr>
</tbody>
</table>
</div>
getSlitValues(prefix){
return [
this.getJSONKeyValuePair('Blade Front', getDatasetParameterByName(this.props.dataset, prefix + "_blade_front")),
this.getJSONKeyValuePair('Blade Back', getDatasetParameterByName(this.props.dataset, prefix + "_blade_back")),
this.getJSONKeyValuePair('Blade Up', getDatasetParameterByName(this.props.dataset, prefix + "_blade_up")),
this.getJSONKeyValuePair('Blade Down', getDatasetParameterByName(this.props.dataset, prefix + "_blade_down")),
this.getJSONKeyValuePair('Horizontal Gap', getDatasetParameterByName(this.props.dataset, prefix + "_horizontal_gap")),