("string");
+ const [defaultValueState, setDefaultValueState] = useState<{
+ hasDefaultValue: boolean;
+ defaultValue: unknown;
+ }>({
+ hasDefaultValue: false,
+ defaultValue: null,
+ });
return (
@@ -56,28 +67,90 @@ function WorkflowParameterAddPanel({ type, onClose, onSave }: Props) {
/>
{type === "workflow" && (
-
-
-
-
+ <>
+
+
+
+
+
+
+ {
+ if (!checked) {
+ setDefaultValueState({
+ hasDefaultValue: false,
+ defaultValue: null,
+ });
+ return;
+ }
+ setDefaultValueState({
+ hasDefaultValue: true,
+ defaultValue:
+ getDefaultValueForParameterType(parameterType),
+ });
+ }}
+ />
+
+
+ {defaultValueState.hasDefaultValue && (
+
{
+ if (
+ parameterType === "file_url" &&
+ typeof value === "object" &&
+ value &&
+ "s3uri" in value
+ ) {
+ setDefaultValueState((state) => {
+ return {
+ ...state,
+ defaultValue: value.s3uri,
+ };
+ });
+ return;
+ }
+ setDefaultValueState((state) => {
+ return {
+ ...state,
+ defaultValue: value,
+ };
+ });
+ }}
+ type={parameterType}
+ value={defaultValueState.defaultValue}
+ />
+ )}
+
+ >
)}
{type === "credential" && (
<>
@@ -101,11 +174,32 @@ function WorkflowParameterAddPanel({ type, onClose, onSave }: Props) {