Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

CB-5414 Import table - wrong description for canceled import #2821

Merged
Merged
Show file tree
Hide file tree
Changes from 2 commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
13 changes: 12 additions & 1 deletion webapp/packages/plugin-data-import/src/DataImportService.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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<void>) | null;
let isCancelled = false;

function cancel() {
cancelImplementation?.();
if (!cancelImplementation) {
return;
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

no need to do something here cause it is handled here. message about cancelation and other statuses provided by server added automatically by controller.reject and ProcessNotificationController
Снимок экрана 2024-08-05 в 11 38 46

}

cancelImplementation();
isCancelled = true;
}

const { controller, notification } = this.notificationService.processNotification(
Expand All @@ -65,6 +71,11 @@ export class DataImportService {
processorId,
file,
event => {
if (isCancelled) {
controller.setMessage('plugin_data_import_process_fail_cancel_message');
return;
}
Wroud marked this conversation as resolved.
Show resolved Hide resolved

if (event.total !== undefined) {
const percentCompleted = getProgressPercent(event.loaded, event.total);

Expand Down
1 change: 1 addition & 0 deletions webapp/packages/plugin-data-import/src/locales/en.ts
Original file line number Diff line number Diff line change
Expand Up @@ -10,5 +10,6 @@ export default [
['plugin_data_import_process_title', 'Importing data...'],
['plugin_data_import_process_success', 'Data imported successfully'],
['plugin_data_import_process_fail', 'Data import failed'],
['plugin_data_import_process_fail_cancel_message', 'Cancelled'],
['plugin_data_import_process_file_processing_step_message', 'File uploaded, processing...'],
];
3 changes: 2 additions & 1 deletion webapp/packages/plugin-data-import/src/locales/fr.ts
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,7 @@ 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_fail_cancel_message', 'Cancelled'],
['plugin_data_import_process_file_processing_step_message', 'Fichier téléchargé, en cours de traitement...'],
];
1 change: 1 addition & 0 deletions webapp/packages/plugin-data-import/src/locales/it.ts
Original file line number Diff line number Diff line change
Expand Up @@ -10,5 +10,6 @@ export default [
['plugin_data_import_process_title', 'Importing data...'],
['plugin_data_import_process_success', 'Data imported successfully'],
['plugin_data_import_process_fail', 'Data import failed'],
['plugin_data_import_process_fail_cancel_message', 'Cancelled'],
['plugin_data_import_process_file_processing_step_message', 'File uploaded, processing...'],
];
1 change: 1 addition & 0 deletions webapp/packages/plugin-data-import/src/locales/ru.ts
Original file line number Diff line number Diff line change
Expand Up @@ -10,5 +10,6 @@ export default [
['plugin_data_import_process_title', 'Импорт данных...'],
['plugin_data_import_process_success', 'Данные успешно импортированы'],
['plugin_data_import_process_fail', 'Ошибка импорта данных'],
['plugin_data_import_process_fail_cancel_message', 'Отменено пользователем'],
['plugin_data_import_process_file_processing_step_message', 'Файл загружен, обработка...'],
];
1 change: 1 addition & 0 deletions webapp/packages/plugin-data-import/src/locales/zh.ts
Original file line number Diff line number Diff line change
Expand Up @@ -10,5 +10,6 @@ export default [
['plugin_data_import_process_title', 'Importing data...'],
['plugin_data_import_process_success', 'Data imported successfully'],
['plugin_data_import_process_fail', 'Data import failed'],
['plugin_data_import_process_fail_cancel_message', 'Cancelled'],
['plugin_data_import_process_file_processing_step_message', 'File uploaded, processing...'],
];
Loading