From e4e809cb6359ddff3b00a2c755920d7dbf257a8b Mon Sep 17 00:00:00 2001 From: ykeremy Date: Mon, 20 May 2024 15:23:01 +0000 Subject: [PATCH 1/2] =?UTF-8?q?=F0=9F=94=84=20synced=20local=20'skyvern-fr?= =?UTF-8?q?ontend/src/'=20with=20remote=20'skyvern-frontend/src/'?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- skyvern-frontend/src/api/QueryClient.ts | 2 +- skyvern-frontend/src/api/types.ts | 49 +- .../src/components/ui/dropdown-menu.tsx | 2 +- skyvern-frontend/src/router.tsx | 16 +- .../src/routes/tasks/create/CreateNewTask.tsx | 67 --- .../routes/tasks/create/CreateNewTaskForm.tsx | 45 +- .../tasks/create/CreateNewTaskFormPage.tsx | 61 +++ .../tasks/create/CreateNewTaskLayout.tsx | 11 + .../src/routes/tasks/create/SavedTaskCard.tsx | 144 ++++++ .../src/routes/tasks/create/SavedTaskForm.tsx | 452 ++++++++++++++++++ .../src/routes/tasks/create/SavedTasks.tsx | 134 ++++++ .../tasks/create/TaskTemplateFormSchema.ts | 8 + .../src/routes/tasks/create/TaskTemplates.tsx | 86 ++++ .../src/routes/tasks/data/sampleTaskData.ts | 29 ++ .../src/routes/tasks/detail/StepInfo.tsx | 3 +- .../src/routes/tasks/detail/TaskDetails.tsx | 21 +- .../src/routes/tasks/list/TaskActions.tsx | 219 +++++++++ .../src/routes/tasks/list/TaskHistory.tsx | 155 ++++++ .../src/routes/tasks/list/TaskList.tsx | 146 +----- .../routes/tasks/list/TaskListSkeleton.tsx | 46 -- .../tasks/list/TaskListSkeletonRows.tsx | 27 ++ .../routes/tasks/running/LatestScreenshot.tsx | 2 +- .../src/routes/tasks/running/QueuedTasks.tsx | 74 ++- .../src/routes/tasks/running/RunningTasks.tsx | 4 +- skyvern-frontend/src/routes/tasks/types.ts | 14 +- 25 files changed, 1496 insertions(+), 321 deletions(-) delete mode 100644 skyvern-frontend/src/routes/tasks/create/CreateNewTask.tsx create mode 100644 skyvern-frontend/src/routes/tasks/create/CreateNewTaskFormPage.tsx create mode 100644 skyvern-frontend/src/routes/tasks/create/CreateNewTaskLayout.tsx create mode 100644 skyvern-frontend/src/routes/tasks/create/SavedTaskCard.tsx create mode 100644 skyvern-frontend/src/routes/tasks/create/SavedTaskForm.tsx create mode 100644 skyvern-frontend/src/routes/tasks/create/SavedTasks.tsx create mode 100644 skyvern-frontend/src/routes/tasks/create/TaskTemplateFormSchema.ts create mode 100644 skyvern-frontend/src/routes/tasks/create/TaskTemplates.tsx create mode 100644 skyvern-frontend/src/routes/tasks/list/TaskActions.tsx create mode 100644 skyvern-frontend/src/routes/tasks/list/TaskHistory.tsx delete mode 100644 skyvern-frontend/src/routes/tasks/list/TaskListSkeleton.tsx create mode 100644 skyvern-frontend/src/routes/tasks/list/TaskListSkeletonRows.tsx diff --git a/skyvern-frontend/src/api/QueryClient.ts b/skyvern-frontend/src/api/QueryClient.ts index aaaac7785..3d0ffb9d2 100644 --- a/skyvern-frontend/src/api/QueryClient.ts +++ b/skyvern-frontend/src/api/QueryClient.ts @@ -3,7 +3,7 @@ import { QueryClient } from "@tanstack/react-query"; const queryClient = new QueryClient({ defaultOptions: { queries: { - staleTime: 1000 * 60 * 5, // 5 minutes + staleTime: Infinity, }, }, }); diff --git a/skyvern-frontend/src/api/types.ts b/skyvern-frontend/src/api/types.ts index 70df7e84e..373db4755 100644 --- a/skyvern-frontend/src/api/types.ts +++ b/skyvern-frontend/src/api/types.ts @@ -65,7 +65,7 @@ export type TaskApiResponse = { navigation_payload: string | object; // stringified JSON error_code_mapping: null; proxy_location: string; - extracted_information_schema: string; + extracted_information_schema: string | object; }; task_id: string; status: Status; @@ -101,3 +101,50 @@ export type ApiKeyApiResponse = { token_type: string; valid: boolean; }; + +export type WorkflowParameter = { + workflow_parameter_id: string; + workflow_parameter_type?: string; + key: string; + description: string | null; + workflow_id: string; + parameter_type: "workflow"; // TODO other values + default_value?: string; + created_at: string | null; + modified_at: string | null; + deleted_at: string | null; +}; + +export type WorkflowBlock = { + label: string; + block_type: string; + output_parameter?: null; + continue_on_failure: boolean; + url: string; + title: string; + navigation_goal: string; + data_extraction_goal: string; + data_schema: object | null; + error_code_mapping: null; // ? + max_retries: number | null; + max_steps_per_run: number | null; + parameters: []; // ? +}; + +export type WorkflowApiResponse = { + workflow_id: string; + organization_id: string; + title: string; + workflow_permanent_id: string; + version: number; + description: string; + workflow_definition: { + parameters: Array; + blocks: Array; + }; + proxy_location: string; + webhook_callback_url: string; + created_at: string; + modified_at: string; + deleted_at: string | null; +}; diff --git a/skyvern-frontend/src/components/ui/dropdown-menu.tsx b/skyvern-frontend/src/components/ui/dropdown-menu.tsx index 0759c1a34..60e73e353 100644 --- a/skyvern-frontend/src/components/ui/dropdown-menu.tsx +++ b/skyvern-frontend/src/components/ui/dropdown-menu.tsx @@ -86,7 +86,7 @@ const DropdownMenuItem = React.forwardRef< , + element: , + children: [ + { + index: true, + element: , + }, + { + path: ":template", + element: , + }, + ], }, { path: "settings", diff --git a/skyvern-frontend/src/routes/tasks/create/CreateNewTask.tsx b/skyvern-frontend/src/routes/tasks/create/CreateNewTask.tsx deleted file mode 100644 index e5a736d78..000000000 --- a/skyvern-frontend/src/routes/tasks/create/CreateNewTask.tsx +++ /dev/null @@ -1,67 +0,0 @@ -import { useId, useState } from "react"; -import { CreateNewTaskForm } from "./CreateNewTaskForm"; -import { - Select, - SelectContent, - SelectItem, - SelectTrigger, - SelectValue, -} from "@/components/ui/select"; -import { SampleCase } from "../types"; -import { getSampleForInitialFormValues } from "../data/sampleTaskData"; -import { Label } from "@/components/ui/label"; -import { - Card, - CardContent, - CardDescription, - CardHeader, - CardTitle, -} from "@/components/ui/card"; - -function CreateNewTask() { - const [selectedCase, setSelectedCase] = useState("geico"); - const caseInputId = useId(); - - return ( -
-
- - -
- - - Create a new task - - Fill out the form below to create a new task. You can select a - sample from above to prefill the form with sample data. - - - - - - -
- ); -} - -export { CreateNewTask }; diff --git a/skyvern-frontend/src/routes/tasks/create/CreateNewTaskForm.tsx b/skyvern-frontend/src/routes/tasks/create/CreateNewTaskForm.tsx index a72bd45df..ca7804fe1 100644 --- a/skyvern-frontend/src/routes/tasks/create/CreateNewTaskForm.tsx +++ b/skyvern-frontend/src/routes/tasks/create/CreateNewTaskForm.tsx @@ -23,7 +23,7 @@ import { Textarea } from "@/components/ui/textarea"; import { useMutation, useQueryClient } from "@tanstack/react-query"; import { getClient } from "@/api/AxiosClient"; import { useToast } from "@/components/ui/use-toast"; -import { InfoCircledIcon } from "@radix-ui/react-icons"; +import { InfoCircledIcon, ReloadIcon } from "@radix-ui/react-icons"; import { Tooltip, TooltipContent, @@ -41,11 +41,11 @@ const createNewTaskFormSchema = z.object({ url: z.string().url({ message: "Invalid URL", }), - webhookCallbackUrl: z.string().optional(), // url maybe, but shouldn't be validated as one - navigationGoal: z.string().optional(), - dataExtractionGoal: z.string().optional(), - navigationPayload: z.string().optional(), - extractedInformationSchema: z.string().optional(), + webhookCallbackUrl: z.string().or(z.null()).optional(), // url maybe, but shouldn't be validated as one + navigationGoal: z.string().or(z.null()).optional(), + dataExtractionGoal: z.string().or(z.null()).optional(), + navigationPayload: z.string().or(z.null()).optional(), + extractedInformationSchema: z.string().or(z.null()).optional(), }); export type CreateNewTaskFormValues = z.infer; @@ -62,8 +62,8 @@ function createTaskRequestObject(formValues: CreateNewTaskFormValues) { data_extraction_goal: formValues.dataExtractionGoal ?? "", proxy_location: "NONE", error_code_mapping: null, - navigation_payload: formValues.navigationPayload ?? "", - extracted_information_schema: formValues.extractedInformationSchema ?? "", + navigation_payload: formValues.navigationPayload, + extracted_information_schema: formValues.extractedInformationSchema, }; } @@ -90,7 +90,7 @@ function CreateNewTaskForm({ initialValues }: Props) { onError: (error) => { toast({ variant: "destructive", - title: "Error", + title: "There was an error creating the task.", description: error.message, }); }, @@ -126,7 +126,7 @@ function CreateNewTaskForm({ initialValues }: Props) {
- URL* + URL * @@ -167,7 +167,11 @@ function CreateNewTaskForm({ initialValues }: Props) {
- +
@@ -194,7 +198,12 @@ function CreateNewTaskForm({ initialValues }: Props) { -