From d1f2f68611f49d248a573e39b1a67369336769c1 Mon Sep 17 00:00:00 2001 From: Shuchang Zheng Date: Thu, 7 Nov 2024 15:20:07 +0000 Subject: [PATCH] =?UTF-8?q?=F0=9F=94=84=20synced=20local=20'skyvern-fronte?= =?UTF-8?q?nd/src/'=20with=20remote=20'skyvern-frontend/src/'?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit > [!IMPORTANT] > Add scrollable areas to `WorkflowParameterAddPanel` and `WorkflowParameterEditPanel` to handle content overflow. > > - **UI Enhancement**: > - Added `ScrollArea` and `ScrollAreaViewport` to `WorkflowParameterAddPanel.tsx` and `WorkflowParameterEditPanel.tsx` to handle overflow of content. > - Ensures UI remains usable with many parameters or long descriptions by making the panels scrollable. > > This description was created by [Ellipsis](https://www.ellipsis.dev?ref=Skyvern-AI%2Fskyvern-cloud&utm_source=github&utm_medium=referral) for 8aafeb4c7dc7868273d5ec9712d58023d975f3c4. It will automatically update as commits are pushed. --- .../panels/WorkflowParameterAddPanel.tsx | 479 +++++++++--------- .../panels/WorkflowParameterEditPanel.tsx | 479 +++++++++--------- 2 files changed, 488 insertions(+), 470 deletions(-) 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 + +
+
+
+
); }