Skip to content
GitLab
Menu
Projects
Groups
Snippets
Loading...
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
Menu
Open sidebar
nomad-lab
encyclopedia-gui
Commits
ada4e9f6
Commit
ada4e9f6
authored
Apr 01, 2021
by
Lauri Himanen
Browse files
Restyled the composition search.
parent
05b297ee
Changes
2
Hide whitespace changes
Inline
Side-by-side
client/src/search-mod/MaterialList.view.js
View file @
ada4e9f6
...
...
@@ -42,6 +42,7 @@ class MaterialList {
this
.
matMap
=
new
Map
();
//this.currentSystemType = 'bulk';
this
.
optimadeQuery
=
null
;
this
.
queries
=
[];
this
.
noResultsBox
=
document
.
createElement
(
'
div
'
);
this
.
noResultsBox
.
style
=
'
text-align: center; font-weight: bold
'
...
...
@@ -77,7 +78,6 @@ class MaterialList {
initSearch
(
optimadeQuery
){
this
.
optimadeQuery
=
optimadeQuery
;
this
.
_search
();
}
...
...
@@ -99,8 +99,11 @@ class MaterialList {
//reqJson.search_by.restricted = (restrictedEl.checked ? '1' : '0');
reqJson
.
search_by
.
restricted
=
'
0
'
;
console
.
log
(
'
SEARCHING:
'
,
reqJson
);
const
timestamp
=
Date
.
now
();
this
.
queries
.
push
(
timestamp
);
document
.
querySelector
(
'
#syntax-error
'
).
style
.
visibility
=
'
hidden
'
;
this
.
queries
=
true
;
fetch
(
util
.
getSearchURL
(),
{
method
:
'
POST
'
,
headers
:
{
'
Content-Type
'
:
'
application/json;charset=utf-8
'
},
...
...
@@ -110,6 +113,9 @@ class MaterialList {
.
then
(
result
=>
{
console
.
log
(
'
GETTING:
'
,
result
);
// If a newer query has been sent, ignore the results of an old query.
console
.
log
(
timestamp
)
// Update state
this
.
noResults
=
(
result
.
results
.
length
===
0
);
this
.
_setMatList
(
result
.
results
);
...
...
client/src/search-mod/NewSearchMod.js
View file @
ada4e9f6
...
...
@@ -271,13 +271,9 @@ class NewSearchMod {
//**** The optimade query must be formed from the search box and the properties selected
const
allowOtherElements
=
document
.
getElementById
(
'
allow-other-elements
'
).
checked
;
console
.
log
(
allowOtherElements
)
const
searchBoxOptimadeQuery
=
this
.
searchBox
.
getOptimadeQuery
(
allowOtherElements
);
const
propsOptimadeQuery
=
getOptimadeQueryFromProps
(
this
.
filterPanel
.
getValues
());
const
sep
=
(
searchBoxOptimadeQuery
!==
''
&&
propsOptimadeQuery
!==
''
?
'
AND
'
:
''
);
//console.log(searchBoxOptimadeQuery)
//console.log(sep)
//console.log(propsOptimadeQuery)
// If one of them is empty, it and sep variable are ''
this
.
materialList
.
initSearch
(
searchBoxOptimadeQuery
+
sep
+
propsOptimadeQuery
);
...
...
Write
Preview
Markdown
is supported
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