Skip to content
GitLab
Menu
Projects
Groups
Snippets
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
Menu
Open sidebar
nomad-lab
nomad-FAIR
Commits
9148e425
Commit
9148e425
authored
Sep 14, 2020
by
Markus Scheidgen
Browse files
Added custom 404 error message for MP entries.
parent
bd83d704
Pipeline
#82122
passed with stages
in 21 minutes and 22 seconds
Changes
2
Pipelines
1
Hide whitespace changes
Inline
Side-by-side
gui/src/components/domains.js
View file @
9148e425
...
...
@@ -204,14 +204,14 @@ export const domains = ({
supportsSort
:
true
},
'
ems.chemical
'
:
{
label
:
'
Material name
'
,
label
:
'
Material name
'
},
'
ems.method
'
:
{
label
:
'
Method
'
,
supportsSort
:
true
},
'
ems.data_type
'
:
{
label
:
'
Data
'
,
label
:
'
Data
'
},
'
ems.origin_time
'
:
{
label
:
'
Date
'
,
...
...
gui/src/components/entry/EntryQuery.js
View file @
9148e425
import
React
from
'
react
'
import
PropTypes
from
'
prop-types
'
import
{
withStyles
,
Typography
}
from
'
@material-ui/core
'
import
{
withStyles
,
Typography
,
Link
}
from
'
@material-ui/core
'
import
{
compose
}
from
'
recompose
'
import
{
withApi
,
DoesNotExist
}
from
'
../api
'
import
{
withRouter
}
from
'
react-router
'
...
...
@@ -22,7 +22,8 @@ class EntryQuery extends React.Component {
}
static
defaultState
=
{
doesNotExist
:
false
doesNotExist
:
false
,
queryParams
:
null
}
state
=
{...
EntryQuery
.
defaultState
}
...
...
@@ -43,7 +44,7 @@ class EntryQuery extends React.Component {
}
}).
catch
(
error
=>
{
if
(
error
.
name
===
'
DoesNotExist
'
)
{
this
.
setState
({
doesNotExist
:
true
})
this
.
setState
({
doesNotExist
:
true
,
queryParams
:
queryParams
})
}
else
{
this
.
props
.
raiseError
(
error
)
}
...
...
@@ -63,12 +64,19 @@ class EntryQuery extends React.Component {
render
()
{
const
{
classes
,
api
}
=
this
.
props
const
{
doesNotExist
}
=
this
.
state
const
{
doesNotExist
,
queryParams
}
=
this
.
state
let
message
=
'
loading ...
'
if
(
doesNotExist
)
{
if
(
api
.
isLoggedIn
)
{
console
.
log
(
queryParams
)
if
(
queryParams
&&
queryParams
[
'
external_id
'
]
&&
queryParams
[
'
external_id
'
].
startsWith
(
'
mp-
'
))
{
message
=
<
React
.
Fragment
>
This
particular
calculation
<
Link
href
=
{
`https://materialsproject.org/tasks/
${
queryParams
[
'
external_id
'
]}
#`
}
>
{
queryParams
[
'
external_id
'
]}
<
/Link> has not yet been provided to NOMAD by the Materials Project
.
<
/React.Fragment
>
}
else
if
(
api
.
isLoggedIn
)
{
message
=
`
This URL points to an entry that either does not exist, or that you are not
authorized to see.`
...
...
Write
Preview
Supports
Markdown
0%
Try again
or
attach a new file
.
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment