mirror of
https://gitlab.ub.uni-bielefeld.de/sfb1288inf/nopaque.git
synced 2025-06-13 09:30:40 +00:00
Enhance pj_analyse
This commit is contained in:
@ -47,13 +47,24 @@ class CorpusAnalysisClient {
|
||||
this.socket.emit("pj_corpus_analysis_init", this.corpusId);
|
||||
}
|
||||
|
||||
query(query) {
|
||||
query(queryStr) {
|
||||
if (this.displays.query.errorContainer != undefined) {this.displays.query.errorContainer.innerHTML == "";}
|
||||
if (this.displays.query != undefined) {this.displays.query.setVisibilityByStatus("waiting");}
|
||||
nopaque.socket.emit("pj_corpus_analysis_query", query);
|
||||
nopaque.socket.emit("pj_corpus_analysis_query", queryStr);
|
||||
}
|
||||
|
||||
getQueryStr(queryFormElement) {
|
||||
// gets query
|
||||
let queryFormData;
|
||||
let queryStr;
|
||||
queryFormData = new FormData(queryFormElement);
|
||||
queryStr = queryFormData.get("query-form-query");
|
||||
return queryStr
|
||||
}
|
||||
|
||||
setCallback(type, callback) {
|
||||
// saves callback functions into an object. Key is function type, callback
|
||||
// is the callback function
|
||||
this.callbacks[type] = callback;
|
||||
}
|
||||
|
||||
|
31
app/static/js/nopaque.callbacks.js
Normal file
31
app/static/js/nopaque.callbacks.js
Normal file
@ -0,0 +1,31 @@
|
||||
function querySetup(payload) {
|
||||
// This is called when a query was successfull
|
||||
console.log("Query setup.");
|
||||
console.log(payload);
|
||||
queryResultsDeterminateElement.style.width = "0%";
|
||||
receivedMatchNumElement.innerText = "0";
|
||||
textLookupNumElement.innerText = "0";
|
||||
matchNumElement.innerText = payload.num_matches;
|
||||
results = {};
|
||||
results["matches"] = []; // list of all c with lc and rc
|
||||
results["cpos_lookup"] = {}; // object contains all cpos as key value pair
|
||||
results["text_lookup"] = {}; // same as above for all text ids
|
||||
results[]
|
||||
}
|
||||
|
||||
function queryRenderResults(payload) {
|
||||
// This is called when results are transmitted.
|
||||
console.log("CHUNK:", payload.chunk);
|
||||
console.log("RESULTS:", results);
|
||||
if (payload.progress === 100) {
|
||||
queryResultsProgressElement.classList.add("hide");
|
||||
}
|
||||
queryResultsDeterminateElement.style.width = `${payload.progress}%`;
|
||||
results.matches.push(...payload.chunk.matches);
|
||||
receivedMatchNumElement.innerText = `${results.matches.length}`;
|
||||
// incorporating new chunk results into full results
|
||||
Object.assign(results.cpos_lookup, payload.chunk.cpos_lookup);
|
||||
Object.assign(results.text_lookup, payload.chunk.text_lookup);
|
||||
|
||||
textLookupNumElement.innerText = `${Object.keys(results.text_lookup).length}`;
|
||||
}
|
Reference in New Issue
Block a user