From 16160c1c28783e25b98b8977361aad41795d78a3 Mon Sep 17 00:00:00 2001 From: Naumov Alexey Date: Mon, 5 Oct 2020 19:23:30 +0300 Subject: [PATCH] fix(core-connections): moved connection errors from form to snackbar CB-312 --- .../Administration/Connections/ConnectionForm/Controller.ts | 4 ++-- webapp/packages/core-connections/src/locales/en.ts | 3 +++ webapp/packages/core-connections/src/locales/ru.ts | 3 +++ .../ConnectionFormDialog/ConnectionFormDialogController.ts | 4 ++-- 4 files changed, 10 insertions(+), 4 deletions(-) diff --git a/webapp/packages/core-connections/src/Administration/Connections/ConnectionForm/Controller.ts b/webapp/packages/core-connections/src/Administration/Connections/ConnectionForm/Controller.ts index 68717ed40c..f06bb8b646 100644 --- a/webapp/packages/core-connections/src/Administration/Connections/ConnectionForm/Controller.ts +++ b/webapp/packages/core-connections/src/Administration/Connections/ConnectionForm/Controller.ts @@ -87,7 +87,7 @@ implements IInitializableController, IDestructibleController { this.notificationService.logInfo({ title: `Connection ${connection.name} created` }); } } catch (exception) { - this.showError(exception, 'Failed to create connection'); + this.notificationService.logException(exception, 'connections_connection_create_fail'); } finally { this.isSaving = false; } @@ -100,7 +100,7 @@ implements IInitializableController, IDestructibleController { await this.connectionsResource.test(this.getConnectionConfig()); this.notificationService.logInfo({ title: 'Connection is established' }); } catch (exception) { - this.showError(exception, 'Connection test failed'); + this.notificationService.logException(exception, 'connections_connection_test_fail'); } finally { this.isSaving = false; } diff --git a/webapp/packages/core-connections/src/locales/en.ts b/webapp/packages/core-connections/src/locales/en.ts index d3c3cde928..bdb6772b19 100644 --- a/webapp/packages/core-connections/src/locales/en.ts +++ b/webapp/packages/core-connections/src/locales/en.ts @@ -22,5 +22,8 @@ export default [ ['connections_connection_port', 'Port'], ['connections_connection_template', 'Template'], ['connections_connection_test', 'Test Connection'], + ['connections_connection_test_fail', 'Connection test failed'], + ['connections_connection_create_fail', 'Failed to create connection'], + ['connections_connection_save_fail', 'Failed to save connection'], ['connections_driver_search_placeholder', 'Type driver name...'], ]; diff --git a/webapp/packages/core-connections/src/locales/ru.ts b/webapp/packages/core-connections/src/locales/ru.ts index f97de7aade..56ad55df6f 100644 --- a/webapp/packages/core-connections/src/locales/ru.ts +++ b/webapp/packages/core-connections/src/locales/ru.ts @@ -21,5 +21,8 @@ export default [ ['connections_connection_port', 'Порт'], ['connections_connection_template', 'Шаблон'], ['connections_connection_test', 'Проверить подключение'], + ['connections_connection_test_fail', 'Не удалось выполнить тестовое подключение'], + ['connections_connection_create_fail', 'Не удалось создать подключение'], + ['connections_connection_save_fail', 'Не удалось сохранить подключение'], ['connections_driver_search_placeholder', 'Введите название драйвера...'], ]; diff --git a/webapp/packages/plugin-connection-custom/src/CustomConnection/ConnectionFormDialog/ConnectionFormDialogController.ts b/webapp/packages/plugin-connection-custom/src/CustomConnection/ConnectionFormDialog/ConnectionFormDialogController.ts index 33aa7dbe83..cbe99e4dd9 100644 --- a/webapp/packages/plugin-connection-custom/src/CustomConnection/ConnectionFormDialog/ConnectionFormDialogController.ts +++ b/webapp/packages/plugin-connection-custom/src/CustomConnection/ConnectionFormDialog/ConnectionFormDialogController.ts @@ -79,7 +79,7 @@ implements IInitializableController, IDestructibleController { this.notificationService.logInfo({ title: 'Connection is established' }); } catch (exception) { - this.showError(exception, 'Connection test failed'); + this.notificationService.logException(exception, 'connections_connection_test_fail'); } finally { this.isConnecting = false; } @@ -94,7 +94,7 @@ implements IInitializableController, IDestructibleController { this.notificationService.logInfo({ title: `Connection ${connection.name} created` }); this.onClose(); } catch (exception) { - this.showError(exception, 'Failed to create connection'); + this.notificationService.logException(exception, 'connections_connection_create_fail'); } finally { this.isConnecting = false; }