From a1439f37d700d7381243c5b43a1394903827fb29 Mon Sep 17 00:00:00 2001 From: Stephan Porada Date: Thu, 23 Apr 2020 10:37:44 +0200 Subject: [PATCH 1/5] Set callbac kfor match_context --- app/static/js/nopaque.CorpusAnalysisClient.js | 21 ++++++++++++------- app/templates/corpora/analyse_corpus.html.j2 | 3 +++ 2 files changed, 17 insertions(+), 7 deletions(-) diff --git a/app/static/js/nopaque.CorpusAnalysisClient.js b/app/static/js/nopaque.CorpusAnalysisClient.js index 60e57369..268ba048 100644 --- a/app/static/js/nopaque.CorpusAnalysisClient.js +++ b/app/static/js/nopaque.CorpusAnalysisClient.js @@ -5,7 +5,7 @@ class CorpusAnalysisClient { this.displays = {}; this.socket = socket; - // socket on event fpr corpous analysis initialization + // socket on event for corpous analysis initialization socket.on("corpus_analysis_init", (response) => { var errorText; @@ -20,7 +20,8 @@ class CorpusAnalysisClient { } else { errorText = `Error ${response.code} - ${response.msg}`; if (this.displays.init.errorContainer != undefined) { - this.displays.init.errorContainer.innerHTML = `

error ${errorText}

`; + this.displays.init.errorContainer.innerHTML = `

` + + `error ${errorText}

`; } if (this.displays.init != undefined) { this.displays.init.setVisibilityByStatus("error"); @@ -45,7 +46,8 @@ class CorpusAnalysisClient { errorText = `Error ${response.payload.code} - ${response.payload.msg}`; nopaque.flash("error", errorText); if (this.displays.query.errorContainer != undefined) { - this.displays.query.errorContainer.innerHTML = `

error ${errorText}

`; + this.displays.query.errorContainer.innerHTML = `

`+ + `error ${errorText}

`; } if (this.displays.query != undefined) { this.displays.query.setVisibilityByStatus("error"); @@ -54,13 +56,18 @@ class CorpusAnalysisClient { } }); + 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 - // get context of one match if inspected via socket.io - socket.on("corpus_analysis_inspect_match", (response) => { results.resultsList.showMatchContext(response)}); + socket.on("corpus_analysis_inspect_match", (response) => { + if (this.callbacks.query_match_context != undefined) { + this.callbacks.query_match_context(response); + } + }); } init() { diff --git a/app/templates/corpora/analyse_corpus.html.j2 b/app/templates/corpora/analyse_corpus.html.j2 index d1764a32..2fb083b6 100644 --- a/app/templates/corpora/analyse_corpus.html.j2 +++ b/app/templates/corpora/analyse_corpus.html.j2 @@ -360,6 +360,9 @@ client.setCallback("query_results", (payload) => { queryRenderResults(payload); }); + client.setCallback("query_match_context", (payload) => { + results.resultsList.showMatchContext(payload); + }) // Trigger corpus analysis initialization on server side client.init(); From 7efb16246fec626b463cb0106a9a227bf9bf34ee Mon Sep 17 00:00:00 2001 From: Stephan Porada Date: Thu, 23 Apr 2020 11:18:50 +0200 Subject: [PATCH 2/5] Clean up and better text break in amtch context --- app/templates/corpora/analyse_corpus.html.j2 | 50 +++++++++++++------- 1 file changed, 34 insertions(+), 16 deletions(-) diff --git a/app/templates/corpora/analyse_corpus.html.j2 b/app/templates/corpora/analyse_corpus.html.j2 index 2fb083b6..5fa4031c 100644 --- a/app/templates/corpora/analyse_corpus.html.j2 +++ b/app/templates/corpora/analyse_corpus.html.j2 @@ -26,7 +26,8 @@ {{ query_form.query.label }} - help + help + CQP query language tutorial @@ -49,10 +50,12 @@
- {{ M.render_field(display_options_form.results_per_page, material_icon='format_list_numbered') }} + {{ M.render_field(display_options_form.results_per_page, + material_icon='format_list_numbered') }}
- {{ M.render_field(display_options_form.result_context, material_icon='short_text') }} + {{ M.render_field(display_options_form.result_context, + material_icon='short_text') }}
{{ M.render_field(display_options_form.expert_mode) }} @@ -79,11 +82,15 @@ matches loaded.
- Matches occured in corpus files. + Matches occured in + + corpus files.

help - The Server is still sending your results. Functions like "Export Results" and "Match Inspect" will be available after all matches have been loaded. + The Server is still sending your results. + Functions like "Export Results" and "Match Inspect" will be + available after all matches have been loaded.

@@ -94,7 +101,14 @@
- +
@@ -139,12 +153,15 @@ class="modal modal-fixed-footer no-autoinit">