diff --git a/skyvern-frontend/src/routes/workflows/WorkflowTitle.tsx b/skyvern-frontend/src/routes/workflows/WorkflowTitle.tsx new file mode 100644 index 00000000..4b6c16e4 --- /dev/null +++ b/skyvern-frontend/src/routes/workflows/WorkflowTitle.tsx @@ -0,0 +1,39 @@ +import { getClient } from "@/api/AxiosClient"; +import { WorkflowApiResponse } from "@/api/types"; +import { Skeleton } from "@/components/ui/skeleton"; +import { useCredentialGetter } from "@/hooks/useCredentialGetter"; +import { useQuery } from "@tanstack/react-query"; + +type Props = { + workflowPermanentId: string; +}; + +function WorkflowTitle({ workflowPermanentId }: Props) { + const credentialGetter = useCredentialGetter(); + + const { + data: workflow, + isError, + isLoading, + } = useQuery({ + queryKey: ["workflow", workflowPermanentId], + queryFn: async () => { + const client = await getClient(credentialGetter); + return client + .get(`/workflows/${workflowPermanentId}`) + .then((response) => response.data); + }, + }); + + if (isLoading) { + return ; + } + + if (isError || !workflow) { + return ; + } + + return {workflow.title}; +} + +export { WorkflowTitle }; diff --git a/skyvern-frontend/src/routes/workflows/Workflows.tsx b/skyvern-frontend/src/routes/workflows/Workflows.tsx index 02086020..c72afc9c 100644 --- a/skyvern-frontend/src/routes/workflows/Workflows.tsx +++ b/skyvern-frontend/src/routes/workflows/Workflows.tsx @@ -22,6 +22,7 @@ import { PaginationPrevious, } from "@/components/ui/pagination"; import { cn } from "@/util/utils"; +import { WorkflowTitle } from "./WorkflowTitle"; function Workflows() { const credentialGetter = useCredentialGetter(); @@ -153,19 +154,20 @@ function Workflows() { - Workflow ID - Workflow Run ID - Status + Workflow ID + Workflow Title + Workflow Run ID + Status {workflowRunsIsLoading ? ( - Loading... + Loading... ) : workflowRuns?.length === 0 ? ( - No workflow runs found + No workflow runs found ) : ( workflowRuns?.map((workflowRun) => { @@ -179,13 +181,18 @@ function Workflows() { }} className="cursor-pointer" > - + {workflowRun.workflow_permanent_id} - + + + + {workflowRun.workflow_run_id} - +