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 8ae39c58210b5..2b7c65e760e90 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 @@ -16,7 +16,7 @@ * specific language governing permissions and limitations * under the License. */ -import { Box, Field, HStack, Input, Spacer, Textarea } from "@chakra-ui/react"; +import { Box, Field, HStack, Input, Spacer, Textarea, Text } from "@chakra-ui/react"; import { Controller, useForm } from "react-hook-form"; import { FiSave } from "react-icons/fi"; @@ -29,6 +29,16 @@ export type VariableBody = { value: string; }; +const isJsonString = (string: string) => { + try { + JSON.parse(string); + } catch { + return false; + } + + return true; +}; + type VariableFormProps = { readonly error: unknown; readonly initialVariable: VariableBody; @@ -80,14 +90,28 @@ const VariableForm = ({ error, initialVariable, isPending, manageMutate, setErro ( - - - Value - -