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

Removed some accedentally merged features.

parent 7250d297
Pipeline #80818 passed with stages
in 31 minutes and 59 seconds
......@@ -46,6 +46,9 @@ contributing, and API reference.
Omitted versions are plain bugfix releases with only minor changes and fixes.
### v0.8.7
- a new variant of the Metainfo browser
### v0.8.1
- switched to support Python 3.7
- client library as pypi package `nomad-lab`
......
......@@ -199,7 +199,7 @@ export default function Histogram({
item
.select('.name')
.text(d => getValueLabel(d.name))
.text(d => getValueLabel(d))
.attr('y', d => y(d.key) + 4)
.style('fill', textColor)
......
import React, { useMemo, useEffect, useRef, useLayoutEffect, useContext, useState } from 'react'
import React, { useMemo, useEffect, useRef, useLayoutEffect } from 'react'
import PropTypes from 'prop-types'
import { useRecoilValue, useRecoilState, atom } from 'recoil'
import { configState } from './ArchiveBrowser'
import Browser, { Item, Content, Compartment, Adaptor, laneContext } from './Browser'
import Browser, { Item, Content, Compartment, Adaptor } from './Browser'
import { Typography, Box, makeStyles, Grid, FormGroup, TextField } from '@material-ui/core'
import { metainfoDef, resolveRef, vicinityGraph, rootSections, path as metainfoPath, packagePrefixes, defsByName, path } from './metainfo'
import { metainfoDef, resolveRef, vicinityGraph, rootSections, path as metainfoPath, packagePrefixes, defsByName } from './metainfo'
import * as d3 from 'd3'
import { apiContext } from '../api'
import blue from '@material-ui/core/colors/blue'
import teal from '@material-ui/core/colors/teal'
import lime from '@material-ui/core/colors/lime'
......@@ -14,7 +13,6 @@ import purple from '@material-ui/core/colors/purple'
import grey from '@material-ui/core/colors/grey'
import Markdown from '../Markdown'
import { JsonCodeDialogButton } from '../CodeDialogButton'
import Histogram from '../Histogram'
import { appBase } from '../../config'
import { useHistory, useRouteMatch } from 'react-router-dom'
import Autocomplete from '@material-ui/lab/Autocomplete'
......@@ -331,8 +329,16 @@ SectionDef.propTypes = ({
})
function QuantityDef({def}) {
console.log('###', def)
return <Content>
<Definition def={def} kindLabel="quantity definition"/>
<Compartment>
<Typography noWrap><b>shape:</b> <span>[{def.shape.join(', ')}]</span> </Typography>
<Typography noWrap><b>type:</b> <span>{def.type.type_data} ({def.type.type_kind})</span> </Typography>
{ def.unit &&
<Typography><b>unit:</b> <span>{def.unit}</span> </Typography>
}
</Compartment>
</Content>
}
QuantityDef.propTypes = ({
......@@ -340,31 +346,31 @@ QuantityDef.propTypes = ({
})
function Definition({def, ...props}) {
const {api} = useContext(apiContext)
const lane = useContext(laneContext)
const isLast = !lane.next
const [usage, setUsage] = useState(null)
useEffect(() => {
api.quantity_search({
'dft.quantities': [def.name],
size: 100, // make sure we get all codes
quantity: 'dft.code_name'
}).then(result => {
setUsage(result.quantity.values)
})
}, [api, def.name, setUsage])
// const {api} = useContext(apiContext)
// const lane = useContext(laneContext)
// const isLast = !lane.next
// const [usage, setUsage] = useState(null)
// useEffect(() => {
// api.quantity_search({
// 'dft.quantities': [def.name],
// size: 100, // make sure we get all codes
// quantity: 'dft.code_name'
// }).then(result => {
// setUsage(result.quantity.values)
// })
// }, [api, def.name, setUsage])
return <React.Fragment>
<Title def={def} isDefinition {...props} />
{isLast && def.description && !def.extends_base_section &&
{def.description && !def.extends_base_section &&
<Compartment title="description">
<Box marginTop={1} marginBottom={1}>
<Markdown>{def.description}</Markdown>
</Box>
</Compartment>
}
{isLast && !def.extends_base_section && def.name !== 'EntryArchive' &&
{/* {isLast && !def.extends_base_section && def.name !== 'EntryArchive' &&
<Compartment title="graph">
<VicinityGraph def={def} />
</Compartment>
......@@ -387,7 +393,7 @@ function Definition({def, ...props}) {
<Typography color="error"><i>This metadata is not used at all.</i></Typography>
)}
</Compartment>
}
} */}
{def.categories && def.categories.length > 0 && <Compartment title="Categories">
{def.categories.map(categoryRef => {
const categoryDef = resolveRef(categoryRef)
......
......@@ -5,8 +5,9 @@ import { compose } from 'recompose'
import { withApi } from '../api'
import DownloadIcon from '@material-ui/icons/CloudDownload'
import Download from './Download'
import ArchiveBrowser from '../archive/ArchiveBrowser'
// import ArchiveBrowser from '../archive/ArchiveBrowser'
import { EntryPageContent } from './EntryPage'
import ReactJson from 'react-json-view'
export const help = `
The NOMAD **archive** provides data and meta-data in a common hierarchical format based on
......@@ -108,23 +109,31 @@ class ArchiveEntryView extends React.Component {
}
return (
<EntryPageContent className={classes.root}>
{
data && typeof data !== 'string'
? <ArchiveBrowser data={data} />
: <div>{
data
? <div>
<Typography>Archive data is not valid JSON. Displaying plain text instead.</Typography>
<Card>
<CardContent>
<pre>{data || ''}</pre>
</CardContent>
</Card>
</div>
: <Typography>loading ...</Typography>
}</div>
}
<EntryPageContent className={classes.root} fixed>
<Card>
<CardContent>
{
data && typeof data !== 'string'
? <ReactJson
src={this.state.data}
enableClipboard={false}
collapsed={2}
displayObjectSize={false}
/> : <div>{
data
? <div>
<Typography>Archive data is not valid JSON. Displaying plain text instead.</Typography>
<Card>
<CardContent>
<pre>{data || ''}</pre>
</CardContent>
</Card>
</div>
: <Typography>loading ...</Typography>
}</div>
}
</CardContent>
</Card>
<Download
classes={{root: classes.downloadFab}} tooltip="download calculation archive"
......
......@@ -55,6 +55,7 @@ export default function QuantityHistogram({
numberOfValues={numberOfValues}
title={title}
onClick={handleItemClicked}
selected={query[quantity]}
{...props}
/>
}
......
......@@ -80,7 +80,7 @@ def search_quantities():
from nomad import search
# Due to this import, the parsing module will register all code_names based on parser
# implementations.
from nomad import parsing # pylint: disable=unused-import
from nomad.parsing.parsers import parser_dict # pylint: disable=unused-import
import json
def to_dict(search_quantity):
......
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