mirror of
https://gitlab.ub.uni-bielefeld.de/sfb1288inf/nopaque.git
synced 2025-06-12 17:10:41 +00:00
Add meta data recv after corpus analysis init
This commit is contained in:
@ -7,12 +7,13 @@ class CorpusAnalysisClient {
|
||||
|
||||
// socket on event for corpous analysis initialization
|
||||
socket.on("corpus_analysis_init", (response) => {
|
||||
var errorText;
|
||||
let errorText;
|
||||
|
||||
if (response.code === 200) {
|
||||
console.log(`corpus_analysis_init: ${response.code} - ${response.msg}`);
|
||||
if (this.callbacks.init != undefined) {
|
||||
this.callbacks.init(response.payload);
|
||||
this.callbacks.get_metadata(); // should hold the function getMetaData
|
||||
}
|
||||
if (this.displays.init != undefined) {
|
||||
this.displays.init.setVisibilityByStatus("success");
|
||||
@ -30,9 +31,31 @@ class CorpusAnalysisClient {
|
||||
}
|
||||
});
|
||||
|
||||
// socket on event for recieving meta
|
||||
socket.on('corpus_analysis_send_meta_data', (response) => {
|
||||
let errorText;
|
||||
|
||||
if (response.code === 200) {
|
||||
console.log(`corpus_analysis_send_meta_data: ${response.code} - ${response.msg} - ${response.desc}`);
|
||||
if (this.callbacks.recv_meta_data != undefined) {
|
||||
this.callbacks.recv_meta_data(response.payload);
|
||||
}
|
||||
} else {
|
||||
errorText = `Error ${response.code} - ${response.msg}`;
|
||||
if (this.displays.init.errorContainer != undefined) {
|
||||
this.displays.init.errorContainer.innerHTML = `<p class="red-text">` +
|
||||
`<i class="material-icons tiny">error</i> ${errorText}</p>`;
|
||||
}
|
||||
if (this.displays.init != undefined) {
|
||||
this.displays.init.setVisibilityByStatus("error");
|
||||
}
|
||||
console.error(`corpus_analysis_send_meta_data: ${errorText}`);
|
||||
}
|
||||
});
|
||||
|
||||
// socket on event for recieveing query results
|
||||
socket.on("corpus_analysis_query", (response) => {
|
||||
var errorText;
|
||||
let errorText;
|
||||
|
||||
if (response.code === 200) {
|
||||
console.log(`corpus_analysis_query: ${response.code} - ${response.msg}`);
|
||||
@ -80,6 +103,12 @@ class CorpusAnalysisClient {
|
||||
this.socket.emit("corpus_analysis_init", this.corpusId);
|
||||
}
|
||||
|
||||
getMetaData() {
|
||||
// just emits thos to tell the server to gather all meta dat infos and send
|
||||
// those back
|
||||
this.socket.emit("corpus_analysis_get_meta_data", this.corpusId);
|
||||
}
|
||||
|
||||
query(queryStr) {
|
||||
let displayOptionsData;
|
||||
let resultListOptions;
|
||||
|
@ -1,13 +1,15 @@
|
||||
class Results {
|
||||
constructor(resultsJSON, resultsList) {
|
||||
constructor(resultsJSON, resultsList , metaDataJSON) {
|
||||
this.resultsJSON = resultsJSON;
|
||||
this.resultsList = resultsList;
|
||||
this.metaDataJSON = metaDataJSON
|
||||
}
|
||||
|
||||
clearAll() {
|
||||
this.resultsList.clear();
|
||||
this.resultsList.update();
|
||||
this.resultsJSON.init();
|
||||
this.metaDataJSON.init();
|
||||
}
|
||||
}
|
||||
|
||||
@ -73,4 +75,14 @@ class ResultsJSON {
|
||||
// start actual download
|
||||
this.download(downloadElement, dataStr, resultFilename, "text/json", ".json")
|
||||
}
|
||||
}
|
||||
|
||||
class MetaDataJSON {
|
||||
// Sets empty object structure. Also usefull to delete old results.
|
||||
init() {
|
||||
this["corpus_name"] = "";
|
||||
this["corpus_description"] = "";
|
||||
this["corpus_creation_date"] = "";
|
||||
this["corpus_properties"] = "";
|
||||
}
|
||||
}
|
@ -1,3 +1,11 @@
|
||||
function recvMetaData(payload) {
|
||||
results.metaDataJSON.corpus_name = payload.corpus_name;
|
||||
results.metaDataJSON.corpus_description = payload.corpus_description;
|
||||
results.metaDataJSON.corpus_creation_date = payload.corpus_creation_date;
|
||||
results.metaDataJSON.corpus_properties = payload.corpus_properties;
|
||||
console.log(results.metaDataJSON);
|
||||
}
|
||||
|
||||
function querySetup(payload) {
|
||||
// This is called when a query was successfull
|
||||
// some hiding and resetting
|
||||
|
Reference in New Issue
Block a user