Skip to content
Snippets Groups Projects
Commit a1439f37 authored by Stephan Porada's avatar Stephan Porada :speech_balloon:
Browse files

Set callbac kfor match_context

parent bbcf5c53
No related branches found
No related tags found
No related merge requests found
...@@ -5,7 +5,7 @@ class CorpusAnalysisClient { ...@@ -5,7 +5,7 @@ class CorpusAnalysisClient {
this.displays = {}; this.displays = {};
this.socket = socket; this.socket = socket;
// socket on event fpr corpous analysis initialization // socket on event for corpous analysis initialization
socket.on("corpus_analysis_init", (response) => { socket.on("corpus_analysis_init", (response) => {
var errorText; var errorText;
...@@ -20,7 +20,8 @@ class CorpusAnalysisClient { ...@@ -20,7 +20,8 @@ class CorpusAnalysisClient {
} else { } else {
errorText = `Error ${response.code} - ${response.msg}`; errorText = `Error ${response.code} - ${response.msg}`;
if (this.displays.init.errorContainer != undefined) { if (this.displays.init.errorContainer != undefined) {
this.displays.init.errorContainer.innerHTML = `<p class="red-text"><i class="material-icons tiny">error</i> ${errorText}</p>`; this.displays.init.errorContainer.innerHTML = `<p class="red-text">` +
`<i class="material-icons tiny">error</i> ${errorText}</p>`;
} }
if (this.displays.init != undefined) { if (this.displays.init != undefined) {
this.displays.init.setVisibilityByStatus("error"); this.displays.init.setVisibilityByStatus("error");
...@@ -45,7 +46,8 @@ class CorpusAnalysisClient { ...@@ -45,7 +46,8 @@ class CorpusAnalysisClient {
errorText = `Error ${response.payload.code} - ${response.payload.msg}`; errorText = `Error ${response.payload.code} - ${response.payload.msg}`;
nopaque.flash("error", errorText); nopaque.flash("error", errorText);
if (this.displays.query.errorContainer != undefined) { if (this.displays.query.errorContainer != undefined) {
this.displays.query.errorContainer.innerHTML = `<p class="red-text"><i class="material-icons tiny">error</i> ${errorText}</p>`; this.displays.query.errorContainer.innerHTML = `<p class="red-text">`+
`<i class="material-icons tiny">error</i> ${errorText}</p>`;
} }
if (this.displays.query != undefined) { if (this.displays.query != undefined) {
this.displays.query.setVisibilityByStatus("error"); this.displays.query.setVisibilityByStatus("error");
...@@ -54,13 +56,18 @@ class CorpusAnalysisClient { ...@@ -54,13 +56,18 @@ class CorpusAnalysisClient {
} }
}); });
socket.on("corpus_analysis_query_results", (response) => { socket.on("corpus_analysis_query_results", (response) => {
if (this.callbacks.query_results != undefined) {this.callbacks.query_results(response.payload);} if (this.callbacks.query_results != undefined) {
this.callbacks.query_results(response.payload);
}
}); });
// TODO: set callback for this socket.on("corpus_analysis_inspect_match", (response) => {
// get context of one match if inspected via socket.io if (this.callbacks.query_match_context != undefined) {
socket.on("corpus_analysis_inspect_match", (response) => { results.resultsList.showMatchContext(response)}); this.callbacks.query_match_context(response);
}
});
} }
init() { init() {
......
...@@ -360,6 +360,9 @@ ...@@ -360,6 +360,9 @@
client.setCallback("query_results", (payload) => { client.setCallback("query_results", (payload) => {
queryRenderResults(payload); queryRenderResults(payload);
}); });
client.setCallback("query_match_context", (payload) => {
results.resultsList.showMatchContext(payload);
})
// Trigger corpus analysis initialization on server side // Trigger corpus analysis initialization on server side
client.init(); client.init();
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment