This is an automated email from the ASF dual-hosted git repository.
weilee pushed a commit to branch v3-1-test
in repository https://gitbox.apache.org/repos/asf/airflow.git
The following commit(s) were added to refs/heads/v3-1-test by this push:
new efd09090a09 fix Preserve variable value formatting in edit dialog
(#58757) (#62339)
efd09090a09 is described below
commit efd09090a09c7c3655551c655902ee3d9e83b8d9
Author: Wei Lee <[email protected]>
AuthorDate: Mon Feb 23 14:03:45 2026 +0900
fix Preserve variable value formatting in edit dialog (#58757) (#62339)
Co-authored-by: RickyChen / 陳昭儒
<[email protected]>
---
.../pages/Variables/ManageVariable/EditVariableButton.tsx | 13 ++++++++++++-
1 file changed, 12 insertions(+), 1 deletion(-)
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 4310a2f92ff..312cb27c762 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
@@ -33,13 +33,24 @@ type Props = {
readonly variable: VariableResponse;
};
+const formatValue = (value: string): string => {
+ try {
+ const parsed: unknown = JSON.parse(value);
+
+ return JSON.stringify(parsed, undefined, 2);
+ } catch {
+ return value;
+ }
+};
+
const EditVariableButton = ({ disabled, variable }: Props) => {
const { t: translate } = useTranslation("admin");
const { onClose, onOpen, open } = useDisclosure();
+
const initialVariableValue: VariableBody = {
description: variable.description ?? "",
key: variable.key,
- value: variable.value,
+ value: formatValue(variable.value),
};
const { editVariable, error, isPending, setError } =
useEditVariable(initialVariableValue, {
onSuccessConfirm: onClose,