-
Notifications
You must be signed in to change notification settings - Fork 843
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
🔄 synced local 'skyvern-frontend/src/' with remote 'skyvern-frontend/…
…src/' <!-- ELLIPSIS_HIDDEN --> > [!IMPORTANT] > Adds `URLNode` to Skyvern frontend for URL navigation in workflows, updating node types, icons, and UI components. > > - **New Feature**: > - Introduces `URLNode` component in `URLNode.tsx` for navigating to URLs in workflows. > - Adds `URLNode` type in `types.ts` and default data in `urlNodeDefaultData`. > - Updates `WorkflowBlockIcon.tsx` to include `ExternalLinkIcon` for `goto_url` type. > - **Integration**: > - Updates `index.ts` to include `URLNode` in `WorkflowBlockNode` and `nodeTypes`. > - Modifies `workflowEditorUtils.ts` to handle `goto_url` in `convertToNode()`, `createNode()`, and `getWorkflowBlock()`. > - Adds `URLBlock` type in `workflowTypes.ts` and `URLBlockYAML` in `workflowYamlTypes.ts`. > - **UI Enhancements**: > - Adds `Go to URL Block` to `WorkflowNodeLibraryPanel.tsx` with description and icon. > - Updates `helpContent.ts` to include tooltips and placeholders for `url`. > > <sup>This description was created by </sup>[<img alt="Ellipsis" src="https://img.shields.io/badge/Ellipsis-blue?color=175173">](https://www.ellipsis.dev?ref=Skyvern-AI%2Fskyvern-cloud&utm_source=github&utm_medium=referral)<sup> for 6837159776fa877a8565330e53667954c07ad2ee. It will automatically update as commits are pushed.</sup> <!-- ELLIPSIS_HIDDEN -->
- Loading branch information
1 parent
164193a
commit 7c29369
Showing
12 changed files
with
203 additions
and
7 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
103 changes: 103 additions & 0 deletions
103
skyvern-frontend/src/routes/workflows/editor/nodes/URLNode/URLNode.tsx
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,103 @@ | ||
import { Handle, NodeProps, Position, useReactFlow } from "@xyflow/react"; | ||
import type { URLNode } from "./types"; | ||
import { useIsFirstBlockInWorkflow } from "../../hooks/useIsFirstNodeInWorkflow"; | ||
import { useDeleteNodeCallback } from "@/routes/workflows/hooks/useDeleteNodeCallback"; | ||
import { useNodeLabelChangeHandler } from "@/routes/workflows/hooks/useLabelChangeHandler"; | ||
import { useState } from "react"; | ||
import { WorkflowBlockIcon } from "../WorkflowBlockIcon"; | ||
import { WorkflowBlockTypes } from "@/routes/workflows/types/workflowTypes"; | ||
import { EditableNodeTitle } from "../components/EditableNodeTitle"; | ||
import { NodeActionMenu } from "../NodeActionMenu"; | ||
import { Label } from "@/components/ui/label"; | ||
import { WorkflowBlockInputTextarea } from "@/components/WorkflowBlockInputTextarea"; | ||
import { placeholders } from "../../helpContent"; | ||
|
||
function URLNode({ id, data, type }: NodeProps<URLNode>) { | ||
const { updateNodeData } = useReactFlow(); | ||
const { editable } = data; | ||
const deleteNodeCallback = useDeleteNodeCallback(); | ||
const [label, setLabel] = useNodeLabelChangeHandler({ | ||
id, | ||
initialValue: data.label, | ||
}); | ||
const isFirstWorkflowBlock = useIsFirstBlockInWorkflow({ id }); | ||
|
||
const [inputs, setInputs] = useState({ | ||
url: data.url, | ||
}); | ||
|
||
function handleChange(key: string, value: unknown) { | ||
if (!editable) { | ||
return; | ||
} | ||
setInputs({ ...inputs, [key]: value }); | ||
updateNodeData(id, { [key]: value }); | ||
} | ||
|
||
return ( | ||
<div> | ||
<Handle | ||
type="source" | ||
position={Position.Bottom} | ||
id="a" | ||
className="opacity-0" | ||
/> | ||
<Handle | ||
type="target" | ||
position={Position.Top} | ||
id="b" | ||
className="opacity-0" | ||
/> | ||
<div className="w-[30rem] space-y-4 rounded-lg bg-slate-elevation3 px-6 py-4"> | ||
<div className="flex h-[2.75rem] justify-between"> | ||
<div className="flex gap-2"> | ||
<div className="flex h-[2.75rem] w-[2.75rem] items-center justify-center rounded border border-slate-600"> | ||
<WorkflowBlockIcon | ||
workflowBlockType={WorkflowBlockTypes.URL} | ||
className="size-6" | ||
/> | ||
</div> | ||
<div className="flex flex-col gap-1"> | ||
<EditableNodeTitle | ||
value={label} | ||
editable={editable} | ||
onChange={setLabel} | ||
titleClassName="text-base" | ||
inputClassName="text-base" | ||
/> | ||
<span className="text-xs text-slate-400">Go to URL Block</span> | ||
</div> | ||
</div> | ||
<NodeActionMenu | ||
onDelete={() => { | ||
deleteNodeCallback(id); | ||
}} | ||
/> | ||
</div> | ||
<div className="space-y-4"> | ||
<div className="space-y-2"> | ||
<div className="flex justify-between"> | ||
<Label className="text-xs text-slate-300">URL</Label> | ||
{isFirstWorkflowBlock ? ( | ||
<div className="flex justify-end text-xs text-slate-400"> | ||
Tip: Use the {"+"} button to add parameters! | ||
</div> | ||
) : null} | ||
</div> | ||
<WorkflowBlockInputTextarea | ||
nodeId={id} | ||
onChange={(value) => { | ||
handleChange("url", value); | ||
}} | ||
value={inputs.url} | ||
placeholder={placeholders[type]["url"]} | ||
className="nopan text-xs" | ||
/> | ||
</div> | ||
</div> | ||
</div> | ||
</div> | ||
); | ||
} | ||
|
||
export { URLNode }; |
19 changes: 19 additions & 0 deletions
19
skyvern-frontend/src/routes/workflows/editor/nodes/URLNode/types.ts
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,19 @@ | ||
import { Node } from "@xyflow/react"; | ||
import { NodeBaseData } from "../types"; | ||
|
||
export type URLNodeData = NodeBaseData & { | ||
url: string; | ||
}; | ||
|
||
export type URLNode = Node<URLNodeData, "url">; | ||
|
||
export const urlNodeDefaultData: URLNodeData = { | ||
label: "", | ||
continueOnFailure: false, | ||
url: "", | ||
editable: true, | ||
}; | ||
|
||
export function isUrlNode(node: Node): node is URLNode { | ||
return node.type === "url"; | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters