This is an automated email from the ASF dual-hosted git repository.
jscheffl pushed a commit to branch v3-0-test
in repository https://gitbox.apache.org/repos/asf/airflow.git
The following commit(s) were added to refs/heads/v3-0-test by this push:
new d3b33a94a3e [v3-0-test] Use Connection Hook Names for Dropdown instead
of connection IDs (#51599) (#51613)
d3b33a94a3e is described below
commit d3b33a94a3e1f890dbe111763975c00c234321da
Author: github-actions[bot]
<41898282+github-actions[bot]@users.noreply.github.com>
AuthorDate: Wed Jun 11 20:20:17 2025 +0200
[v3-0-test] Use Connection Hook Names for Dropdown instead of connection
IDs (#51599) (#51613)
(cherry picked from commit f41f5f23396a6dc97373ba1109f9dce28860026d)
Co-authored-by: Jens Scheffler <[email protected]>
---
.../src/airflow/ui/src/pages/Connections/ConnectionForm.tsx | 3 ++-
airflow-core/src/airflow/ui/src/queries/useConnectionTypeMeta.ts | 6 ++++--
2 files changed, 6 insertions(+), 3 deletions(-)
diff --git
a/airflow-core/src/airflow/ui/src/pages/Connections/ConnectionForm.tsx
b/airflow-core/src/airflow/ui/src/pages/Connections/ConnectionForm.tsx
index 6a17f1794f6..866d555c068 100644
--- a/airflow-core/src/airflow/ui/src/pages/Connections/ConnectionForm.tsx
+++ b/airflow-core/src/airflow/ui/src/pages/Connections/ConnectionForm.tsx
@@ -49,6 +49,7 @@ const ConnectionForm = ({
const [errors, setErrors] = useState<{ conf?: string }>({});
const {
formattedData: connectionTypeMeta,
+ hookNames: hookNameMap,
isPending: isMetaPending,
keysList: connectionTypes,
} = useConnectionTypeMeta();
@@ -116,7 +117,7 @@ const ConnectionForm = ({
};
const connTypesOptions = connectionTypes.map((conn) => ({
- label: conn,
+ label: hookNameMap[conn],
value: conn,
}));
diff --git a/airflow-core/src/airflow/ui/src/queries/useConnectionTypeMeta.ts
b/airflow-core/src/airflow/ui/src/queries/useConnectionTypeMeta.ts
index 8f9d4137c26..5f6f5c88267 100644
--- a/airflow-core/src/airflow/ui/src/queries/useConnectionTypeMeta.ts
+++ b/airflow-core/src/airflow/ui/src/queries/useConnectionTypeMeta.ts
@@ -58,6 +58,7 @@ export const useConnectionTypeMeta = () => {
}
const formattedData: Record<string, ConnectionMetaEntry> = {};
+ const hookNames: Record<string, string> = {};
const keysList: Array<string> = [];
const defaultStandardFields: StandardFieldSpec | undefined = {
@@ -91,6 +92,7 @@ export const useConnectionTypeMeta = () => {
data?.forEach((item) => {
const key = item.connection_type;
+ hookNames[key] = item.hook_name;
keysList.push(key);
const populatedStandardFields: StandardFieldSpec = mergeWithDefaults(
@@ -109,7 +111,7 @@ export const useConnectionTypeMeta = () => {
};
});
- keysList.sort((first, second) => first.localeCompare(second));
+ keysList.sort((first, second) => (hookNames[first] ??
first).localeCompare(hookNames[second] ?? second));
- return { formattedData, isPending, keysList };
+ return { formattedData, hookNames, isPending, keysList };
};