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 {
DFTSystemVisualizations, DFTPropertyVisualizations, DFTMethodVisualizations
} from './dft/DFTVisualizations'
import EMSVisualizations from './ems/EMSVisualizations'
import { Link } from '@material-ui/core'
/* eslint-disable react/display-name */
export const domains = ({
dft: {
name: 'CMS',
label: 'Computational material science data (CMS)',
name: 'Computational data',
label: 'Computational material science data',
key: 'dft',
about: 'This include data from many computational material science codes',
entryLabel: 'entry',
......@@ -160,9 +161,9 @@ export const domains = ({
searchTabs: ['entries', 'materials', 'datasets', 'groups', 'uploads']
},
ems: {
name: 'EMS',
name: 'Experimental data',
key: 'ems',
label: 'Material science experiment data (EMS)',
label: 'Experimental material science data',
about: 'This is metadata from material science experiments',
entryLabel: 'entry',
entryLabelPlural: 'entries',
......@@ -199,20 +200,29 @@ export const domains = ({
*/
searchResultColumns: {
'formula': {
label: 'Formula'
label: 'Formula',
supportsSort: true
},
'ems.chemical': {
label: 'Material name',
},
'ems.method': {
label: 'Method'
label: 'Method',
supportsSort: true
},
'ems.data_type': {
label: 'Data',
},
'ems.experiment_location': {
label: 'Location'
'ems.origin_time': {
label: 'Date',
render: entry => (entry.ems && entry.ems.origin_time && new Date(entry.ems.origin_time).toLocaleDateString()) || 'unavailable'
},
'ems.experiment_time': {
label: 'Date/Time',
render: entry => (entry.ems && entry.ems.experiment_time !== 'unavailable') ? new Date(entry.ems.experiment_time * 1000).toLocaleString() : 'unavailable'
'ems.repository_url': {
label: 'Source',
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
* the entry view. Needs to work with props: data (the entry data from the API),
......
......@@ -27,7 +27,7 @@ class EMSEntryCards extends React.Component {
<CardContent classes={{root: classes.cardContent}}>
<Markdown classes={{root: classes.description}}>{`
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
downloaded here directly:
......
import React from 'react'
import PropTypes from 'prop-types'
import Quantity from '../Quantity'
import { Typography } from '@material-ui/core'
import { Typography, Link } from '@material-ui/core'
import { apiBase } from '../../config'
export default class EMSEntryOverview extends React.Component {
......@@ -45,7 +45,16 @@ export default class EMSEntryOverview extends React.Component {
return (
<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 column>
<Quantity row>
......@@ -55,27 +64,18 @@ export default class EMSEntryOverview extends React.Component {
: ''}
</Quantity>
<Quantity quantity="ems.method" label="experimental method" noWrap {...this.props} />
<Quantity quantity="ems.experiment_location" label="experiment location" noWrap {...this.props} />
<Quantity label="experiment time" {...this.props}>
{data.ems.experiment_location && <Quantity quantity="ems.experiment_location" label="experiment location" noWrap {...this.props} />}
<Quantity label="experiment or experiment publish date" {...this.props}>
<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>
</Quantity>
<Quantity label="data" {...this.props}>
<Quantity label="data source" {...this.props}>
<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>
</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>
)
......
......@@ -410,12 +410,12 @@ DomainSelect.propTypes = {
}
const ownerLabel = {
all: 'All entries',
visible: 'Include your private entries',
public: 'Only public entries',
user: 'Only your entries',
shared: 'Incl. shared data',
staging: 'Staging area only'
all: 'All',
visible: 'Include private',
public: 'Only public',
user: 'Only yours',
shared: 'Shared',
staging: 'Unpublished'
}
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