diff --git a/skyvern-frontend/src/routes/workflows/editor/panels/WorkflowParameterAddPanel.tsx b/skyvern-frontend/src/routes/workflows/editor/panels/WorkflowParameterAddPanel.tsx index 52b984b920..6a451a399b 100644 --- a/skyvern-frontend/src/routes/workflows/editor/panels/WorkflowParameterAddPanel.tsx +++ b/skyvern-frontend/src/routes/workflows/editor/panels/WorkflowParameterAddPanel.tsx @@ -18,6 +18,7 @@ import { Checkbox } from "@/components/ui/checkbox"; import { getDefaultValueForParameterType } from "../workflowEditorUtils"; import { toast } from "@/components/ui/use-toast"; import { SourceParameterKeySelector } from "../../components/SourceParameterKeySelector"; +import { ScrollArea, ScrollAreaViewport } from "@/components/ui/scroll-area"; type Props = { type: "workflow" | "credential" | "context" | "secret"; @@ -69,254 +70,262 @@ function WorkflowParameterAddPanel({ type, onClose, onSave }: Props) { const [identityFields, setIdentityFields] = useState(""); return ( -
-
- {header(type)} - -
-
- - setKey(e.target.value)} /> -
-
- - setDescription(e.target.value)} - /> -
- {type === "workflow" && ( - <> + + +
+
+ {header(type)} + +
- - + + setKey(e.target.value)} />
-
-
- { - if (!checked) { - setDefaultValueState({ - hasDefaultValue: false, - defaultValue: null, +
+ + setDescription(e.target.value)} + /> +
+ {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" && ( + <> +
+ + setUrlParameterKey(e.target.value)} + /> +
+
+ + setCollectionId(e.target.value)} + /> +
+ + )} + {type === "context" && ( +
+ + -
- {defaultValueState.hasDefaultValue && ( - { + )} + {type === "secret" && ( + <> +
+ + setIdentityKey(e.target.value)} + /> +
+
+ + setIdentityFields(e.target.value)} + /> +
+
+ + setCollectionId(e.target.value)} + /> +
+ + )} +
+
- - )} - {type === "credential" && ( - <> -
- - setUrlParameterKey(e.target.value)} - /> -
-
- - setCollectionId(e.target.value)} - /> -
- - )} - {type === "context" && ( -
- - -
- )} - {type === "secret" && ( - <> -
- - setIdentityKey(e.target.value)} - /> -
-
- - setIdentityFields(e.target.value)} - /> -
-
- - setCollectionId(e.target.value)} - /> -
- - )} -
- -
-
+ }} + > + Save + +
+
+
+
); } diff --git a/skyvern-frontend/src/routes/workflows/editor/panels/WorkflowParameterEditPanel.tsx b/skyvern-frontend/src/routes/workflows/editor/panels/WorkflowParameterEditPanel.tsx index 3cf05c6429..a7926371c6 100644 --- a/skyvern-frontend/src/routes/workflows/editor/panels/WorkflowParameterEditPanel.tsx +++ b/skyvern-frontend/src/routes/workflows/editor/panels/WorkflowParameterEditPanel.tsx @@ -18,6 +18,7 @@ import { getDefaultValueForParameterType } from "../workflowEditorUtils"; import { WorkflowParameterInput } from "../../WorkflowParameterInput"; import { toast } from "@/components/ui/use-toast"; import { SourceParameterKeySelector } from "../../components/SourceParameterKeySelector"; +import { ScrollArea, ScrollAreaViewport } from "@/components/ui/scroll-area"; type Props = { type: "workflow" | "credential" | "context" | "secret"; @@ -110,254 +111,262 @@ function WorkflowParameterEditPanel({ ); return ( -
-
- {header(type)} - -
-
- - setKey(e.target.value)} /> -
-
- - setDescription(e.target.value)} - /> -
- {type === "workflow" && ( - <> + + +
+
+ {header(type)} + +
- - + + setKey(e.target.value)} />
-
-
- { - if (!checked) { - setDefaultValueState({ - hasDefaultValue: false, - defaultValue: null, +
+ + setDescription(e.target.value)} + /> +
+ {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, + }; + }); + return; + } + setDefaultValueState((state) => { + return { + ...state, + defaultValue: value, + }; + }); + }} + type={parameterType} + value={defaultValueState.defaultValue} + /> + )} +
+ + )} + {type === "credential" && ( + <> +
+ + setUrlParameterKey(e.target.value)} + /> +
+
+ + setCollectionId(e.target.value)} + /> +
+ + )} + {type === "context" && ( +
+ + -
- {defaultValueState.hasDefaultValue && ( - { + )} + {type === "secret" && ( + <> +
+ + setIdentityKey(e.target.value)} + /> +
+
+ + setIdentityFields(e.target.value)} + /> +
+
+ + setCollectionId(e.target.value)} + /> +
+ + )} +
+
- - )} - {type === "credential" && ( - <> -
- - setUrlParameterKey(e.target.value)} - /> -
-
- - setCollectionId(e.target.value)} - /> -
- - )} - {type === "context" && ( -
- - -
- )} - {type === "secret" && ( - <> -
- - setIdentityKey(e.target.value)} - /> -
-
- - setIdentityFields(e.target.value)} - /> -
-
- - setCollectionId(e.target.value)} - /> -
- - )} -
- -
-
+ }} + > + Save + +
+
+
+
); }