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 894fd382f2c1d..82fb302b34393 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 e31936a0ab3f6..5a810a223ffb6 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>) => { - 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);