From ee0302171e6b3da4b2f682e7b4954f34861a1455 Mon Sep 17 00:00:00 2001 From: Prakash Maheshwaran Date: Thu, 5 Jun 2025 06:47:05 -0400 Subject: [PATCH] Revert "Revert "feat: add SKYVERN_BASE_URL environment variable support for client base URL"" This reverts commit d0ea267ad141203237d26a5df2c53bf8083535bb. --- .../src/components/CopyApiCommandDropdown.tsx | 59 ------------------- .../routes/tasks/create/CreateNewTaskForm.tsx | 40 +++++++++---- .../src/routes/tasks/create/SavedTaskForm.tsx | 41 +++++++++---- .../src/routes/tasks/detail/TaskDetails.tsx | 44 ++++++++++---- .../src/routes/workflows/RunWorkflowForm.tsx | 50 +++++++++++----- .../src/routes/workflows/WorkflowRun.tsx | 49 ++++++++++----- skyvern-frontend/src/util/apiCommands.ts | 32 ---------- skyvern/client/client.py | 26 ++++++-- 8 files changed, 176 insertions(+), 165 deletions(-) delete mode 100644 skyvern-frontend/src/components/CopyApiCommandDropdown.tsx delete mode 100644 skyvern-frontend/src/util/apiCommands.ts diff --git a/skyvern-frontend/src/components/CopyApiCommandDropdown.tsx b/skyvern-frontend/src/components/CopyApiCommandDropdown.tsx deleted file mode 100644 index 57dd40db..00000000 --- a/skyvern-frontend/src/components/CopyApiCommandDropdown.tsx +++ /dev/null @@ -1,59 +0,0 @@ -import { CopyIcon } from "@radix-ui/react-icons"; -import { - DropdownMenu, - DropdownMenuContent, - DropdownMenuItem, - DropdownMenuTrigger, -} from "@/components/ui/dropdown-menu"; -import { Button } from "@/components/ui/button"; -import { useToast } from "@/components/ui/use-toast"; -import { copyText } from "@/util/copyText"; -import { - type ApiRequest, - getCurlCommand, - getPowerShellCommand, -} from "@/util/apiCommands"; - -interface Props { - getRequest: () => ApiRequest; -} - -function CopyApiCommandDropdown({ getRequest }: Props) { - const { toast } = useToast(); - - const handleCopy = async (type: "curl" | "powershell") => { - const request = getRequest(); - const text = - type === "curl" ? getCurlCommand(request) : getPowerShellCommand(request); - await copyText(text); - toast({ - variant: "success", - title: "Copied to Clipboard", - description: - type === "curl" - ? "The cURL command has been copied to your clipboard." - : "The PowerShell command has been copied to your clipboard.", - }); - }; - - return ( - - - - - - handleCopy("curl")}> - Copy cURL (Unix/Linux/macOS) - - handleCopy("powershell")}> - Copy PowerShell (Windows) - - - - ); -} - -export { CopyApiCommandDropdown }; diff --git a/skyvern-frontend/src/routes/tasks/create/CreateNewTaskForm.tsx b/skyvern-frontend/src/routes/tasks/create/CreateNewTaskForm.tsx index cf697f22..8631daa3 100644 --- a/skyvern-frontend/src/routes/tasks/create/CreateNewTaskForm.tsx +++ b/skyvern-frontend/src/routes/tasks/create/CreateNewTaskForm.tsx @@ -20,12 +20,14 @@ import { toast } from "@/components/ui/use-toast"; import { useApiCredential } from "@/hooks/useApiCredential"; import { useCredentialGetter } from "@/hooks/useCredentialGetter"; import { CodeEditor } from "@/routes/workflows/components/CodeEditor"; +import { copyText } from "@/util/copyText"; import { apiBaseUrl } from "@/util/env"; import { zodResolver } from "@hookform/resolvers/zod"; -import { PlayIcon, ReloadIcon } from "@radix-ui/react-icons"; +import { CopyIcon, PlayIcon, ReloadIcon } from "@radix-ui/react-icons"; import { ToastAction } from "@radix-ui/react-toast"; import { useMutation, useQuery, useQueryClient } from "@tanstack/react-query"; import { AxiosError } from "axios"; +import fetchToCurl from "fetch-to-curl"; import { useState } from "react"; import { useForm, useFormState } from "react-hook-form"; import { Link } from "react-router-dom"; @@ -37,7 +39,6 @@ import { } from "./taskFormTypes"; import { ProxySelector } from "@/components/ProxySelector"; import { Switch } from "@/components/ui/switch"; -import { CopyApiCommandDropdown } from "@/components/CopyApiCommandDropdown"; type Props = { initialValues: CreateNewTaskFormValues; }; @@ -621,17 +622,30 @@ function CreateNewTaskForm({ initialValues }: Props) {
- ({ - method: "POST", - url: `${apiBaseUrl}/tasks`, - body: createTaskRequestObject(form.getValues()), - headers: { - "Content-Type": "application/json", - "x-api-key": apiCredential ?? "", - }, - })} - /> + {taskIsRunningOrQueued && ( diff --git a/skyvern-frontend/src/routes/workflows/RunWorkflowForm.tsx b/skyvern-frontend/src/routes/workflows/RunWorkflowForm.tsx index 540c702f..b7974a7b 100644 --- a/skyvern-frontend/src/routes/workflows/RunWorkflowForm.tsx +++ b/skyvern-frontend/src/routes/workflows/RunWorkflowForm.tsx @@ -14,10 +14,11 @@ import { Input } from "@/components/ui/input"; import { toast } from "@/components/ui/use-toast"; import { useApiCredential } from "@/hooks/useApiCredential"; import { useCredentialGetter } from "@/hooks/useCredentialGetter"; +import { copyText } from "@/util/copyText"; import { apiBaseUrl } from "@/util/env"; -import { PlayIcon, ReloadIcon } from "@radix-ui/react-icons"; +import { CopyIcon, PlayIcon, ReloadIcon } from "@radix-ui/react-icons"; import { useMutation, useQueryClient } from "@tanstack/react-query"; -import { CopyApiCommandDropdown } from "@/components/CopyApiCommandDropdown"; +import fetchToCurl from "fetch-to-curl"; import { useForm } from "react-hook-form"; import { useNavigate, useParams } from "react-router-dom"; import { z } from "zod"; @@ -332,20 +333,39 @@ function RunWorkflowForm({
- ({ - method: "POST", - url: `${apiBaseUrl}/workflows/${workflowPermanentId}/run`, - body: getRunWorkflowRequestBody( - form.getValues(), +
- ({ - method: "POST", - url: `${apiBaseUrl}/workflows/${workflowPermanentId}/run`, - body: { - data: workflowRun?.parameters, - proxy_location: "RESIDENTIAL", - }, - headers: { - "Content-Type": "application/json", - "x-api-key": apiCredential ?? "", - }, - })} - /> +