diff --git a/web/app/static/js/modules/corpus_analysis/client/Client.js b/web/app/static/js/modules/corpus_analysis/client/Client.js index 57148af18bbb06b9c2ecd453f17ddf2821ce5eca..14c82392eb24115068e7730d8e0601230e50994c 100644 --- a/web/app/static/js/modules/corpus_analysis/client/Client.js +++ b/web/app/static/js/modules/corpus_analysis/client/Client.js @@ -10,7 +10,8 @@ class Client { constructor({corpusId = null, socket = null, logging = true, - dynamicMode = true} = {}) { + dynamicMode = true, + fullContext = null} = {}) { this.corpusId = corpusId; this.dynamicMode = dynamicMode; this.logging = logging; @@ -18,6 +19,7 @@ class Client { this.socket = socket; this.eventListeners = {}; this.isBusy = false; + this.fullContext = fullContext; /** * Disables all console logging. * This is global. So every other log message in every other Class or diff --git a/web/app/static/js/modules/corpus_analysis/view/ResultsView.js b/web/app/static/js/modules/corpus_analysis/view/ResultsView.js index 386a12c38ffd208ec16c780fd65794a51d468f32..0da1a86e5fb1c2b68a562f6d2a13d0d752bcd344 100644 --- a/web/app/static/js/modules/corpus_analysis/view/ResultsView.js +++ b/web/app/static/js/modules/corpus_analysis/view/ResultsView.js @@ -735,7 +735,9 @@ class ResultsList extends List { addToSubResultsBtn.setAttribute("class", classes + ` add` ); addToSubResultsBtn.innerHTML = '<i class="material-icons add-btn">add</i>'; - aCellElement.appendChild(inspectBtn); + if (client.dynamicMode || client.fullContext) { + aCellElement.appendChild(inspectBtn); + } if (client.dynamicMode) { aCellElement.appendChild(addToSubResultsBtn); } diff --git a/web/app/static/json_schema/nopaque_cqi_py_results_schema.json b/web/app/static/json_schema/nopaque_cqi_py_results_schema.json index 7d6b58012e54c143dc740bb83c6ec5df9c50a851..63576d9c65d5eb2913803def15259ac8cff9a784 100644 --- a/web/app/static/json_schema/nopaque_cqi_py_results_schema.json +++ b/web/app/static/json_schema/nopaque_cqi_py_results_schema.json @@ -73,6 +73,9 @@ "corpus_cqpserver_version": { "type": "string" }, + "fullContext": { + "type": "boolean" + }, "cpos_ranges": { "type": "boolean" } @@ -95,7 +98,8 @@ "match_count", "matches", "query", - "text_lookup" + "text_lookup", + "fullContext" ], "title": "NopaqueCQIPYResults" }, diff --git a/web/app/templates/query_results/inspect.html.j2 b/web/app/templates/query_results/inspect.html.j2 index abe65194faee13ec104991c36e08e963b299401c..2075c1451c677af9d44ba3bb655c6aa9a46843f9 100644 --- a/web/app/templates/query_results/inspect.html.j2 +++ b/web/app/templates/query_results/inspect.html.j2 @@ -40,7 +40,8 @@ {% include 'interactions/analysis.html.j2' %} {% include 'interactions/cite.html.j2' %} <div class="hide"> - {# Hide those because they are not needed when inspecting results #} + {# Hide those because they are not needed when inspecting results. + But some of their elements are being asked for by the client. #} {% include 'interactions/export.html.j2' %} {% include 'interactions/create.html.j2' %} </div> @@ -109,9 +110,6 @@ import { * Asynchronus and event driven code. */ document.addEventListener("DOMContentLoaded", () => { - // Initialize the client with dynamicMode set to false. - const client = new Client({'logging': true, - 'dynamicMode': false}); /** * Initializing the results object as a model holding all the data of a * query. Also holds the metadata of one query and results data. @@ -124,6 +122,10 @@ document.addEventListener("DOMContentLoaded", () => { const resultsJson = {{ query_result_file_content|tojson|safe }}; // Import metadata from DB passed to this view const metaDataJson = {{ query_metadata|tojson|safe }}; + // Initialize the client with dynamicMode set to false. + const client = new Client({'logging': true, + 'dynamicMode': false, + 'fullContext': metaDataJson.fullContext}); /** * Register needed listeners and their callbacks. But we will * just call the attached callbacks manually. Because dynamicMode is false. @@ -161,6 +163,7 @@ document.addEventListener("DOMContentLoaded", () => { '#display-options-form-result_context', '#display-options-form-results_per_page', '#full-results-create', + '#full-results-export', '#inspect-results-export', '#meta-data-modal-content', ['#meta-data-modal', { @@ -173,6 +176,7 @@ document.addEventListener("DOMContentLoaded", () => { '#query-results-table', '#show-meta-data', '#sub-results-create', + '#sub-results-export', ]); // Hide buttons which are not needed when just inspecting results resultsList.inspectResultsExport.classList.add('hide');