This is an automated email from the ASF dual-hosted git repository.
vincbeck pushed a commit to branch main
in repository https://gitbox.apache.org/repos/asf/airflow.git
The following commit(s) were added to refs/heads/main by this push:
new 3cc101d4173 Add team selector in variable form (#60474)
3cc101d4173 is described below
commit 3cc101d417327c5160e5d7f8a3de24bce140e7bf
Author: Vincent <[email protected]>
AuthorDate: Thu Jan 15 13:10:10 2026 -0500
Add team selector in variable form (#60474)
---
.../ui/src/pages/Variables/ManageVariable/AddVariableButton.tsx | 1 +
.../ui/src/pages/Variables/ManageVariable/EditVariableButton.tsx | 1 +
.../airflow/ui/src/pages/Variables/ManageVariable/VariableForm.tsx | 6 ++++++
airflow-core/src/airflow/ui/src/queries/useAddVariable.ts | 1 +
4 files changed, 9 insertions(+)
diff --git
a/airflow-core/src/airflow/ui/src/pages/Variables/ManageVariable/AddVariableButton.tsx
b/airflow-core/src/airflow/ui/src/pages/Variables/ManageVariable/AddVariableButton.tsx
index 60ccd3967ed..05b74bf6b9e 100644
---
a/airflow-core/src/airflow/ui/src/pages/Variables/ManageVariable/AddVariableButton.tsx
+++
b/airflow-core/src/airflow/ui/src/pages/Variables/ManageVariable/AddVariableButton.tsx
@@ -39,6 +39,7 @@ const AddVariableButton = ({ disabled }: Props) => {
const initialVariableValue: VariableBody = {
description: "",
key: "",
+ team_name: "",
value: "",
};
diff --git
a/airflow-core/src/airflow/ui/src/pages/Variables/ManageVariable/EditVariableButton.tsx
b/airflow-core/src/airflow/ui/src/pages/Variables/ManageVariable/EditVariableButton.tsx
index 312cb27c762..d72b5af83cd 100644
---
a/airflow-core/src/airflow/ui/src/pages/Variables/ManageVariable/EditVariableButton.tsx
+++
b/airflow-core/src/airflow/ui/src/pages/Variables/ManageVariable/EditVariableButton.tsx
@@ -50,6 +50,7 @@ const EditVariableButton = ({ disabled, variable }: Props) =>
{
const initialVariableValue: VariableBody = {
description: variable.description ?? "",
key: variable.key,
+ team_name: variable.team_name ?? "",
value: formatValue(variable.value),
};
const { editVariable, error, isPending, setError } =
useEditVariable(initialVariableValue, {
diff --git
a/airflow-core/src/airflow/ui/src/pages/Variables/ManageVariable/VariableForm.tsx
b/airflow-core/src/airflow/ui/src/pages/Variables/ManageVariable/VariableForm.tsx
index 3eb8aa70239..03eb5c807e3 100644
---
a/airflow-core/src/airflow/ui/src/pages/Variables/ManageVariable/VariableForm.tsx
+++
b/airflow-core/src/airflow/ui/src/pages/Variables/ManageVariable/VariableForm.tsx
@@ -22,10 +22,13 @@ import { useTranslation } from "react-i18next";
import { FiSave } from "react-icons/fi";
import { ErrorAlert } from "src/components/ErrorAlert";
+import { TeamSelector } from "src/components/TeamSelector.tsx";
+import { useConfig } from "src/queries/useConfig.tsx";
export type VariableBody = {
description: string | undefined;
key: string;
+ team_name: string;
value: string;
};
@@ -58,6 +61,7 @@ const VariableForm = ({ error, initialVariable, isPending,
manageMutate, setErro
defaultValues: initialVariable,
mode: "onChange",
});
+ const multiTeamEnabled = Boolean(useConfig("multi_team"));
const onSubmit = (data: VariableBody) => {
manageMutate(data);
@@ -126,6 +130,8 @@ const VariableForm = ({ error, initialVariable, isPending,
manageMutate, setErro
)}
/>
+ {multiTeamEnabled ? <TeamSelector control={control} /> : undefined}
+
<ErrorAlert error={error} />
<Box as="footer" display="flex" justifyContent="flex-end" mt={8}>
diff --git a/airflow-core/src/airflow/ui/src/queries/useAddVariable.ts
b/airflow-core/src/airflow/ui/src/queries/useAddVariable.ts
index 07248b27617..b3b7388608a 100644
--- a/airflow-core/src/airflow/ui/src/queries/useAddVariable.ts
+++ b/airflow-core/src/airflow/ui/src/queries/useAddVariable.ts
@@ -63,6 +63,7 @@ export const useAddVariable = ({ onSuccessConfirm }: {
onSuccessConfirm: () => v
requestBody: {
description: parsedDescription,
key: variableRequestBody.key,
+ team_name: variableRequestBody.team_name,
value: variableRequestBody.value,
},
});