Commit ada4e9f6 authored by Lauri Himanen's avatar Lauri Himanen
Browse files

Restyled the composition search.

parent 05b297ee
......@@ -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);
......
......@@ -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);
......
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