Commit bd83d704 authored by Markus Scheidgen's avatar Markus Scheidgen
Browse files

Some improvements to the presentations of EMS data.

parent 0aaef96d
Pipeline #82118 failed with stages
in 19 minutes and 26 seconds
...@@ -7,13 +7,14 @@ import { ...@@ -7,13 +7,14 @@ import {
DFTSystemVisualizations, DFTPropertyVisualizations, DFTMethodVisualizations DFTSystemVisualizations, DFTPropertyVisualizations, DFTMethodVisualizations
} from './dft/DFTVisualizations' } from './dft/DFTVisualizations'
import EMSVisualizations from './ems/EMSVisualizations' import EMSVisualizations from './ems/EMSVisualizations'
import { Link } from '@material-ui/core'
/* eslint-disable react/display-name */ /* eslint-disable react/display-name */
export const domains = ({ export const domains = ({
dft: { dft: {
name: 'CMS', name: 'Computational data',
label: 'Computational material science data (CMS)', label: 'Computational material science data',
key: 'dft', key: 'dft',
about: 'This include data from many computational material science codes', about: 'This include data from many computational material science codes',
entryLabel: 'entry', entryLabel: 'entry',
...@@ -160,9 +161,9 @@ export const domains = ({ ...@@ -160,9 +161,9 @@ export const domains = ({
searchTabs: ['entries', 'materials', 'datasets', 'groups', 'uploads'] searchTabs: ['entries', 'materials', 'datasets', 'groups', 'uploads']
}, },
ems: { ems: {
name: 'EMS', name: 'Experimental data',
key: 'ems', key: 'ems',
label: 'Material science experiment data (EMS)', label: 'Experimental material science data',
about: 'This is metadata from material science experiments', about: 'This is metadata from material science experiments',
entryLabel: 'entry', entryLabel: 'entry',
entryLabelPlural: 'entries', entryLabelPlural: 'entries',
...@@ -199,20 +200,29 @@ export const domains = ({ ...@@ -199,20 +200,29 @@ export const domains = ({
*/ */
searchResultColumns: { searchResultColumns: {
'formula': { 'formula': {
label: 'Formula' label: 'Formula',
supportsSort: true
},
'ems.chemical': {
label: 'Material name',
}, },
'ems.method': { 'ems.method': {
label: 'Method' label: 'Method',
supportsSort: true
},
'ems.data_type': {
label: 'Data',
}, },
'ems.experiment_location': { 'ems.origin_time': {
label: 'Location' label: 'Date',
render: entry => (entry.ems && entry.ems.origin_time && new Date(entry.ems.origin_time).toLocaleDateString()) || 'unavailable'
}, },
'ems.experiment_time': { 'ems.repository_url': {
label: 'Date/Time', label: 'Source',
render: entry => (entry.ems && entry.ems.experiment_time !== 'unavailable') ? new Date(entry.ems.experiment_time * 1000).toLocaleString() : 'unavailable' render: entry => <Link target="external" href={entry.ems.entry_repository_url}>{entry.ems.repository_url}</Link>
} }
}, },
defaultSearchResultColumns: ['formula', 'ems.method', 'ems.experiment_location', 'ems.experiment_time'], defaultSearchResultColumns: ['formula', 'ems.chemical', 'ems.method', 'ems.data_type', 'ems.origin_time', 'ems.repository_url'],
/** /**
* A component to render the domain specific quantities in the metadata card of * A component to render the domain specific quantities in the metadata card of
* the entry view. Needs to work with props: data (the entry data from the API), * the entry view. Needs to work with props: data (the entry data from the API),
......
...@@ -27,7 +27,7 @@ class EMSEntryCards extends React.Component { ...@@ -27,7 +27,7 @@ class EMSEntryCards extends React.Component {
<CardContent classes={{root: classes.cardContent}}> <CardContent classes={{root: classes.cardContent}}>
<Markdown classes={{root: classes.description}}>{` <Markdown classes={{root: classes.description}}>{`
The data for this experiment is externally stored and managed. Download the raw experiment data: The data for this experiment is externally stored and managed. Download the raw experiment data:
[${data.ems.repository_url}](${data.ems.repository_url}). [${data.ems && data.ems.repository_url}](${data.ems && data.ems.entry_repository_url}).
The meta data describing this experiment in its original format, can be The meta data describing this experiment in its original format, can be
downloaded here directly: downloaded here directly:
......
import React from 'react' import React from 'react'
import PropTypes from 'prop-types' import PropTypes from 'prop-types'
import Quantity from '../Quantity' import Quantity from '../Quantity'
import { Typography } from '@material-ui/core' import { Typography, Link } from '@material-ui/core'
import { apiBase } from '../../config' import { apiBase } from '../../config'
export default class EMSEntryOverview extends React.Component { export default class EMSEntryOverview extends React.Component {
...@@ -45,7 +45,16 @@ export default class EMSEntryOverview extends React.Component { ...@@ -45,7 +45,16 @@ export default class EMSEntryOverview extends React.Component {
return ( return (
<Quantity column> <Quantity column>
<Quantity quantity="ems.experiment_summary" label="summary" {...this.props} /> {data.ems.experiment_summary && <Quantity quantity="ems.experiment_summary" label="summary" {...this.props} />}
{this.state.previewBroken
? data.ems.entry_repository_url && <Quantity label="preview" {...this.props}>
<Typography noWrap>
<a target="external" href={ems.entry_repository_url}>visit this entry on the external database</a>
</Typography>
</Quantity>
: <Quantity label="preview" {...this.props}>
<img alt="preview" style={{maxWidth: '100%', height: 'auto'}} src={relative_preview_url} onError={this.handleBrokenPreview}></img>
</Quantity>}
<Quantity row> <Quantity row>
<Quantity column> <Quantity column>
<Quantity row> <Quantity row>
...@@ -55,27 +64,18 @@ export default class EMSEntryOverview extends React.Component { ...@@ -55,27 +64,18 @@ export default class EMSEntryOverview extends React.Component {
: ''} : ''}
</Quantity> </Quantity>
<Quantity quantity="ems.method" label="experimental method" noWrap {...this.props} /> <Quantity quantity="ems.method" label="experimental method" noWrap {...this.props} />
<Quantity quantity="ems.experiment_location" label="experiment location" noWrap {...this.props} /> {data.ems.experiment_location && <Quantity quantity="ems.experiment_location" label="experiment location" noWrap {...this.props} />}
<Quantity label="experiment time" {...this.props}> <Quantity label="experiment or experiment publish date" {...this.props}>
<Typography noWrap>{ <Typography noWrap>{
data.ems.experiment_time && data.ems.experiment_time !== 'unavailable' ? new Date(data.ems.experiment_time * 1000).toLocaleString() : 'unavailable' (ems && ems.origin_time && new Date(ems.origin_time).toLocaleDateString()) || 'unavailable'
}</Typography> }</Typography>
</Quantity> </Quantity>
<Quantity label="data" {...this.props}> <Quantity label="data source" {...this.props}>
<Typography noWrap> <Typography noWrap>
<a target="external" href={data.ems.repository_url}>{data.ems.repository_name}</a> <Link target="external" href={ems.entry_repository_url}>{ems.repository_url}</Link>
</Typography> </Typography>
</Quantity> </Quantity>
</Quantity> </Quantity>
{this.state.previewBroken
? data.ems.entry_repository_url && <Quantity label="preview" {...this.props}>
<Typography noWrap>
<a target="external" href={data.ems.entry_repository_url}>visit this entry on the external database</a>
</Typography>
</Quantity>
: <Quantity label="preview" {...this.props}>
<img alt="preview" style={{maxWidth: '100%', height: 'auto'}} src={relative_preview_url} onError={this.handleBrokenPreview}></img>
</Quantity>}
</Quantity> </Quantity>
</Quantity> </Quantity>
) )
......
...@@ -410,12 +410,12 @@ DomainSelect.propTypes = { ...@@ -410,12 +410,12 @@ DomainSelect.propTypes = {
} }
const ownerLabel = { const ownerLabel = {
all: 'All entries', all: 'All',
visible: 'Include your private entries', visible: 'Include private',
public: 'Only public entries', public: 'Only public',
user: 'Only your entries', user: 'Only yours',
shared: 'Incl. shared data', shared: 'Shared',
staging: 'Staging area only' staging: 'Unpublished'
} }
const ownerTooltips = { const ownerTooltips = {
......
Supports Markdown
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