bbovenzi commented on code in PR #45790:
URL: https://github.com/apache/airflow/pull/45790#discussion_r1927591551
##########
airflow/ui/src/components/FlexibleForm/FieldString.tsx:
##########
@@ -19,27 +19,43 @@
import { Input } from "@chakra-ui/react";
import type { FlexibleFormElementProps } from ".";
+import { paramPlaceholder, useParamStore } from "../TriggerDag/useParamStore";
-export const FieldString = ({ name, param }: FlexibleFormElementProps) => (
- <>
- <Input
- defaultValue={String(param.value ?? "")}
- id={`element_${name}`}
- list={param.schema.examples ? `list_${name}` : undefined}
- maxLength={param.schema.maxLength ?? undefined}
- minLength={param.schema.minLength ?? undefined}
- name={`element_${name}`}
- placeholder={param.schema.examples ? "Start typing to see options." :
undefined}
- size="sm"
- />
- {param.schema.examples ? (
- <datalist id={`list_${name}`}>
- {param.schema.examples.map((example) => (
- <option key={example} value={example}>
- {example}
- </option>
- ))}
- </datalist>
- ) : undefined}
- </>
-);
+export const FieldString = ({ name }: FlexibleFormElementProps) => {
+ const { paramsDict, setParamsDict } = useParamStore();
+ const param = paramsDict[name] ?? paramPlaceholder;
+ const handleChange = (value: string) => {
+ if (paramsDict[name]) {
+ paramsDict[name].value = value === "" ? undefined : value;
Review Comment:
Let's make sure to include a comment when we add `eslint-ignore` then
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: [email protected]
For queries about this service, please contact Infrastructure at:
[email protected]