Standby before implemeting Thumbnail component

parent a07a48d8
......@@ -55,7 +55,7 @@ class DatasetMetadataTab extends React.Component {
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'}}>
return <div style={{ 'margin': '10px', fontSize:'12px'}}>
<ResponsiveTable
keyField="id"
data={ data }
......
......@@ -3,7 +3,7 @@ import Moment from 'react-moment';
import { Grid, Row, Col, Image } from 'react-bootstrap';
import './DatasetSummary.css';
import { getFileByEventId } from '../../../api/icat/icatPlus.js';
import EMDatasetSummary from './EMDatasetSummary';
class DatasetSummary extends React.Component {
......@@ -38,7 +38,12 @@ class DatasetSummary extends React.Component {
}
render() {
var technique = this.getParameterValue("definition");
if (technique){
if (technique === 'EM'){
return <EMDatasetSummary dataset={this.props.dataset}></EMDatasetSummary>
}
}
return (
<Grid fluid>
<Row>
......@@ -73,7 +78,6 @@ class DatasetSummary extends React.Component {
</Col>
<Col xs={12} sm={12} md={2}>
{this.getImageFromGalleyByIndex(0)}
</Col>
<Col xs={12} sm={12} md={2}>
{this.getImageFromGalleyByIndex(1)}
......
import React from 'react';
import Moment from 'react-moment';
import { Grid, Row, Col, Image } from 'react-bootstrap';
import './DatasetSummary.css';
import { getImageFromGalleyByIndex } from '../../../helpers/DatasetHelper.js';
class EMDatasetSummary extends React.Component {
getParameterValue(name){
var sampleNameParameter = this.props.dataset.parameters.filter(function (o) { return o.name === name });
if (sampleNameParameter){
if (sampleNameParameter[0]){
return sampleNameParameter[0].value;
}
}
}
render() {
return (
<Grid fluid>
<Row>
<Col xs={12} md={2}>
<Grid fluid style={{marginTop:'30px'}}>
<Row>
<Col xs={4} sm={6} md={6}>Name</Col>
<Col xs={8} sm={6} md={6} className='column_parameter_value'>{this.props.dataset.name}</Col>
</Row>
<Row>
<Col xs={4} sm={6} md={6}>Definition</Col>
<Col xs={8} sm={6} md={6} className='column_parameter_value'>{this.getParameterValue("definition")}</Col>
</Row>
<Row>
<Col xs={4} sm={6} md={6}>Start</Col>
<Col xs={8} sm={6} md={6} className='column_parameter_value'><Moment parse="YYYY-MM-DD HH:mm" format="LTS">{this.props.dataset.startDate}</Moment></Col>
</Row>
<Row>
<Col xs={4} sm={6} md={6}>End</Col>
<Col xs={8} sm={6} md={6} className='column_parameter_value'><Moment parse="YYYY-MM-DD HH:mm" format="LTS">{this.props.dataset.endDate}</Moment></Col>
</Row>
<Row>
<Col xs={4} sm={6} md={6}>Sample</Col>
<Col xs={8} sm={6} md={6} className='column_parameter_value'>{this.getParameterValue("Sample_name")}</Col>
</Row>
<Row>
<Col xs={4} sm={6} md={6}>Description</Col>
<Col xs={8} sm={6} md={6} className='column_parameter_value'>{this.getParameterValue("Sample_description")}</Col>
</Row>
</Grid>
</Col>
<Col xs={12} sm={12} md={2}>
</Col>
<Col xs={12} sm={12} md={2}>
</Col>
<Col xs={12} sm={12} md={2}>
</Col>
<Col xs={12} sm={12} md={2}>
</Col>
<Col xs={12} sm={12} md={2}>
{getImageFromGalleyByIndex(this.props.dataset, this.props.sessionId, 0)}
</Col>
</Row>
</Grid>
);
}
}
export default EMDatasetSummary;
\ No newline at end of file
......@@ -12,6 +12,7 @@ import DatasetFileTree from '../../components/File/DatasetFileTree.js';
import _ from 'lodash';
import { FILE_COUNT } from '../../constants/ParameterTypes.js';
import InstrumentWidget from '../Instrument/InstrumentWidget.js';
import { getDatasetParameterByPrefixName } from '../../helpers/DatasetHelper.js';
class DatasetWidget extends React.Component {
getDefinition(dataset){
......@@ -60,18 +61,16 @@ class DatasetWidget extends React.Component {
}
return null;
})}
<Tab eventKey={9} title="Instrument">
<Tab eventKey={9} title="Instrument" disabled={ getDatasetParameterByPrefixName(this.props.dataset, "Instrument").length == 0}>
<InstrumentWidget dataset={dataset} ></InstrumentWidget>
</Tab>
<Tab eventKey={10} title="Metadata List">
<DatasetMetadataTab dataset={dataset} ></DatasetMetadataTab>
</Tab>
<Tab eventKey={11} title={getFilesTabTitle(dataset)} mountOnEnter={true}>
<DatasetFileTree dataset={dataset} sessionId={this.props.sessionId}> ></DatasetFileTree>
</Tab>
<Tab eventKey={12} title="DOI" mountOnEnter={true}>
<DatasetDOIList dataset={dataset} sessionId={this.props.sessionId}> ></DatasetDOIList>
<Tab eventKey={10} title="Metadata List" className="pull-right" >
<DatasetMetadataTab dataset={dataset} ></DatasetMetadataTab>
</Tab>
</Tabs>
</Panel.Body>
<Panel.Footer>
......@@ -84,7 +83,11 @@ class DatasetWidget extends React.Component {
}
/*
<Tab eventKey={12} title="DOI" mountOnEnter={true}>
<DatasetDOIList dataset={dataset} sessionId={this.props.sessionId}> ></DatasetDOIList>
</Tab>
*/
}
......
......@@ -63,8 +63,8 @@ class DatasetFileTree extends React.Component {
render() {
const options = {
paginationSize: 10,
sizePerPage: 10,
paginationSize: 20,
sizePerPage: 20,
paginationShowsTotal: true,
hidePageListOnlyOnePage: true
};
......
......@@ -18,6 +18,7 @@ class InstrumentSlitWidget extends React.Component {
}
getSlitValues(prefix){
debugger
return [
this.getJSONKeyValuePair('Blade Front', getDatasetParameterByName(this.props.dataset, prefix + "_blade_front")),
this.getJSONKeyValuePair('Blade Back', getDatasetParameterByName(this.props.dataset, prefix + "_blade_back")),
......
import React from 'react';
import _ from 'lodash';
import InstrumentDetectorWidget from './InstrumentDetectorWidget.js';
import InstrumentSlitWidget from './InstrumentSlitWidget.js';
import ParameterTableWidget from './ParameterTableWidget.js';
......@@ -8,23 +8,32 @@ import { getDatasetParameterByName, getDatasetParameterByPrefixName } from '../.
class InstrumentWidget extends React.Component {
render() {
var instrumentParameters = getDatasetParameterByPrefixName(this.props.dataset, "Instrument");
if (instrumentParameters.length == 0){
return null;
}
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")}
{ 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>
></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")}
......@@ -62,10 +71,17 @@ class InstrumentWidgetSection extends React.Component {
values = this.props.values[0].value;
}
}
if (!names && !values && (!this.props.parameters || this.props.parameters === 0)){
return null;
}
/** If all values are empty then it is not displayed */
// if (!_.find(this.props.parameters, function(parameter){ console.log(parameter.name); return parameter.value })){
// return null;
// }
return <div className="container-fluid">
<br />
<span style={{fontSize:'16px', fontWeight:'bold'}} >{this.props.header}</span>
......
import React from 'react';
import './ParameterTableWidget.css';
import { Table } from 'react-bootstrap';
import _ from 'lodash';
class ParameterTableWidget extends React.Component {
getColumnNameClass(value){
......@@ -41,6 +42,11 @@ class ParameterTableWidget extends React.Component {
parameterValues.push(this.props.parameters[i].value);
}
}
/** If all values are empty then it is not displayed */
//if (!_.find(parameterValues, function(value){ return value !== null})){
// return null;
// }
return <Table striped condensed hover>
{this.getHeader(this.props.header)}
......
......@@ -19,7 +19,6 @@ class InvestigationContainer extends Component {
this.state = {
activeTab: this.props.activeTab || 1
}
this.handleSelect = this.handleSelect.bind(this);
}
......@@ -37,7 +36,7 @@ class InvestigationContainer extends Component {
this.props.fetchDatasetsByInvestigationId(this.props.user.sessionId, investigationId);
let investigation = _.find(this.props.myInvestigations, (investigation) => { return investigation.id === Number(investigationId) });
debugger
if (investigation) {
// investigation was found in my Data
this.props.setBreadCrumbs([
......
import _ from 'lodash';
import { convertParameterNameToAlias } from './Parameters.js';
import { getFileByEventId } from '../api/icat/icatPlus.js';
import React from 'react';
import { Image } from 'react-bootstrap';
export function getDatasetParameterByName(dataset, parameterName) {
var parameter = _.find(dataset.parameters, function (o) { return o.name === parameterName });
......@@ -18,4 +21,21 @@ export function getDatasetParameterByPrefixName(dataset, prefix) {
return parameter;
});
};
\ No newline at end of file
};
export function getImageFromGalleyByIndex(dataset, sessionId, index) {
/** Checking gallery **/
var gallery = dataset.parameters.filter(function (o) { return o.name === "ResourcesGallery" });
if (gallery != null) {
if (gallery.length > 0) {
gallery = gallery[0].value.split(" ");
if (gallery.length > index) {
var url = getFileByEventId(sessionId, dataset.investigation.id, gallery[index] );
return <div><br /><Image src={url} thumbnail /></div>;
}
}
}
return null;
}
\ No newline at end of file
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