It improves #145

parent e7595f0a
......@@ -14,12 +14,8 @@ import SearchContainer from './containers/SearchContainer.js';
import SelectionContainer from './containers/Selection/SelectionContainer.js';
import MintSelectionContainer from './containers/Selection/MintSelectionContainer.js';
import Footer from './components/Footer.js';
import _ from 'lodash';
import { BrowserRouter as Router, Route } from "react-router-dom";
import TagContainer from './containers/TagContainer';
import { fetchDatasetsByDOI } from './actions/datasets.js';
import { TAG_MANAGER_CONTEXT } from './constants/EventTypes';
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 {
render() {
return (
......@@ -217,8 +200,7 @@ class OpenDataPage extends React.Component {
<Panel.Body>
<InvestigationsContainer
linkProposal={false}
investigations={this.props.releasedInvestigations}
linkProposal={true}
investigations={this.props.releasedInvestigations}
closedData={false}
/>
</Panel.Body>
......
import React from 'react';
import { BootstrapTable, TableHeaderColumn } from 'react-bootstrap-table';
import { Grid, Row, Col,Label, Glyphicon } from 'react-bootstrap';
import { Link } from 'react-router-dom';
import Loading from '../../components/Loading.js';
import DOIBadge from '../../components/doi/DOIBadge.js';
import _ from 'lodash';
import { TITLE, INVESTIGATION_NAMES, INSTRUMENT_NAMES } from '../../constants/ParameterTypes.js';
......
......@@ -9,7 +9,6 @@ class DatasetMetadataTab extends React.Component {
}
getColumns(){
return [
{
text: "id",
......@@ -53,29 +52,15 @@ class DatasetMetadataTab extends React.Component {
}
render() {
const options = {
paginationSize: 10,
sizePerPage: 10,
paginationShowsTotal: true,
hidePageListOnlyOnePage: true
};
render() {
/** Data sorted by name */
let data = this.props.dataset.parameters.sort((a, b) => a.name.localeCompare(b.name, undefined, {sensitivity: 'base'}));
return <div style={{ 'margin': '20px'}}>
<ResponsiveTable
keyField="id"
data={ data }
columns={ this.getColumns() }
/></div>;
/></div>;
}
}
......
......@@ -6,7 +6,6 @@ import axios from "axios";
import Moment from 'react-moment';
import TECHNIQUES from '../../config/techniques/techniques.js';
import Loading from '../../components/Loading.js';
import { BootstrapTable, TableHeaderColumn } from 'react-bootstrap-table';
import { getDatasetStatus } from "../../api/icat/icatPlus.js"
import { stringifyBytesSize } from "../Helpers.js"
import { VOLUME, FILE_COUNT } from '../../constants/ParameterTypes.js';
......@@ -52,7 +51,7 @@ class DatasetTable extends React.Component {
downloadFormatter(cell, dataset, rowIndex, extraData) {
let dataArchived = extraData.getParameter(dataset, "__dataArchived");
if (dataArchived == "False") {
if (dataArchived === "False") {
return "N/A";
}
return <DownloadButton sessionId={extraData.props.sessionId} id={dataset.id} ></DownloadButton>;
......@@ -212,14 +211,6 @@ class DatasetTable extends React.Component {
return <Loading message="Loading datasets"></Loading>;
}
const options = {
paginationSize: 10,
sizePerPage: 200,
paginationShowsTotal: true,
hidePageListOnlyOnePage: true
};
const selectRow = {
mode: 'checkbox',
clickToSelect: false,
......@@ -352,7 +343,7 @@ class DownloadButton extends React.Component {
render() {
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}>
<Button bsStyle="primary" bsSize="xsmall">
<span className="glyphicon glyphicon-download-alt"></span>
......@@ -361,7 +352,7 @@ class DownloadButton extends React.Component {
</a>;
}
if (this.state.status == 'RESTORING') {
if (this.state.status === 'RESTORING') {
return <a style={{ color: 'black' }} href={downloadURL}>
<Button variant="dark" bsSize="xsmall" >
<span bsSize="xsmall" className="glyphicon glyphicon-repeat fast-right-spinner"></span>
......@@ -370,20 +361,18 @@ class DownloadButton extends React.Component {
</a>;
}
if (this.state.status == 'ARCHIVED') {
if (this.state.status === 'ARCHIVED') {
return <Button variant="light" bsSize="xsmall" onClick={(e) => { this.restore(e) }}>
<span style={{ color: 'black' }} className="glyphicon glyphicon-tasks"></span>
<span style={{ color: 'black', marginLeft: '10px' }} >Restore</span>
</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>{this.state.status}</span>;
}
};
......
......@@ -39,7 +39,7 @@ class DatasetWidget extends React.Component {
if (definition){
if (definition.length > 0){
if (definition[0].value == "Publication"){
if (definition[0].value === "Publication"){
return <PublicationSummary dataset={dataset} sessionId={this.props.sessionId} ></PublicationSummary>;
}
}
......
import React from 'react';
import Moment from 'react-moment';
import { Grid, Row, Col, Image } from 'react-bootstrap';
import './PublicationSummary.css';
import { getFileByEventId } from '../../../api/icat/icatPlus.js';
class PublicationSummary extends React.Component {
componentDidMount() {
}
getImageFromGalleyByIndex(index) {
/** Checking gallery **/
var gallery = this.props.dataset.parameters.filter(function (o) { return o.name === "ResourcesGallery" });
......@@ -25,7 +18,6 @@ class PublicationSummary extends React.Component {
}
}
return null;
}
getParameterValue(name){
......
......@@ -3,44 +3,44 @@ import { getDatasetParameterByName, getDatasetParameterByPrefixName } from '../.
import ParameterTableWidget from './ParameterTableWidget.js';
class InstrumentDetectorWidget extends React.Component {
constructor(props) {
super(props);
}
getDetectorWidget(index){
var parameters = getDatasetParameterByPrefixName(this.props.dataset, "InstrumentDetector0" + index);
if (parameters){
if (parameters.length > 0){
return <DetectorWidget
detectorIndex={index}
name = {getDatasetParameterByName(this.props.dataset, "InstrumentDetector0" + index + "_name")}
positionersValue = {getDatasetParameterByName(this.props.dataset, "InstrumentDetector0" + index + "Positioners_value")}
positionersName = {getDatasetParameterByName(this.props.dataset, "InstrumentDetector0" + index + "Positioners_name")}
positionersRoisValue = {getDatasetParameterByName(this.props.dataset, "InstrumentDetector0" + index + "PositionersRois_value")}
positionersRoisName = {getDatasetParameterByName(this.props.dataset, "InstrumentDetector0" + index + "PositionersRois_name")}
></DetectorWidget>;
detectorIndex={index}
name = {getDatasetParameterByName(this.props.dataset, "InstrumentDetector0" + index + "_name")}
positionersValue = {getDatasetParameterByName(this.props.dataset, "InstrumentDetector0" + index + "Positioners_value")}
positionersName = {getDatasetParameterByName(this.props.dataset, "InstrumentDetector0" + index + "Positioners_name")}
positionersRoisValue = {getDatasetParameterByName(this.props.dataset, "InstrumentDetector0" + index + "PositionersRois_value")}
positionersRoisName = {getDatasetParameterByName(this.props.dataset, "InstrumentDetector0" + index + "PositionersRois_name")}
></DetectorWidget>;
}
}
}
render(){
render(){
var detectors = [];
for(var i = 1; i < 10; i++){
var detector = this.getDetectorWidget(i);
if (detector){
detectors.push(detector);
}
}
return <div className="container-fluid">
<h3>Detectors</h3>
<div className="row">
{detectors.map(function (detector, i) {
return <div>{detector}</div>
})}
</div>
</div>;
}
if (detectors.length == 0){
return null;
}
return <div className="container-fluid">
<h3>Detectors</h3>
<div className="row">
{detectors.map(function (detector, i) {
return <div>{detector}</div>
})}
</div>
</div>;
}
}
......@@ -49,16 +49,11 @@ export default InstrumentDetectorWidget;
class DetectorWidget extends React.Component {
render(){
return <div className="col-sm-1">
<table className="table table-condensed">
<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>
return <div className="col-sm-1">
<ParameterTableWidget header={"#" + this.props.detectorIndex + this.props.name} names={this.props.positionersName} values={this.props.positionersValue} ></ParameterTableWidget>
</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 { Panel, Grid, Row, Col } from 'react-bootstrap';
import { getDatasetParameterByName, getDatasetParameterByPrefixName } from '../../helpers/DatasetHelper.js';
import { getDatasetParameterByName } from '../../helpers/DatasetHelper.js';
import ParameterTableWidget from './ParameterTableWidget.js';
class InstrumentSlitWidget extends React.Component {
constructor(props) {
super(props);
}
getParameter(parameterName){
return getDatasetParameterByName(this.props.dataset, parameterName);
}
render(){
var parameters = getDatasetParameterByPrefixName(this.props.dataset, "InstrumentSlit");
return <div class="container-fluid">
<h3>Slits</h3>
<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>
getJSONKeyValuePair(name, value){
return {
name : name,
value : value
};
}
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")),
this.getJSONKeyValuePair('Horizontal Offset', getDatasetParameterByName(this.props.dataset, prefix + "_horizontal_offset")),
this.getJSONKeyValuePair('Vertical Gap', getDatasetParameterByName(this.props.dataset, prefix + "_vertical_gap")),
this.getJSONKeyValuePair('Vertical Offset', getDatasetParameterByName(this.props.dataset, prefix + "_vertical_offset"))
]
}
</div>
</div>;
render(){
return <div class="container-fluid">
<br />
<span style={{fontSize:'16px', fontWeight:'bold'}} >Slits</span>
<div class="row">
<div class="col-sm-2">
<ParameterTableWidget
header="Primary slit"
parameters={this.getSlitValues("InstrumentSlitPrimary")}
></ParameterTableWidget>
</div>
<div class="col-sm-2">
<ParameterTableWidget
header="Secondary slit"
parameters={this.getSlitValues("InstrumentSlitSecondary")}
></ParameterTableWidget>
</div>
<div class="col-sm-8">
<ParameterTableWidget
header="Slits"
parameters={this.getSlitValues("InstrumentSlits")}
></ParameterTableWidget>
</div>
</div>
</div>;
}
}
......
import React from 'react';
import InstrumentMonochromatorWidget from './InstrumentMonochromatorWidget.js';
import InstrumentDetectorWidget from './InstrumentDetectorWidget.js';
import InstrumentSlitWidget from './InstrumentSlitWidget.js';
import InstrumentOpticsWidget from './InstrumentOpticsWidget.js';
import InstrumentPositionersWidget from './InstrumentPositionersWidget.js';
import ParameterTableWidget from './ParameterTableWidget.js';
import { getDatasetParameterByName, getDatasetParameterByPrefixName } from '../../helpers/DatasetHelper.js';
class InstrumentWidget extends React.Component {
constructor(props) {
super(props);
}
componentDidMount() {
}
render() {
return <div style={{fontSize:'11px'}}>
<InstrumentWidgetSection
header="Monochromator"
parameters={[
{ name : "Energy", value : getDatasetParameterByName(this.props.dataset, "InstrumentMonochromator_energy")},
{ name : "Wavelength", value : getDatasetParameterByName(this.props.dataset, "InstrumentMonochromator_wavelength")},
{ name : "d_spacing", value : getDatasetParameterByName(this.props.dataset, "InstrumentMonochromatorCrystal_d_spacing")},
{ name : "Reflection", value : getDatasetParameterByName(this.props.dataset, "InstrumentMonochromatorCrystal_reflection")},
{ name : "Type", value : getDatasetParameterByName(this.props.dataset, "InstrumentMonochromatorCrystal_type")},
{ name : "Usage", value : getDatasetParameterByName(this.props.dataset, "InstrumentMonochromatorCrystal_usage")}
]}
>
</InstrumentWidgetSection>
<InstrumentDetectorWidget dataset={this.props.dataset}></InstrumentDetectorWidget>
<InstrumentSlitWidget dataset={this.props.dataset}></InstrumentSlitWidget>
<span style={{fontSize:'16px', fontWeight:'bold'}} >Monochromator</span>
<InstrumentWidgetSection
header="Optics"
names={getDatasetParameterByPrefixName(this.props.dataset, "InstrumentOpticsPositioners_name")}
values={getDatasetParameterByPrefixName(this.props.dataset, "InstrumentOpticsPositioners_value")}
>
</InstrumentWidgetSection>
render() {
return <div style={{fontSize:'11px'}}>
<InstrumentMonochromatorWidget dataset={this.props.dataset}></InstrumentMonochromatorWidget>
<InstrumentDetectorWidget dataset={this.props.dataset}></InstrumentDetectorWidget>
<InstrumentSlitWidget dataset={this.props.dataset}></InstrumentSlitWidget>
<InstrumentOpticsWidget dataset={this.props.dataset}></InstrumentOpticsWidget>
<InstrumentPositionersWidget dataset={this.props.dataset}></InstrumentPositionersWidget>
<InstrumentWidgetSection
header="Positioners"
names={getDatasetParameterByPrefixName(this.props.dataset, "InstrumentPositioners_name")}
values={getDatasetParameterByPrefixName(this.props.dataset, "InstrumentPositioners_value")}
>
</InstrumentWidgetSection>
</div>;
}
}
export default InstrumentWidget;
class InstrumentWidgetSection extends React.Component {
render() {
var names = null;
var values = null;
if (this.props.values && this.props.names){
/** This is a comma separeted pair of name-values
* names = [{"name":"InstrumentOpticsPositioners_name","value":" m2angle m0tz m0tyrot mono enmono r2theta r2gamma "}]
* values = [{"name":"InstrumentOpticsPositioners_value","value":" 26 -22 6.7 19.244 5.99885 -0.0829958 -0.456489 -0.820325 5.5 0.85 -18.5746 -4.49 5.96497 5.86713 6.06281 5.86713 7.5 100 0.141575 -0.511 NaN NaN NaN NaN NaN NaN 0"}]
*/