Skip to content
GitLab
Projects
Groups
Snippets
/
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
Menu
Open sidebar
nomad-lab
encyclopedia-gui
Commits
56fcf30e
Commit
56fcf30e
authored
Dec 22, 2020
by
Iker Hurtado
Browse files
Search query modification (inside SearchBox) event mechanism enabling to update the search
parent
5e42bb06
Pipeline
#90018
skipped with stage
Changes
4
Pipelines
1
Hide whitespace changes
Inline
Side-by-side
client/css/styles.css
View file @
56fcf30e
...
...
@@ -373,7 +373,7 @@ div.title span.unfolded::before{
.search-main-side
{
transition
:
opacity
1
s
;
transition
:
opacity
0.8
s
;
}
.search-box
{
...
...
@@ -585,7 +585,7 @@ div.title span.unfolded::before{
}
.filter-quantity-box
>
*
{
transition
:
opacity
1
s
;
transition
:
opacity
0.8
s
;
}
.field-title
{
...
...
client/src/search-mod/MaterialList.view.js
View file @
56fcf30e
...
...
@@ -194,7 +194,7 @@ class MaterialList {
LoadingPopup
.
show
();
rootQueryObj
=
'
elements HAS ALL "Si", "Cl"
'
;
//
rootQueryObj = 'elements HAS ALL "Si", "Cl"';
console
.
log
(
'
SENDING:
'
,
rootQueryObj
);
let
bulkReq
=
util
.
serverReqPOST
(
util
.
getSearchURL
(),
JSON
.
stringify
({
query
:
rootQueryObj
})
,
bulke
=>
{
let
bulkData
=
JSON
.
parse
(
bulke
.
target
.
response
);
console
.
log
(
'
GETTING:
'
,
bulkData
);
...
...
client/src/search-mod/NewSearchMod.js
View file @
56fcf30e
...
...
@@ -131,6 +131,9 @@ class NewSearchMod {
this
.
materialNameBox
.
enableInput
();
this
.
elementTable
.
deselectAllElements
();
});
this
.
searchBox
.
setSearchQueryChangeListener
(
()
=>
{
this
.
sendQuery
();
});
this
.
addButtonsBox
=
this
.
element
.
querySelector
(
'
.add-buttons
'
);
this
.
addElementButton
=
this
.
addButtonsBox
.
querySelector
(
'
.element-add-btn
'
);
...
...
@@ -192,7 +195,7 @@ class NewSearchMod {
this
.
filterPanel
.
setPropsChangeListener
(
propsMap
=>
{
console
.
log
(
'
filterPanel.change Event propsMap:
'
,
propsMap
);
this
.
sendQuery
(
propsMap
);
this
.
sendQuery
();
})
this
.
materialList
=
new
MaterialList
();
...
...
@@ -311,8 +314,6 @@ class NewSearchMod {
}
});
// gray-out events for the Properties panel and Composition panel
...
...
@@ -337,9 +338,11 @@ class NewSearchMod {
sendQuery
(){
console
.
log
(
'
sendQuery
'
);
//let searchQuery = this.getOptimadeQueryFromSearchQuery(this.searchQuery, this.queryTypes);
//this.materialList.initSearch(searchQuery);
//**** The optimade query must be formed from the search box and the properties selected
let
optimadeQuery
=
this
.
searchBox
.
getOptimadeQuery
();
// + this.filterPanel.getValues()
console
.
log
(
'
sendQuery optimadeQuery:
'
,
optimadeQuery
);
this
.
materialList
.
initSearch
(
optimadeQuery
);
}
...
...
client/src/search-mod/SearchBox.view.js
View file @
56fcf30e
...
...
@@ -85,6 +85,22 @@ class SearchBox{
}
getOptimadeQuery
(){
if
(
this
.
searchQuery
.
length
===
0
||
!
isQueryWellFormed
(
this
.
searchQuery
))
return
''
;
else
return
'
elements HAS ALL "Si", "Cl"
'
;
function
isQueryWellFormed
(
searchQuery
){
const
openingParIndex
=
searchQuery
.
indexOf
(
'
(
'
)
const
closingParIndex
=
searchQuery
.
indexOf
(
'
)
'
)
return
(
openingParIndex
<
0
)
||
// there are no paratheses or
// they are in right position
(
openingParIndex
>=
0
&&
openingParIndex
<
closingParIndex
+
1
)
}
}
setBoolOperator
(
operator
){
this
.
currentOperator
=
operator
;
}
...
...
@@ -102,6 +118,7 @@ class SearchBox{
}
console
.
log
(
'
this.updateSearchQuery:
'
,
this
.
searchQuery
,
this
.
queryTypes
);
this
.
searchQueryBox
.
innerHTML
=
html
;
this
.
searchQueryChangeListener
();
}
...
...
@@ -188,7 +205,7 @@ class SearchBox{
return
true
;
}
setCleanSearchQueryListener
(
listener
){
this
.
cleanSearchQueryListener
=
listener
;
}
...
...
@@ -197,6 +214,10 @@ class SearchBox{
setRemoveElementListener
(
listener
)
{
this
.
removeElementListener
=
listener
;
}
setSearchQueryChangeListener
(
listener
)
{
this
.
searchQueryChangeListener
=
listener
;
}
}
...
...
Write
Preview
Supports
Markdown
0%
Try again
or
attach a new 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