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

Fixes to the documentation. #826

parent 9ce08e93
Pipeline #131695 passed with stages
in 34 minutes and 20 seconds
......@@ -177,7 +177,11 @@ like:
Schema elements can have annotations. These annotations provide additional information
that NOMAD can use to alter its behavior around these definitions. A reference for
these annotations will be added here soon. The ELN (and tabular data) example
these annotations will be added here soon.
As part of the GUI, you'll find an overview about all ELN edit annotations and components [here]({{ nomad_url() }}/../gui/dev/editquantity).
The ELN (and tabular data) example
upload contains a schema that uses and demonstrates all our current annotations:
```yaml
......
......@@ -24,14 +24,14 @@ data into a common machine processable *archive*. The *encyclopedia* allowed to
and visualize data from a materials and properties perspective. The *ai toolkit* was
established to run analysis notebooks directly on NOMAD servers.
The current official installation of [NOMAD (v0.x)](https://nomad-lab.eu/prod/rae) is the
The current official installation of [NOMAD (v1.0.x)](https://nomad-lab.eu/prod/v1) is the
result of a consolidation process that integrated the NOMAD-CoE services *repository*,
*archive*, *encyclopedia*, and *ai toolkit*. Here, we also introduced the NOMAD Oasis and
allowed to the local use of NOMAD.
Since then, NOMAD is developed by [nomad-lab.eu](https://nomad-lab.eu) and
[fair-di e.V.](https://fair-di.eu) as a general platform for managing materials science data.
Upcoming NOMAD version including [this NOMAD (v1)](https://nomad-lab.eu/prod/v1/gui) extend
Upcoming NOMAD version including [this NOMAD (v1.1)](https://nomad-lab.eu/prod/v1/staging/gui) extend
NOMAD towards material science synthesis, experiments, and computational material science
at different scales.
......
......@@ -452,7 +452,7 @@ pip install nomad-lab[all]
If you need the latest version, you can also download the latest package from our
"beta" installation.
```sh
curl "https://nomad-lab.eu/prod/rae/beta/dist/nomad-lab.tar.gz" -o nomad-lab.tar.gz
curl "https://nomad-lab.eu/prod/v1/staging/dist/nomad-lab.tar.gz" -o nomad-lab.tar.gz
pip install nomad-lab.tar.gz[all]
```
......@@ -707,7 +707,7 @@ We will probably provide functionality in the API of the central NOMAD to upload
#### How to maintain an Oasis installation?
##### How to install a NOMAD Oasis?
Follow our guide: https://nomad-lab.eu/prod/rae/docs/ops.html#operating-a-nomad-oasis
Follow our guide: https://nomad-lab.eu/prod/v1/docs/ops.html#operating-a-nomad-oasis
##### How do version numbers work?
There are still a lot of thing in NOMAD that are subject to change. Currently, changes in the minor version number (0.x.0) designate major changes that require data migration. Changes in the patch version number (0.7.x) just contain minor changes and fixes and do not require data migration. Once we reach 1.0.0, NOMAD will use the regular semantic versioning conventions.
......
......@@ -115,7 +115,7 @@ right away. This can save you some time and additional API calls. The upload end
has a parameter `publish_directly`. You can modify the upload command you get on the upload page as follows:
```
curl "http://nomad-lab.eu/prod/rae/api/uploads/?token=<your-token>&publish_directly=true" -T <local_file>
curl "http://nomad-lab.eu/prod/v1/uploads/?token=<your-token>&publish_directly=true" -T <local_file>
```
HTTP makes it easy for you to upload files via browser and curl, but it is not an
......@@ -125,5 +125,5 @@ files (.zip or .tag.gz) on a predefined path on the NOMAD servers. NOMAD allows
files directly from its servers via an additional `local_path` parameter:
```
curl -X PUT "http://nomad-lab.eu/prod/rae/api/uploads/?token=<your-token>&local_path=<path-to-upload-file>"
curl -X PUT "http://nomad-lab.eu/prod/v1/api/uploads/?token=<your-token>&local_path=<path-to-upload-file>"
```
\ No newline at end of file
......@@ -47,7 +47,7 @@ const useCodeStyles = makeStyles(theme => ({
marginTop: theme.spacing(3)
}
}))
const Code = React.memo(function Code({code}) {
export const Code = React.memo(function Code({code}) {
const classes = useCodeStyles()
return <React.Fragment>
<div className={classes.codeContainer}>
......
......@@ -16,6 +16,7 @@
* limitations under the License.
*/
import React, {useRef, useState} from 'react'
import PropTypes from 'prop-types'
import {Card, Box, Typography, Grid, CardContent} from '@material-ui/core'
import {NumberEditQuantity} from './NumberEditQuantity'
import {StringEditQuantity} from './StringEditQuantity'
......@@ -27,6 +28,8 @@ import {SliderEditQuantity} from './SliderEditQuantity'
import { DateEditQuantity, DateTimeEditQuantity, TimeEditQuantity } from './DateTimeEditQuantity'
import RichTextEditQuantity from './RichTextEditQuantity'
import ListEditQuantity from './ListEditQuantity'
import { Code } from '../buttons/SourceDialogButton'
import { stripIndent } from '../../utils'
const enumValues = [
'Vapor deposition', 'Chemical vapor deposition', 'Metalorganic vapour phase epitaxy', 'Electrostatic spray assisted vapour deposition (ESAVD)', 'Sherardizing',
......@@ -40,6 +43,23 @@ const enumValues = [
'Immersion dip coating', 'Kiss coating', 'Metering rod (Meyer bar) coating', 'Roller coating', 'Forward roller coating', 'Reverse roll coating',
'Silk Screen coater', 'Rotary screen', 'Lithography', 'Flexography', 'Physical coating processes', 'Langmuir-Blodgett', 'Spin coating', 'Dip coating']
function Example({code, children}) {
return (
<Box display="flex" flexDirection="row" alignItems="flext-start" marginBottom={2}>
<Box width={500} marginRight={2}>
{children}
</Box>
<Code
code={stripIndent(code)}
/>
</Box>
)
}
Example.propTypes = {
code: PropTypes.string,
children: PropTypes.any
}
export function EditQuantityExamples() {
const [, setUpdate] = useState(0)
const propsRef = useRef({})
......@@ -82,91 +102,300 @@ export function EditQuantityExamples() {
<Grid item>
<Card>
<CardContent>
<Box width={800}>
<Box width={1100}>
<Grid container direction="column" spacing={1}>
<Grid item>
<StringEditQuantity {...createDefaultProps('string')} />
<Example
code={`
string:
type: string
m_annotations:
eln:
component: StringEditQuantity`}
>
<StringEditQuantity {...createDefaultProps('string')} />
</Example>
</Grid>
<Grid item>
<NumberEditQuantity {...createDefaultProps('float', {type: float})} />
<Example
code={`
float:
type: np.float64
m_annotations:
eln:
component: NumberEditQuantity`}
>
<NumberEditQuantity {...createDefaultProps('float', {type: float})} />
</Example>
</Grid>
<Grid item>
<NumberEditQuantity {...createDefaultProps('float_unit', {type: float, unit: 'meter'})} defaultDisplayUnit="bohr"/>
<Example
code={`
float_unit:
type: np.float64
unit: meter
m_annotations:
eln:
component: NumberEditQuantity
defaultDisplayUnit="bohr"`}
>
<NumberEditQuantity {...createDefaultProps('float_unit', {type: float, unit: 'meter'})} defaultDisplayUnit="bohr"/>
</Example>
</Grid>
<Grid item>
<NumberEditQuantity {...createDefaultProps('float_derived_unit', {type: float, unit: 'joule'})} defaultDisplayUnit="eV"/>
<Example
code={`
float_derived_unit:
type: np.float64
unit: joule
m_annotations:
eln:
component: NumberEditQuantity
defaultDisplayUnit="eV"`}
>
<NumberEditQuantity {...createDefaultProps('float_derived_unit', {type: float, unit: 'joule'})} defaultDisplayUnit="eV"/>
</Example>
</Grid>
<Grid item>
<NumberEditQuantity {...createDefaultProps('float_complex_unit', {type: float, unit: 'ampere / second^2 * meter'})} defaultDisplayUnit="milliampere / ms^2 * cm"/>
<Example
code={`
float_complex_unit:
type: np.float64
unit: ampere / second^2 * meter
m_annotations:
eln:
component: NumberEditQuantity
defaultDisplayUnit="milliampere / ms^2 * cm"`}
>
<NumberEditQuantity {...createDefaultProps('float_complex_unit', {type: float, unit: 'ampere / second^2 * meter'})} defaultDisplayUnit="milliampere / ms^2 * cm"/>
</Example>
</Grid>
<Grid item>
<NumberEditQuantity
{...createDefaultProps('float_with_bounds', {type: float, unit: 'second'})}
minValue={0} maxValue={10}
/>
<Example
code={`
float_with_bounds:
type: np.float64
unit: second
m_annotations:
eln:
component: NumberEditQuantity
minValue: 0
maxValue: 10`}
>
<NumberEditQuantity
{...createDefaultProps('float_with_bounds', {type: float, unit: 'second'})}
minValue={0} maxValue={10}
/>
</Example>
</Grid>
<Grid item>
<NumberEditQuantity {...createDefaultProps('int', {type: int})} />
<Example
code={`
int:
type: int
m_annotations:
eln:
component: NumberEditQuantity`}
>
<NumberEditQuantity {...createDefaultProps('int', {type: int})} />
</Example>
</Grid>
<Grid item>
<NumberEditQuantity
{...createDefaultProps('int_with_bounds', {type: int})}
minValue={0} maxValue={10}
/>
<Example
code={`
int_with_bounds:
type: int
m_annotations:
eln:
component: NumberEditQuantity
minValue: 0
maxValue: 10`}
>
<NumberEditQuantity
{...createDefaultProps('int_with_bounds', {type: int})}
minValue={0} maxValue={10}
/>
</Example>
</Grid>
<Grid item>
<BoolEditQuantity {...createDefaultProps('bool')} />
<Example
code={`
bool:
type: bool
m_annotations:
eln:
component: BoolEditQuantity`}
>
<BoolEditQuantity {...createDefaultProps('bool')} />
</Example>
</Grid>
<Grid item>
<RadioEnumEditQuantity {...createDefaultProps('radio_enum', {
type: {
type_data: ['one', 'two', 'three']
}
})} />
<Example
code={`
radio_enum:
type:
type_kind: enum
type_data:
- one
- two
- three
m_annotations:
eln:
component: RadioEnumEditQuantity`}
>
<RadioEnumEditQuantity {...createDefaultProps('radio_enum', {
type: {
type_data: ['one', 'two', 'three']
}
})} />
</Example>
</Grid>
<Grid item>
<EnumEditQuantity {...createDefaultProps('select_enum', {
type: {
type_data: ['one', 'two', 'three']
}
})} />
<Example
code={`
select_enum:
type:
type_kind: enum
type_data:
- one
- two
- three
m_annotations:
eln:
component: EnumEditQuantity`}
>
<EnumEditQuantity {...createDefaultProps('select_enum', {
type: {
type_data: ['one', 'two', 'three']
}
})} />
</Example>
</Grid>
<Grid item>
<EnumEditQuantity {...createDefaultProps('string with suggestions')} suggestions={['one', 'two', 'three']}/>
<Example
code={`
string_with_suggestions:
type: str
m_annotations:
eln:
component: EnumEditQuantity
suggestions: ['one', 'two', 'three']`}
>
<EnumEditQuantity {...createDefaultProps('string_with_suggestions')} suggestions={['one', 'two', 'three']}/>
</Example>
</Grid>
<Grid item>
<AutocompleteEditQuantity {...createDefaultProps('autocomplete_enum', {
type: {
type_data: enumValues
}
})} />
<Example
code={`
autocomplete_enum:
type:
type_kind: enum
type_data:
...
m_annotations:
eln:
component: AutocompleteEditQuantity`}
>
<AutocompleteEditQuantity {...createDefaultProps('autocomplete_enum', {
type: {
type_data: enumValues
}
})} />
</Example>
</Grid>
<Grid item>
<SliderEditQuantity {...createDefaultProps('slider')} minValue={0} maxValue={10} />
<Example
code={`
slider:
type: int
m_annotations:
eln:
component: SliderEditQuantity,
minValue: 0
maxValue: 10`}
>
<SliderEditQuantity {...createDefaultProps('slider')} minValue={0} maxValue={10} />
</Example>
</Grid>
<Grid item>
<DateTimeEditQuantity {...createDefaultProps('date_time')} />
<Example
code={`
date_time:
type: nomad.metainfo.Datetime
m_annotations:
eln:
component: DateTimeEditQuantity`}
>
<DateTimeEditQuantity {...createDefaultProps('date_time')} />
</Example>
</Grid>
<Grid item>
<DateEditQuantity {...createDefaultProps('date')} />
<Example
code={`
date:
type: nomad.metainfo.Datetime
m_annotations:
eln:
component: DateEditQuantity`}
>
<DateEditQuantity {...createDefaultProps('date')} />
</Example>
</Grid>
<Grid item>
<TimeEditQuantity {...createDefaultProps('time')} />
<Example
code={`
time:
type: nomad.metainfo.Datetime
m_annotations:
eln:
component: TimeEditQuantity`}
>
<TimeEditQuantity {...createDefaultProps('date')} />
</Example>
</Grid>
<Grid item>
<RichTextEditQuantity {...createDefaultProps('richt_text')} />
<Example
code={`
richt_text:
type: str
m_annotations:
eln:
component: TimeEditQuantity`}
>
<RichTextEditQuantity {...createDefaultProps('richt_text')} />
</Example>
</Grid>
<Grid item>
<ListEditQuantity
component={StringEditQuantity}
{...createDefaultProps('list', {shape: ['*']})}
/>
<Example
code={`
list:
type: str
shape: ['*']
m_annotations:
eln:
component: StringEditQuantity`}
>
<ListEditQuantity
component={StringEditQuantity}
{...createDefaultProps('list', {shape: ['*']})}
/>
</Example>
</Grid>
<Grid item>
<ListEditQuantity
component={StringEditQuantity}
{...createDefaultProps('list_fixed', {shape: [3]})}
/>
<Example
code={`
list_fixed:
type: str
shape: [3]
m_annotations:
eln:
component: StringEditQuantity`}
>
<ListEditQuantity
component={StringEditQuantity}
{...createDefaultProps('list_fixed', {shape: [3]})}
/>
</Example>
</Grid>
</Grid>
</Box>
......@@ -174,7 +403,7 @@ export function EditQuantityExamples() {
</Card>
</Grid>
<Grid item>
<Box margin={2} width={800}>
<Box margin={2}>
<Typography component="pre">
{JSON.stringify(sectionRef.current, null, 4)}
</Typography>
......
......@@ -708,3 +708,18 @@ export function getLabel(name) {
* the data-testid should be removed or updated to something else.
*/
export const isWaitingForUpdateTestId = 'waiting-for-update'
/**
* Removes indentation from the given multiline code string
* @param {*} code
*/
export function stripIndent(code) {
let lines = code.split('\n')
const start = lines.findIndex(line => line.trim() !== '')
lines = lines.slice(start)
if (lines.length === 0) {
return ''
}
const indent = lines[0].length - lines[0].trimStart().length
return lines.map(line => line.substring(indent)).join('\n')
}
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