Merge branch 'development' of gitlab.ub.uni-bielefeld.de:sfb1288inf/opaque into development

This commit is contained in:
Patrick Jentsch 2019-12-04 11:03:49 +01:00
commit 19651433cd

View File

@ -103,11 +103,23 @@
</div> </div>
</div> </div>
<div class="col s12 m9"> <div class="col s12 m9 hide" id="getting-query-results">
<div class="card">
<div class="card-content">
<span class="card-title">Fetching your results!</span>
<div>
<div class="progress">
<div class="indeterminate"></div>
</div>
</div>
</div>
</div>
</div>
<div class="col s12 m9 hide" id="recieved-query-results">
<div class="card"> <div class="card">
<div class="card-content"> <div class="card-content">
<span class="card-title">Query Results</span> <span class="card-title">Query Results</span>
<div>
<table> <table>
<thead> <thead>
<tr> <tr>
@ -119,7 +131,6 @@
</thead> </thead>
<tbody id="query-results"></tbody> <tbody id="query-results"></tbody>
</table> </table>
</div>
</div> </div>
</div> </div>
</div> </div>
@ -195,6 +206,8 @@
var queryFormSubmitElement = document.getElementById("query-form-submit"); var queryFormSubmitElement = document.getElementById("query-form-submit");
var queryResultsElement = document.getElementById("query-results"); var queryResultsElement = document.getElementById("query-results");
var contextResultsElement = document.getElementById("context-results"); var contextResultsElement = document.getElementById("context-results");
var queryLoadingElement = document.getElementById("getting-query-results");
var queryResultsTableElement = document.getElementById("recieved-query-results");
queryFormSubmitElement.addEventListener("click", function(event) { queryFormSubmitElement.addEventListener("click", function(event) {
event.preventDefault(); event.preventDefault();
let formData = new FormData(queryFormElement); let formData = new FormData(queryFormElement);
@ -202,12 +215,16 @@
"hits_per_page": formData.get("hits_per_page"), "hits_per_page": formData.get("hits_per_page"),
"query": formData.get("query")}; "query": formData.get("query")};
socket.emit("corpus_analysis", queryData); socket.emit("corpus_analysis", queryData);
queryLoadingElement.classList.remove("hide");
queryResultsTableElement.classList.add("hide");
M.toast({html: "Query has been sent!"}); M.toast({html: "Query has been sent!"});
}); });
socket.on("corpus_analysis", function(message) { socket.on("corpus_analysis", function(message) {
console.log("### corpus_analysis ###"); console.log("### corpus_analysis ###");
console.log(message); console.log(message);
queryLoadingElement.classList.add("hide");
queryResultsTableElement.classList.remove("hide");
queryResultsElement.innerHTML = ""; queryResultsElement.innerHTML = "";
// Reset related global values // Reset related global values
@ -216,6 +233,7 @@
tokenElements = null; tokenElements = null;
if (message === null) { if (message === null) {
queryResultsTableElement.classList.add("hide");
M.toast({"html": "No results for this query!", "classes": "red"}); M.toast({"html": "No results for this query!", "classes": "red"});
return; return;
} }