Skip to content

Commit d3b33a9

Browse files
[v3-0-test] Use Connection Hook Names for Dropdown instead of connection IDs (#51599) (#51613)
(cherry picked from commit f41f5f2) Co-authored-by: Jens Scheffler <95105677+jscheffl@users.noreply.github.com>
1 parent 7c9b297 commit d3b33a9

2 files changed

Lines changed: 6 additions & 3 deletions

File tree

airflow-core/src/airflow/ui/src/pages/Connections/ConnectionForm.tsx

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -49,6 +49,7 @@ const ConnectionForm = ({
4949
const [errors, setErrors] = useState<{ conf?: string }>({});
5050
const {
5151
formattedData: connectionTypeMeta,
52+
hookNames: hookNameMap,
5253
isPending: isMetaPending,
5354
keysList: connectionTypes,
5455
} = useConnectionTypeMeta();
@@ -116,7 +117,7 @@ const ConnectionForm = ({
116117
};
117118

118119
const connTypesOptions = connectionTypes.map((conn) => ({
119-
label: conn,
120+
label: hookNameMap[conn],
120121
value: conn,
121122
}));
122123

airflow-core/src/airflow/ui/src/queries/useConnectionTypeMeta.ts

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -58,6 +58,7 @@ export const useConnectionTypeMeta = () => {
5858
}
5959

6060
const formattedData: Record<string, ConnectionMetaEntry> = {};
61+
const hookNames: Record<string, string> = {};
6162
const keysList: Array<string> = [];
6263

6364
const defaultStandardFields: StandardFieldSpec | undefined = {
@@ -91,6 +92,7 @@ export const useConnectionTypeMeta = () => {
9192
data?.forEach((item) => {
9293
const key = item.connection_type;
9394

95+
hookNames[key] = item.hook_name;
9496
keysList.push(key);
9597

9698
const populatedStandardFields: StandardFieldSpec = mergeWithDefaults(
@@ -109,7 +111,7 @@ export const useConnectionTypeMeta = () => {
109111
};
110112
});
111113

112-
keysList.sort((first, second) => first.localeCompare(second));
114+
keysList.sort((first, second) => (hookNames[first] ?? first).localeCompare(hookNames[second] ?? second));
113115

114-
return { formattedData, isPending, keysList };
116+
return { formattedData, hookNames, isPending, keysList };
115117
};

0 commit comments

Comments
 (0)