From ffee7a1f2fe05dcb4a43b8af6e40200cbc47861a Mon Sep 17 00:00:00 2001 From: sergeyteleshev Date: Tue, 6 Aug 2024 11:39:31 +0200 Subject: [PATCH] CB-5414 Import table - wrong description for canceled import (#2821) * feat: adds correct cancellation message to DataImportService * Update Russian translation for the data import process fail cancel message * CB-5414 do not set message on cancelled task during import into table --------- Co-authored-by: Daria Marutkina <125263541+dariamarutkina@users.noreply.github.com> --- .../plugin-data-import/src/DataImportService.ts | 12 +++++++++++- webapp/packages/plugin-data-import/src/locales/fr.ts | 2 +- 2 files changed, 12 insertions(+), 2 deletions(-) diff --git a/webapp/packages/plugin-data-import/src/DataImportService.ts b/webapp/packages/plugin-data-import/src/DataImportService.ts index 2114a402e9..3b342f791d 100644 --- a/webapp/packages/plugin-data-import/src/DataImportService.ts +++ b/webapp/packages/plugin-data-import/src/DataImportService.ts @@ -41,9 +41,15 @@ export class DataImportService { async importData(connectionId: string, contextId: string, projectId: string, resultsId: string, processorId: string, file: File) { const abortController = new AbortController(); let cancelImplementation: (() => void | Promise) | null; + let isCancelled = false; function cancel() { - cancelImplementation?.(); + if (!cancelImplementation) { + return; + } + + cancelImplementation(); + isCancelled = true; } const { controller, notification } = this.notificationService.processNotification( @@ -65,6 +71,10 @@ export class DataImportService { processorId, file, event => { + if (isCancelled) { + return; + } + if (event.total !== undefined) { const percentCompleted = getProgressPercent(event.loaded, event.total); diff --git a/webapp/packages/plugin-data-import/src/locales/fr.ts b/webapp/packages/plugin-data-import/src/locales/fr.ts index e6efd4a11d..de5167d416 100644 --- a/webapp/packages/plugin-data-import/src/locales/fr.ts +++ b/webapp/packages/plugin-data-import/src/locales/fr.ts @@ -9,6 +9,6 @@ export default [ ['plugin_data_import_title', 'Importation de données'], ['plugin_data_import_process_title', 'Importation des données...'], ['plugin_data_import_process_success', 'Données importées avec succès'], - ['plugin_data_import_process_fail', 'Échec de l\'importation des données'], + ['plugin_data_import_process_fail', "Échec de l'importation des données"], ['plugin_data_import_process_file_processing_step_message', 'Fichier téléchargé, en cours de traitement...'], ];