Put workflow title in workflow runs table (#591)
This commit is contained in:
39
skyvern-frontend/src/routes/workflows/WorkflowTitle.tsx
Normal file
39
skyvern-frontend/src/routes/workflows/WorkflowTitle.tsx
Normal file
@@ -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<WorkflowApiResponse>({
|
||||||
|
queryKey: ["workflow", workflowPermanentId],
|
||||||
|
queryFn: async () => {
|
||||||
|
const client = await getClient(credentialGetter);
|
||||||
|
return client
|
||||||
|
.get(`/workflows/${workflowPermanentId}`)
|
||||||
|
.then((response) => response.data);
|
||||||
|
},
|
||||||
|
});
|
||||||
|
|
||||||
|
if (isLoading) {
|
||||||
|
return <Skeleton className="w-full h-6" />;
|
||||||
|
}
|
||||||
|
|
||||||
|
if (isError || !workflow) {
|
||||||
|
return <span></span>;
|
||||||
|
}
|
||||||
|
|
||||||
|
return <span>{workflow.title}</span>;
|
||||||
|
}
|
||||||
|
|
||||||
|
export { WorkflowTitle };
|
||||||
@@ -22,6 +22,7 @@ import {
|
|||||||
PaginationPrevious,
|
PaginationPrevious,
|
||||||
} from "@/components/ui/pagination";
|
} from "@/components/ui/pagination";
|
||||||
import { cn } from "@/util/utils";
|
import { cn } from "@/util/utils";
|
||||||
|
import { WorkflowTitle } from "./WorkflowTitle";
|
||||||
|
|
||||||
function Workflows() {
|
function Workflows() {
|
||||||
const credentialGetter = useCredentialGetter();
|
const credentialGetter = useCredentialGetter();
|
||||||
@@ -153,19 +154,20 @@ function Workflows() {
|
|||||||
<Table>
|
<Table>
|
||||||
<TableHeader>
|
<TableHeader>
|
||||||
<TableRow>
|
<TableRow>
|
||||||
<TableHead className="w-1/3">Workflow ID</TableHead>
|
<TableHead className="w-1/4">Workflow ID</TableHead>
|
||||||
<TableHead className="w-1/3">Workflow Run ID</TableHead>
|
<TableHead className="w-1/4">Workflow Title</TableHead>
|
||||||
<TableHead className="w-1/3">Status</TableHead>
|
<TableHead className="w-1/4">Workflow Run ID</TableHead>
|
||||||
|
<TableHead className="w-1/4">Status</TableHead>
|
||||||
</TableRow>
|
</TableRow>
|
||||||
</TableHeader>
|
</TableHeader>
|
||||||
<TableBody>
|
<TableBody>
|
||||||
{workflowRunsIsLoading ? (
|
{workflowRunsIsLoading ? (
|
||||||
<TableRow>
|
<TableRow>
|
||||||
<TableCell colSpan={3}>Loading...</TableCell>
|
<TableCell colSpan={4}>Loading...</TableCell>
|
||||||
</TableRow>
|
</TableRow>
|
||||||
) : workflowRuns?.length === 0 ? (
|
) : workflowRuns?.length === 0 ? (
|
||||||
<TableRow>
|
<TableRow>
|
||||||
<TableCell colSpan={3}>No workflow runs found</TableCell>
|
<TableCell colSpan={4}>No workflow runs found</TableCell>
|
||||||
</TableRow>
|
</TableRow>
|
||||||
) : (
|
) : (
|
||||||
workflowRuns?.map((workflowRun) => {
|
workflowRuns?.map((workflowRun) => {
|
||||||
@@ -179,13 +181,18 @@ function Workflows() {
|
|||||||
}}
|
}}
|
||||||
className="cursor-pointer"
|
className="cursor-pointer"
|
||||||
>
|
>
|
||||||
<TableCell className="w-1/3">
|
<TableCell className="w-1/4">
|
||||||
{workflowRun.workflow_permanent_id}
|
{workflowRun.workflow_permanent_id}
|
||||||
</TableCell>
|
</TableCell>
|
||||||
<TableCell className="w-1/3">
|
<TableCell className="w-1/4">
|
||||||
|
<WorkflowTitle
|
||||||
|
workflowPermanentId={workflowRun.workflow_permanent_id}
|
||||||
|
/>
|
||||||
|
</TableCell>
|
||||||
|
<TableCell className="w-1/4">
|
||||||
{workflowRun.workflow_run_id}
|
{workflowRun.workflow_run_id}
|
||||||
</TableCell>
|
</TableCell>
|
||||||
<TableCell className="w-1/3">
|
<TableCell className="w-1/4">
|
||||||
<StatusBadge status={workflowRun.status} />
|
<StatusBadge status={workflowRun.status} />
|
||||||
</TableCell>
|
</TableCell>
|
||||||
</TableRow>
|
</TableRow>
|
||||||
|
|||||||
Reference in New Issue
Block a user