From b6986e2581583dc768e923784a75e464c6662350 Mon Sep 17 00:00:00 2001 From: Stephan Porada Date: Thu, 24 Sep 2020 10:13:15 +0200 Subject: [PATCH] Close corpus analysis init modal only if meta data has been recieved. --- .../js/modules/corpus_analysis/client/callbacks.js | 2 ++ .../js/modules/corpus_analysis/view/callbacks.js | 11 ++++++++++- .../js/modules/corpus_analysis/view/listeners.js | 9 +++++++++ 3 files changed, 21 insertions(+), 1 deletion(-) diff --git a/web/app/static/js/modules/corpus_analysis/client/callbacks.js b/web/app/static/js/modules/corpus_analysis/client/callbacks.js index 2eaddb9d..230cc195 100644 --- a/web/app/static/js/modules/corpus_analysis/client/callbacks.js +++ b/web/app/static/js/modules/corpus_analysis/client/callbacks.js @@ -4,9 +4,11 @@ */ function saveMetaData() { let [payload, client, results, rest] = arguments; + client.notifyView('meta-data-recieving'); results.metaData.init(payload) console.info('Metada saved:', results); client.isBusy = false; + client.notifyView('meta-data-recieved'); } /** diff --git a/web/app/static/js/modules/corpus_analysis/view/callbacks.js b/web/app/static/js/modules/corpus_analysis/view/callbacks.js index 2ef4d1a6..eeb71f0d 100644 --- a/web/app/static/js/modules/corpus_analysis/view/callbacks.js +++ b/web/app/static/js/modules/corpus_analysis/view/callbacks.js @@ -35,8 +35,16 @@ function connectingCallback(resultsList, detail) { resultsList.analysisInitModal.open(); } -// Callback that closes teh loading modal from above. +// Callback that closes the loading modal from above. function connectedCallback(resultsList, detail) { + /** + * In the past this closed the init modal. But the init modal is now being + * closed when the meta data has also been recieved. See below. + */ +} + +// Callback that closes the loading modal from above. +function metaDataRecievedCallback(resultsList, detail) { resultsList.analysisInitModal.close(); } @@ -233,6 +241,7 @@ function resultsDataRecievedCallback(resultsList, detail) { export { connectingCallback, connectedCallback, + metaDataRecievedCallback, clientFailedCallback, queryDataPreparingCallback, queryDataRecievingCallback, diff --git a/web/app/static/js/modules/corpus_analysis/view/listeners.js b/web/app/static/js/modules/corpus_analysis/view/listeners.js index 1eb58c56..24aa51a3 100644 --- a/web/app/static/js/modules/corpus_analysis/view/listeners.js +++ b/web/app/static/js/modules/corpus_analysis/view/listeners.js @@ -10,6 +10,7 @@ import { connectingCallback, connectedCallback, + metaDataRecievedCallback, clientFailedCallback, queryDataPreparingCallback, queryDataRecievingCallback, @@ -38,6 +39,14 @@ function recieveClientNotification(eventType, resultsList) { console.info('View recieved notification:', caseIdentifier); connectedCallback(resultsList, event.detail); break; + case 'meta-data-recieving': + console.info('View recieved notification:', caseIdentifier); + break; + case 'meta-data-recieved': + console.info('View recieved notification:', caseIdentifier); + // execute + metaDataRecievedCallback(resultsList, event.detail); + break; case 'query-data-prepareing': console.info('View recieved notification:', caseIdentifier); // Hide all download buttons