This is an automated email from the ASF dual-hosted git repository.
pierrejeambrun pushed a commit to branch v3-1-test
in repository https://gitbox.apache.org/repos/asf/airflow.git
The following commit(s) were added to refs/heads/v3-1-test by this push:
new 53a4d56306b [v3-1-test] Add toaster notifications for Connection Test
(#59354) (#59368)
53a4d56306b is described below
commit 53a4d56306b061f4a85239c2df5f5a7f2fb6f631
Author: github-actions[bot]
<41898282+github-actions[bot]@users.noreply.github.com>
AuthorDate: Fri Dec 12 15:06:50 2025 +0100
[v3-1-test] Add toaster notifications for Connection Test (#59354) (#59368)
* Add toaster notifications for Test Connection
* refactor: move test connection translations to admin.json
(cherry picked from commit acce763164fd7a6eab637eb3b4d4c0e65cf87672)
Co-authored-by: Yeonguk Choo <[email protected]>
---
.../airflow/ui/public/i18n/locales/en/admin.json | 6 ++++++
.../src/airflow/ui/src/queries/useTestConnection.ts | 21 ++++++++++++++++++++-
2 files changed, 26 insertions(+), 1 deletion(-)
diff --git a/airflow-core/src/airflow/ui/public/i18n/locales/en/admin.json
b/airflow-core/src/airflow/ui/public/i18n/locales/en/admin.json
index 894fd382f2c..82fb302b343 100644
--- a/airflow-core/src/airflow/ui/public/i18n/locales/en/admin.json
+++ b/airflow-core/src/airflow/ui/public/i18n/locales/en/admin.json
@@ -49,6 +49,12 @@
"searchPlaceholder": "Search Connections",
"test": "Test Connection",
"testDisabled": "Test connection feature is disabled. Please contact an
administrator to enable it.",
+ "testError": {
+ "title": "Test Connection Failed"
+ },
+ "testSuccess": {
+ "title": "Test Connection Successful"
+ },
"typeMeta": {
"error": "Failed to retrieve Connection Type Meta",
"standardFields": {
diff --git a/airflow-core/src/airflow/ui/src/queries/useTestConnection.ts
b/airflow-core/src/airflow/ui/src/queries/useTestConnection.ts
index e31936a0ab3..5a810a223ff 100644
--- a/airflow-core/src/airflow/ui/src/queries/useTestConnection.ts
+++ b/airflow-core/src/airflow/ui/src/queries/useTestConnection.ts
@@ -17,12 +17,31 @@
* under the License.
*/
import type { Dispatch, SetStateAction } from "react";
+import { useTranslation } from "react-i18next";
import { useConnectionServiceTestConnection } from "openapi/queries";
import type { ConnectionTestResponse } from "openapi/requests/types.gen";
+import { toaster } from "src/components/ui";
export const useTestConnection = (setConnected:
Dispatch<SetStateAction<boolean | undefined>>) => {
- const onSuccess = (res: ConnectionTestResponse) => setConnected(res.status);
+ const { t: translate } = useTranslation("admin");
+
+ const onSuccess = (res: ConnectionTestResponse) => {
+ setConnected(res.status);
+ if (res.status) {
+ toaster.create({
+ description: res.message,
+ title: translate("connections.testSuccess.title"),
+ type: "success",
+ });
+ } else {
+ toaster.create({
+ description: res.message,
+ title: translate("connections.testError.title"),
+ type: "error",
+ });
+ }
+ };
const onError = () => {
setConnected(false);