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

Merge branch 'v0.9.5' into 'master'

Merge for release v0.9.5

See merge request !210
parents 5e8b9dbe 7f428e30
Pipeline #86353 passed with stages
in 1 minute and 19 seconds
{
"name": "nomad-fair-gui",
"version": "0.9.4",
"version": "0.9.5",
"commit": "e98694e",
"private": true,
"dependencies": {
......
......@@ -9,7 +9,7 @@ window.nomadEnv = {
'matomoUrl': 'https://nomad-lab.eu/fairdi/stat',
'matomoSiteId': '2',
'version': {
'label': '0.9.4',
'label': '0.9.5',
'isBeta': false,
'isTest': true,
'usesBetaData': true,
......
......@@ -5,13 +5,14 @@ import classNames from 'classnames'
import { MuiThemeProvider, withStyles, makeStyles } from '@material-ui/core/styles'
import { LinearProgress, MenuList, Typography,
AppBar, Toolbar, Button, DialogContent, DialogTitle, DialogActions, Dialog, Tooltip,
Snackbar, SnackbarContent, FormGroup, FormControlLabel, Switch, IconButton, Link as MuiLink } from '@material-ui/core'
Snackbar, SnackbarContent, FormGroup, FormControlLabel, Switch, IconButton, Link as MuiLink, Menu } from '@material-ui/core'
import { Route, Link, withRouter, useLocation } from 'react-router-dom'
import BackupIcon from '@material-ui/icons/Backup'
import SearchIcon from '@material-ui/icons/Search'
import UserDataIcon from '@material-ui/icons/AccountCircle'
import AboutIcon from '@material-ui/icons/Home'
import FAQIcon from '@material-ui/icons/QuestionAnswer'
import ForumIcon from '@material-ui/icons/QuestionAnswer'
import FAQIcon from '@material-ui/icons/LiveHelp'
import EncyclopediaIcon from '@material-ui/icons/Language'
import MetainfoIcon from '@material-ui/icons/Info'
import DocIcon from '@material-ui/icons/Help'
......@@ -19,6 +20,7 @@ import CodeIcon from '@material-ui/icons/Code'
import TermsIcon from '@material-ui/icons/Assignment'
import UnderstoodIcon from '@material-ui/icons/Check'
import AnalyticsIcon from '@material-ui/icons/ShowChart'
import MoreIcon from '@material-ui/icons/MoreVert'
import {help as searchHelp, default as SearchPage} from './search/SearchPage'
import HelpDialog from './Help'
import { ApiProvider, withApi, apiContext } from './api'
......@@ -90,18 +92,17 @@ function MainMenuItem({tooltip, title, path, href, onClick, icon}) {
const classes = useMainMenuItemStyles()
const selected = path === pathname || (path !== '/' && pathname.startsWith(path))
const rest = path ? {to: path, component: Link} : {href: href}
return <Tooltip title={tooltip}>
<Button
className={classes.button}
color={selected ? 'primary' : 'default'}
size="small"
startIcon={icon}
onClick={onClick}
{...rest}
>
{title}
</Button>
</Tooltip>
const button = <Button
className={classes.button}
color={selected ? 'primary' : 'default'}
size="small"
startIcon={icon}
onClick={onClick}
{...rest}
>
{title}
</Button>
return tooltip ? <Tooltip title={tooltip}>{button}</Tooltip> : button
}
MainMenuItem.propTypes = {
'tooltip': PropTypes.string.isRequired,
......@@ -154,7 +155,7 @@ function BetaSnack() {
</Snackbar>
}
function Consent() {
function Consent(moreProps) {
const [cookies, setCookie] = useCookies()
const [accepted, setAccepted] = useState(cookies['terms-accepted'])
const [optOut, setOptOut] = useState(cookies['tracking-enabled'] === 'false')
......@@ -198,6 +199,7 @@ function Consent() {
onClick={handleOpen}
tooltip="NOMAD's terms"
icon={<TermsIcon/>}
{...moreProps}
/>
<Dialog
disableBackdropClick disableEscapeKeyDown
......@@ -229,15 +231,59 @@ function Consent() {
)
}
function MoreMenu(props) {
const [anchor, setAnchor] = useState(false)
const handleClose = () => setAnchor(null)
return <React.Fragment>
<MainMenuItem
title="More"
onClick={e => setAnchor(e.currentTarget)}
icon={<MoreIcon/>} />
<Menu
id="simple-menu"
anchorEl={anchor}
keepMounted
open={Boolean(anchor)}
onClose={handleClose}
>
<MainMenuItem
title="Forum"
onClick={handleClose}
href="https://matsci.org/c/nomad/"
tooltip="The NOMAD user/developer forum on matsci.org"
icon={<ForumIcon/>}
/>
<MainMenuItem
title="FAQ"
onClick={handleClose}
href="https://nomad-lab.eu/repository-archive-faqs"
tooltip="Frequently Asked Questions (FAQ)"
icon={<FAQIcon/>}
/>
<MainMenuItem
title="Docs"
onClick={handleClose}
href={`${appBase}/docs/index.html`}
tooltip="The NOMAD documentation"
icon={<DocIcon/>}
/>
<MainMenuItem
title="Sources"
onClick={handleClose}
href="https://gitlab.mpcdf.mpg.de/nomad-lab/nomad-FAIR"
tooltip="NOMAD's Gitlab project"
icon={<CodeIcon/>}
/>
</Menu>
</React.Fragment>
}
const useMainMenuStyles = makeStyles(theme => ({
root: {
display: 'inline-flex',
padding: 0,
width: '100%',
backgroundColor: 'white'
},
divider: {
width: theme.spacing(3)
}
}))
......@@ -297,32 +343,14 @@ function MainMenu() {
tooltip="Browse the archive schema"
icon={<MetainfoIcon/>}
/>
<div className={classes.divider} />
<MainMenuItem
title="About"
path="/"
tooltip="NOMAD Repository and Archive"
tooltip="About the NOMAD Repository and Archive"
icon={<AboutIcon/>}
/>
<MainMenuItem
title="FAQ"
href="https://nomad-lab.eu/repository-archive-faqs"
tooltip="Frequently Asked Questions (FAQ)"
icon={<FAQIcon/>}
/>
<MainMenuItem
title="Docs"
href={`${appBase}/docs/index.html`}
tooltip="The NOMAD documentation"
icon={<DocIcon/>}
/>
<MainMenuItem
title="Sources"
href="https://gitlab.mpcdf.mpg.de/nomad-lab/nomad-FAIR"
tooltip="NOMAD's Gitlab project"
icon={<CodeIcon/>}
/>
<Consent />
<MoreMenu />
</MenuList>
}
......
......@@ -255,11 +255,11 @@ export class EntryListUnstyled extends React.Component {
<Quantity className={classes.entryDetailsRow} column>
<Quantity quantity='comment' placeholder='no comment' data={row} />
<Quantity quantity='references' placeholder='no references' data={row}>
<div style={{display: 'inline-grid'}}>
{row.references && <div style={{display: 'inline-grid'}}>
{(row.references || []).map(ref => <Typography key={ref} noWrap>
<a href={ref}>{ref}</a>
<Link href={ref}>{ref}</Link>
</Typography>)}
</div>
</div>}
</Quantity>
<Quantity quantity='authors' data={row}>
<Typography>
......
......@@ -800,6 +800,12 @@ def read_partial_archive_from_mongo(entry_id: str, as_dict=False) -> Union[Entry
return EntryArchive.m_from_dict(archive_dict)
def delete_partial_archives_from_mongo(entry_ids: List[str]):
mongo_db = infrastructure.mongo_client[config.mongo.db_name]
mongo_collection = mongo_db['archive']
mongo_collection.delete_many(dict(_id={'$in': entry_ids}))
def read_partial_archives_from_mongo(entry_ids: List[str], as_dict=False) -> Dict[str, Union[EntryArchive, Dict]]:
'''
Reads the partial archives for a set of entries of the same upload.
......
......@@ -271,7 +271,7 @@ datacite = NomadConfig(
)
meta = NomadConfig(
version='0.9.4',
version='0.9.5',
commit=gitinfo.commit,
release='devel',
default_domain='dft',
......
......@@ -47,7 +47,7 @@ from nomad.processing.base import Proc, process, task, PENDING, SUCCESS, FAILURE
from nomad.parsing.parsers import parser_dict, match_parser
from nomad.normalizing import normalizers
from nomad.datamodel import EntryArchive, EditableUserMetadata
from nomad.archive import query_archive, write_partial_archive_to_mongo
from nomad.archive import query_archive, write_partial_archive_to_mongo, delete_partial_archives_from_mongo
from nomad.datamodel.encyclopedia import EncyclopediaMetadata
......@@ -772,6 +772,13 @@ class Upload(Proc):
upload_size=self.upload_files.size):
search.delete_upload(self.upload_id)
with utils.timer(
logger, 'upload partial archives', step='files',
upload_size=self.upload_files.size):
calc_ids = [calc.calc_id for calc in Calc.objects(upload_id=self.upload_id)]
delete_partial_archives_from_mongo(calc_ids)
with utils.timer(
logger, 'upload deleted', step='files',
upload_size=self.upload_files.size):
......@@ -782,7 +789,7 @@ class Upload(Proc):
@process
def delete_upload(self):
'''
Deletes of the upload, including its processing state and
Deletes the upload, including its processing state and
staging files. This starts the celery process of deleting the upload.
'''
self.delete_upload_local()
......
apiVersion: v1
appVersion: "0.9.4"
appVersion: "0.9.5"
description: A Helm chart for Kubernetes that only runs nomad services and uses externally hosted databases.
name: nomad
version: 0.9.4
version: 0.9.5
## Default values for nomad@FAIRDI
version:
label: "0.9.4"
label: "0.9.5"
isTest: false
isBeta: false
usesBetaData: false
......
......@@ -306,8 +306,14 @@ class TestUploads:
rv = api.get('/uploads/%s' % upload_id, headers=test_user_auth)
assert rv.status_code == 404
assert Upload.objects(upload_id=upload_id).first() is None
assert Calc.objects(upload_id=upload_id).count() is 0
mongo_db = infrastructure.mongo_client[config.mongo.db_name]
mongo_collection = mongo_db['archive']
assert mongo_collection.find({}).count() == 0
upload_files = UploadFiles.get(upload_id)
assert upload_files is None or isinstance(upload_files, PublicUploadFiles)
......
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