From aafc8206bb3fddfa2ff80d2c085250b06629494f Mon Sep 17 00:00:00 2001 From: Abhijeet Raj Singh Date: Mon, 19 Oct 2026 19:12:28 +0530 Subject: [PATCH 1/4] Add connection duplication action to UI --- .../ui/public/i18n/locales/en/admin.json | 1 + .../ui/src/pages/Connections/Connections.tsx | 2 + .../Connections/DuplicateConnectionButton.tsx | 87 +++++++++++++++++++ 3 files changed, 90 insertions(+) create mode 100644 airflow-core/src/airflow/ui/src/pages/Connections/DuplicateConnectionButton.tsx 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 e8735ea2713c0..2656a817a9d15 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 @@ -15,6 +15,7 @@ }, "connections": { "add": "Add $t(connections.connection_one)", + "duplicate": "Duplicate", "columns": { "connectionId": "Connection ID", "connectionType": "Connection Type", diff --git a/airflow-core/src/airflow/ui/src/pages/Connections/Connections.tsx b/airflow-core/src/airflow/ui/src/pages/Connections/Connections.tsx index 6279938f5747d..da4bb91ade634 100644 --- a/airflow-core/src/airflow/ui/src/pages/Connections/Connections.tsx +++ b/airflow-core/src/airflow/ui/src/pages/Connections/Connections.tsx @@ -52,6 +52,7 @@ import { formatNumber, useDocumentTitle } from "src/utils"; import AddConnectionButton from "./AddConnectionButton"; import DeleteConnectionButton from "./DeleteConnectionButton"; import DeleteConnectionsButton from "./DeleteConnectionsButton"; +import DuplicateConnectionButton from "./DuplicateConnectionButton"; import EditConnectionButton from "./EditConnectionButton"; import { NothingFoundInfo } from "./NothingFoundInfo"; import TestConnectionButton from "./TestConnectionButton"; @@ -125,6 +126,7 @@ const getColumns = ({ + ), diff --git a/airflow-core/src/airflow/ui/src/pages/Connections/DuplicateConnectionButton.tsx b/airflow-core/src/airflow/ui/src/pages/Connections/DuplicateConnectionButton.tsx new file mode 100644 index 0000000000000..0af1480883a9d --- /dev/null +++ b/airflow-core/src/airflow/ui/src/pages/Connections/DuplicateConnectionButton.tsx @@ -0,0 +1,87 @@ + +/*! + * Licensed to the Apache Software Foundation (ASF) under one + * or more contributor license agreements. See the NOTICE file + * distributed with this work for additional information + * regarding copyright ownership. The ASF licenses this file + * to you under the Apache License, Version 2.0 (the + * "License"); you may not use this file except in compliance + * with the License. You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, + * software distributed under the License is distributed on an + * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY + * KIND, either express or implied. See the License for the + * specific language governing permissions and limitations + * under the License. + */ +import { useDisclosure } from "@chakra-ui/react"; +import { useTranslation } from "react-i18next"; +import { FiCopy } from "react-icons/fi"; + +import type { ConnectionResponse } from "openapi/requests/types.gen"; + +import { IconButton, Modal } from "src/system-components"; + +import { useAddConnection } from "src/queries/useAddConnection"; + +import ConnectionForm from "./ConnectionForm"; +import type { ConnectionBody } from "./Connections"; + +type Props = { + readonly connection: ConnectionResponse; + readonly disabled: boolean; +}; + +const DuplicateConnectionButton = ({ connection, disabled }: Props) => { + const { t: translate } = useTranslation("admin"); + const { onClose, onOpen, open } = useDisclosure(); + + const initialConnection: ConnectionBody = { + conn_type: connection.conn_type, + connection_id: "", + description: connection.description ?? "", + extra: connection.extra === "" || connection.extra === null ? "{}" : connection.extra, + host: connection.host ?? "", + login: connection.login ?? "", + password: "", + port: connection.port?.toString() ?? "", + schema: connection.schema ?? "", + team_name: connection.team_name ?? "", + }; + + const { addConnection, error, isPending } = useAddConnection({ + onSuccessConfirm: onClose, + }); + + return ( + <> + + + + + + + + + ); +}; + +export default DuplicateConnectionButton; From f2bbd591cf2a5763bd47f9d67d886738cd269219 Mon Sep 17 00:00:00 2001 From: Abhijeet Raj Singh Date: Mon, 19 Oct 2026 20:58:24 +0530 Subject: [PATCH 2/4] Format connection duplication button --- .../ui/src/pages/Connections/DuplicateConnectionButton.tsx | 6 +----- 1 file changed, 1 insertion(+), 5 deletions(-) diff --git a/airflow-core/src/airflow/ui/src/pages/Connections/DuplicateConnectionButton.tsx b/airflow-core/src/airflow/ui/src/pages/Connections/DuplicateConnectionButton.tsx index 0af1480883a9d..b9a9a36e6fa6d 100644 --- a/airflow-core/src/airflow/ui/src/pages/Connections/DuplicateConnectionButton.tsx +++ b/airflow-core/src/airflow/ui/src/pages/Connections/DuplicateConnectionButton.tsx @@ -58,11 +58,7 @@ const DuplicateConnectionButton = ({ connection, disabled }: Props) => { return ( <> - + From 9f74faeec9cc27f6cefc434b53b27509dbea79d1 Mon Sep 17 00:00:00 2001 From: Abhijeet Raj Singh Date: Mon, 19 Oct 2026 22:17:21 +0530 Subject: [PATCH 3/4] Fix license header formatting --- .../ui/src/pages/Connections/DuplicateConnectionButton.tsx | 1 - 1 file changed, 1 deletion(-) diff --git a/airflow-core/src/airflow/ui/src/pages/Connections/DuplicateConnectionButton.tsx b/airflow-core/src/airflow/ui/src/pages/Connections/DuplicateConnectionButton.tsx index b9a9a36e6fa6d..f5c5d234565b5 100644 --- a/airflow-core/src/airflow/ui/src/pages/Connections/DuplicateConnectionButton.tsx +++ b/airflow-core/src/airflow/ui/src/pages/Connections/DuplicateConnectionButton.tsx @@ -1,4 +1,3 @@ - /*! * Licensed to the Apache Software Foundation (ASF) under one * or more contributor license agreements. See the NOTICE file From af353f5d5bf2ed2ba61e985507e6a234b5228f1e Mon Sep 17 00:00:00 2001 From: Abhijeet Raj Singh Date: Mon, 19 Oct 2026 23:42:53 +0530 Subject: [PATCH 4/4] Sort connection translation keys --- airflow-core/src/airflow/ui/public/i18n/locales/en/admin.json | 2 +- 1 file changed, 1 insertion(+), 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 2656a817a9d15..06b9e773419f7 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 @@ -15,7 +15,6 @@ }, "connections": { "add": "Add $t(connections.connection_one)", - "duplicate": "Duplicate", "columns": { "connectionId": "Connection ID", "connectionType": "Connection Type", @@ -31,6 +30,7 @@ "firstConfirmMessage_other": "You are about to delete the following connections:", "title": "Delete $t(connections.connection_one)" }, + "duplicate": "Duplicate", "edit": "Edit $t(connections.connection_one)", "form": { "connectionIdRequired": "Connection ID is required",