From fd1d1c2fc3fce77f0e92f87619c8648cfcac9ee5 Mon Sep 17 00:00:00 2001 From: Stephan Porada Date: Thu, 10 Sep 2020 08:53:36 +0200 Subject: [PATCH] Fix create sub results showing even if other result creation is running. --- web/app/static/js/modules/corpus_analysis/view/ResultsView.js | 4 ++-- web/app/templates/corpora/analyse_corpus.html.j2 | 2 +- 2 files changed, 3 insertions(+), 3 deletions(-) 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 2803cb2f..bc9fd742 100644 --- a/web/app/static/js/modules/corpus_analysis/view/ResultsView.js +++ b/web/app/static/js/modules/corpus_analysis/view/ResultsView.js @@ -215,7 +215,7 @@ class ResultsList extends List { // function checks if its status in addToSubResultsStatus is either flase or // true. Adds match to sub-results if status is false if status is true it // removes it. - addToSubResults(dataIndex, tableCall=true) { + addToSubResults(dataIndex, client, tableCall=true) { if (!this.addToSubResultsStatus[dataIndex] || this.addToSubResultsStatus === undefined) { // add button is activated because status is either false or undefined @@ -235,7 +235,7 @@ class ResultsList extends List { M.textareaAutoResize(this.subResultsMatchIds); // after an insert textarea has to be resized manually } // Toggles the create button according to the number of ids in addToSubResultsIdsToShow - if ([...this.addToSubResultsIdsToShow].length > 0) { + if ([...this.addToSubResultsIdsToShow].length > 0 && !client.isBusy) { this.subResultsCreate.classList.toggle('disabled', false); } else if ([...this.addToSubResultsIdsToShow].length === 0) { this.subResultsCreate.classList.toggle('disabled', true); diff --git a/web/app/templates/corpora/analyse_corpus.html.j2 b/web/app/templates/corpora/analyse_corpus.html.j2 index 2aa52a16..831cca10 100644 --- a/web/app/templates/corpora/analyse_corpus.html.j2 +++ b/web/app/templates/corpora/analyse_corpus.html.j2 @@ -283,7 +283,7 @@ document.addEventListener("DOMContentLoaded", () => { resultsList.inspect([dataIndex], 'inspect'); } else if (event.target.classList.contains('add-btn')) { dataIndex = parseInt(event.target.closest('tr').dataset.index); - resultsList.addToSubResults(dataIndex); + resultsList.addToSubResults(dataIndex, client); } })