diff --git a/web/app/corpora/views.py b/web/app/corpora/views.py index 7b0355e1..3f1bb8d8 100644 --- a/web/app/corpora/views.py +++ b/web/app/corpora/views.py @@ -76,7 +76,6 @@ def analyse_corpus(corpus_id): prefix='inspect-display-options-form') return render_template( 'corpora/analyse_corpus.html.j2', - corpus=corpus, corpus_id=corpus_id, display_options_form=display_options_form, query_form=query_form, diff --git a/web/app/query_results/views.py b/web/app/query_results/views.py index 78fda741..1f17a873 100644 --- a/web/app/query_results/views.py +++ b/web/app/query_results/views.py @@ -93,6 +93,7 @@ def inspect_query_result(query_result_id): View to inspect one importe result file in a corpus analysis like interface ''' query_result = QueryResult.query.get_or_404(query_result_id) + query_metadata = query_result.query_metadata if not (query_result.creator == current_user or current_user.is_administrator()): abort(403) @@ -117,6 +118,7 @@ def inspect_query_result(query_result_id): display_options_form=display_options_form, inspect_display_options_form=inspect_display_options_form, query_result_file_content=query_result_file_content, + query_metadata=query_metadata, title='Inspect query result') diff --git a/web/app/static/js/nopaque.CorpusAnalysisClient.js b/web/app/static/js/nopaque.CorpusAnalysisClient.js index de550fba..592d61de 100644 --- a/web/app/static/js/nopaque.CorpusAnalysisClient.js +++ b/web/app/static/js/nopaque.CorpusAnalysisClient.js @@ -113,7 +113,7 @@ class CorpusAnalysisClient { } getMetaData() { - // just emits thos to tell the server to gather all meta data infos and send + // just emits this to tell the server to gather all meta data infos and send // those back this.socket.emit("corpus_analysis_get_meta_data", this.corpusId); } diff --git a/web/app/static/js/nopaque.InteractionElement.js b/web/app/static/js/nopaque.InteractionElement.js index 6e85b005..a1d9064b 100644 --- a/web/app/static/js/nopaque.InteractionElement.js +++ b/web/app/static/js/nopaque.InteractionElement.js @@ -29,17 +29,21 @@ class InteractionElement { let boundedCallback = callback["function"].bind(callback.bindThis); return boundedCallback; } +} - static onChangeExecute(interactionElements) { +class InteractionElements { + constructor() { + this.interactions = []; + } + + addInteractions (interactionsArray) { + this.interactions.push(...interactionsArray); + } + + onChangeExecute() { // checks if a change for every interactionElement happens and executes // the callbacks accordingly - // TODO: This function scould be a static function of the Class InteractionElements - // This class does not exist yet. The Class InteractionElements should hold - // a list of InteractionElement objects. onChangeExecute loops over InteractionElements - // and executes the callbacks as mentioned accordingly. An additional - // InteractionElements Class is logically right but also makes things a little more - // complex. It is not yet decided. - for (let interaction of interactionElements) { + for (let interaction of this.interactions) { if (interaction.checkStatus) { interaction.element.addEventListener("change", (event) => { if (event.target.checked) { diff --git a/web/app/static/js/nopaque.Results.js b/web/app/static/js/nopaque.Results.js index f912d91d..2b3c1caa 100644 --- a/web/app/static/js/nopaque.Results.js +++ b/web/app/static/js/nopaque.Results.js @@ -12,6 +12,7 @@ class Results { this.jsList.update(); this.data.init(); this.metaData.init(); + this.resultsData.init() this.subResultsData.init(); } @@ -92,6 +93,15 @@ class Data { // create results data either from all results or from al lmarked sub results createResultsData(type) { + // deactivate inspect, because cqp server cannot handle multiple requests + results.jsList.deactivateInspect(); + activateInspectInteraction.setCallback("noCheck", + results.jsList.deactivateInspect, + results.jsList); + // set flag that results are being created to avoid reactivation of + // sub results creation if marked matches are changed + resultCreationRunning = true; + console.log(resultCreationRunning); if (type === "sub-results") { resultsCreateElement.classList.add("disabled"); // cqp server cannot handle more than one request at a time. Thus we deactivate the resultsCreateElement let tmp = [...results.jsList.addToSubResultsIdsToShow].sort(function(a, b){return a-b}); diff --git a/web/app/static/js/nopaque.callbacks.js b/web/app/static/js/nopaque.callbacks.js index 931301fb..45a40e9c 100644 --- a/web/app/static/js/nopaque.callbacks.js +++ b/web/app/static/js/nopaque.callbacks.js @@ -56,12 +56,18 @@ function saveSubResultsChoices(response) { clearTimeout(); }, 3000) // Resets the resultsCreateElement (removing spinner with setting innerText) - resultsCreateElement.innerText = "Create Sub-Results"; + resultsCreateElement.innerText = "Create Results"; resultsCreateElement.insertAdjacentHTML("beforeend", `build`); // reactivate subResultsCreateElement subResultsCreateElement.classList.remove("disabled"); } - + // reactivate inspect + results.jsList.activateInspect(); + activateInspectInteraction.setCallback("noCheck", + results.jsList.activateInspect, + results.jsList); + // set resultCreationRunning to flase + resultCreationRunning = false; } // This callback is called on socket.on "query". @@ -79,6 +85,9 @@ function querySetup(payload) { queryResultsDeterminateElement.style.width = "0%"; queryResultsProgressElement.classList.remove("hide"); queryResultsUserFeedbackElement.classList.remove("hide"); + resultsCreateElement.classList.add("disabled"); + resultsCreateElement.classList.remove("hide"); + resultsExportElement.classList.add("hide"); // some initial values receivedMatchCountElement.innerText = "0"; textLookupCountElement.innerText = "0"; @@ -118,6 +127,7 @@ function queryRenderResults(payload, imported=false) { } helperQueryRenderResults(payload); if (progress === 100) { + resultsCreateElement.classList.remove("disabled"); queryResultsProgressElement.classList.add("hide"); queryResultsUserFeedbackElement.classList.add("hide"); resultsExportElement.classList.remove("disabled"); @@ -154,8 +164,10 @@ function helperQueryRenderResults (payload) { results.jsList.changeContext(); // sets lr context on first result load // incorporating new chunk results into full results results.data.matches.push(...payload.chunk.matches); - Object.assign(results.data.cpos_lookup, payload.chunk.cpos_lookup); - Object.assign(results.data.text_lookup, payload.chunk.text_lookup); + results.data.addData(payload.chunk.cpos_lookup, "cpos_lookup"); + results.data.addData(payload.chunk.text_lookup, "text_lookup"); + // complete metaData + // results.metaData.add(); // show user current and total match count receivedMatchCountElement.innerText = `${results.data.matches.length}`; textLookupCountElement.innerText = `${Object.keys(results.data.text_lookup).length}`; diff --git a/web/app/static/js/nopaque.lists.js b/web/app/static/js/nopaque.lists.js index 3a23aee3..91b6ef47 100644 --- a/web/app/static/js/nopaque.lists.js +++ b/web/app/static/js/nopaque.lists.js @@ -340,7 +340,7 @@ class ResultsList extends List { // loops over interactionElements and executes callback functions accordingly pageChangeEventInteractionHandler(interactionElements) { // get elements to check thier status - for (let interaction of interactionElements) { + for (let interaction of interactionElements.interactions) { if (interaction.checkStatus) { if (interaction.element.checked) { let f_on = interaction.bindThisToCallback("on"); @@ -437,14 +437,18 @@ class ResultsList extends List { nrMarkedMatches.innerText = [...this.addToSubResultsIdsToShow].length; M.textareaAutoResize(textarea); // after an insert textarea has to be resized manually } - // Toggles the create button accoring to the number of ids in addToSubResultsIdsToShow + // Toggles the create button according to the number of ids in addToSubResultsIdsToShow if ([...this.addToSubResultsIdsToShow].length > 0) { subResultsCreateElement.classList.remove("disabled"); } else if ([...this.addToSubResultsIdsToShow].length === 0) { subResultsCreateElement.classList.add("disabled"); } + if (resultCreationRunning) { + subResultsCreateElement.classList.add("disabled"); + } // After a match as been added or removed the export button will be - // hidden because the sub-results have been alterd and have to be built //// again. Thus subResultsCreateElement has to be shown again. + // hidden because the sub-results have been altered and have to be built + // again. Thus subResultsCreateElement has to be shown again. subResultsExportElement.classList.add("hide"); subResultsCreateElement.classList.remove("hide"); // Also activate/deactivate buttons in the table/jsList results accordingly @@ -493,6 +497,15 @@ class ResultsList extends List { } } + // deactivate inspect buttons + deactivateInspect() { + let inspectBtnElements; + inspectBtnElements = document.getElementsByClassName("inspect"); + for (let inspectBtn of inspectBtnElements) { + inspectBtn.classList.add("disabled"); + } + } + // ### functions to inspect imported Matches // This function creates an object that is similar to the object that is // being recieved as an answere to the getMatchWithContext Method, which is diff --git a/web/app/templates/corpora/analyse_corpus.html.j2 b/web/app/templates/corpora/analyse_corpus.html.j2 index 7623331e..5c1aeedf 100644 --- a/web/app/templates/corpora/analyse_corpus.html.j2 +++ b/web/app/templates/corpora/analyse_corpus.html.j2 @@ -87,7 +87,8 @@
+
+

- Displaying of - matches. + matches loaded.
Matches occured in @@ -27,56 +60,80 @@

-
+

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

+
-
-
-
-
Display
-
-
-
-
- {{ 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.expert_mode) }} -
-
-
+
+
Display
+
+
+
+
+ {{ 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.expert_mode) }} +
-
-
    - - - - - - - - - - - - - -
    Nr.TitleLeft contextMatchActionsRight Context
    -
      -
      +
      +
        + + + + + + + + + + + + + +
        Nr.TitleLeft contextMatchActionsRight Context
        +
          + +{% import "macros/query_result_macro.html.j2" as metadata %} + +