Fix inspect activation on queryFinished

This commit is contained in:
Stephan Porada 2020-03-19 11:04:36 +01:00
parent ebe598312f
commit 7de4b391df
2 changed files with 19 additions and 22 deletions

View File

@ -60,6 +60,9 @@ function sendQuery(event) {
// Function used when CQP server sends back the query results using socketio
function recieveResults(response) {
let toolTipInfoElement;
queryFinished = false;
// ERROR code checking
if (response["code"] === 0) {
@ -134,14 +137,12 @@ function recieveResults(response) {
console.log(queryStatus);
queryResultsDeterminateElement.style["width"] = `${queryStatus}%`;
console.log(queryResultsDeterminateElement.style["width"]);
let toolTipInfoElement = document.getElementById("tool-tip-info");
toolTipInfoElement.addEventListener("mouseover", function(event) {
M.Tooltip.init(toolTipInfoElement, {"html": `<p>The Server is still sending you your results. Functions like "Export Results" and "Match Inspect" will be available after all matches have been loaded.</p>`,
"inDuration": 1500,
"margin": 15,
"position": "top",
"transitionMovement": 0})
});
toolTipInfoElement = document.getElementById("tool-tip-info");
M.Tooltip.init(toolTipInfoElement, {"html": `<p>The Server is still sending you your results. Functions like "Export Results" and "Match Inspect" will be available after all matches have been loaded.</p>`,
"inDuration": 1500,
"margin": 15,
"position": "top",
"transitionMovement": 0});
// enable download and inspect when query is finished
// also sets queryFinished to true
if (queryStatus === 100) {
@ -178,6 +179,7 @@ function inspect(dataIndex) {
function showMatchContext(message) {
console.log("### match_context ###");
console.log("Incoming data:", message);
let contextResultsElement = document.getElementById("context-results");
contextResultsElement.innerHTML = "<p>&nbsp;</p>";
document.getElementById("context-modal-loading").classList.add("hide");
document.getElementById("context-modal-ready").classList.remove("hide");

View File

@ -237,7 +237,6 @@ server side -->
var loadingModal;
var exportModal;
// create some global variables
var hitsPerPage;
var result;
var resultList;
var queryFinished;
@ -246,9 +245,8 @@ server side -->
var queryResultsDeterminateElement;
var queryResultsTableElement;
var queryLoadingElement;
var toolTipInfoElement;
var contextResultsElement;
var queryFormElement;
var hitsPerPageInputElement;
document.addEventListener("DOMContentLoaded", function() {
contextModal = M.Modal.init(document.getElementById("context-modal"),
@ -277,23 +275,20 @@ server side -->
// getting some HTML-elements to use/hide/remove/show or add some other
// elements to them.
// These elements will be used inside functions in nopaque.analyse_corpus.js
var queryResultsDeterminateElement = document.getElementsByClassName("determinate")[0];
var queryResultsTableElement = document.getElementById("recieved-query-results");
var queryLoadingElement = document.getElementById("getting-query-results");
var exportQueryResultsElement = document.getElementById("export-query-results");
var contextResultsElement = document.getElementById("context-results");
queryResultsDeterminateElement = document.getElementsByClassName("determinate")[0];
queryResultsTableElement = document.getElementById("recieved-query-results");
queryLoadingElement = document.getElementById("getting-query-results");
exportQueryResultsElement = document.getElementById("export-query-results");
// socket.io analysis submit to the CQP server
let queryFormElement = document.getElementById("query-form");
queryFormElement = document.getElementById("query-form");
queryFormElement.addEventListener("submit", sendQuery);
// get context of one match if inspected
nopaque.socket.on("match_context", showMatchContext);
// live update of hits per page
var hitsPerPageInputElement = document.getElementById("hits-per-page");
// live update of hits per page if hits per page value is changed
hitsPerPageInputElement = document.getElementById("hits-per-page");
hitsPerPageInputElement.onchange = changeHitsPerPage;
// live update of lr context per item if context value is changed