Improve loading state in new task ui (#414)
This commit is contained in:
@@ -4,6 +4,7 @@ import { ActionScreenshot } from "./ActionScreenshot";
|
|||||||
import { InputReasoningCard } from "./InputReasoningCard";
|
import { InputReasoningCard } from "./InputReasoningCard";
|
||||||
import { ScrollableActionList } from "./ScrollableActionList";
|
import { ScrollableActionList } from "./ScrollableActionList";
|
||||||
import { useActions } from "./useActions";
|
import { useActions } from "./useActions";
|
||||||
|
import { Skeleton } from "@/components/ui/skeleton";
|
||||||
|
|
||||||
function TaskActions() {
|
function TaskActions() {
|
||||||
const { taskId } = useParams();
|
const { taskId } = useParams();
|
||||||
@@ -14,7 +15,16 @@ function TaskActions() {
|
|||||||
const activeAction = data?.[selectedActionIndex];
|
const activeAction = data?.[selectedActionIndex];
|
||||||
|
|
||||||
if (isFetching || !data) {
|
if (isFetching || !data) {
|
||||||
return <div>Loading...</div>;
|
return (
|
||||||
|
<div className="flex gap-2">
|
||||||
|
<div className="h-[40rem] w-3/4">
|
||||||
|
<Skeleton className="h-full" />
|
||||||
|
</div>
|
||||||
|
<div className="h-[40rem] w-1/4">
|
||||||
|
<Skeleton className="h-full" />
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
if (!activeAction) {
|
if (!activeAction) {
|
||||||
|
|||||||
@@ -41,40 +41,44 @@ function TaskDetails() {
|
|||||||
return <div>Error: {taskError?.message}</div>;
|
return <div>Error: {taskError?.message}</div>;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
const informationContentLabel =
|
||||||
|
task?.status === Status.Completed
|
||||||
|
? "Extracted Information"
|
||||||
|
: task?.status === Status.Failed || task?.status === Status.Terminated
|
||||||
|
? "Failure Reason"
|
||||||
|
: "";
|
||||||
|
|
||||||
|
const informationContent =
|
||||||
|
task?.status === Status.Completed
|
||||||
|
? JSON.stringify(task.extracted_information, null, 2)
|
||||||
|
: task?.status === Status.Failed || task?.status === Status.Terminated
|
||||||
|
? JSON.stringify(task?.failure_reason)
|
||||||
|
: "";
|
||||||
|
|
||||||
return (
|
return (
|
||||||
<div className="flex flex-col gap-8">
|
<div className="flex flex-col gap-8">
|
||||||
<div className="flex items-center gap-4">
|
<div className="flex items-center gap-4">
|
||||||
<Input value={taskId} className="w-52" readOnly />
|
<Input value={taskId} className="w-52" readOnly />
|
||||||
{taskIsFetching ? (
|
{taskIsFetching ? (
|
||||||
<Skeleton className="w-32 h-8" />
|
<Skeleton className="w-28 h-8" />
|
||||||
) : task ? (
|
) : task ? (
|
||||||
<StatusBadge status={task?.status} />
|
<StatusBadge status={task?.status} />
|
||||||
) : null}
|
) : null}
|
||||||
</div>
|
</div>
|
||||||
<div>
|
<div>
|
||||||
{task?.status === Status.Completed ? (
|
{taskIsFetching ? (
|
||||||
|
<div className="flex items-center gap-2">
|
||||||
|
<Skeleton className="w-32 h-32" />
|
||||||
|
<Skeleton className="w-full h-32" />
|
||||||
|
</div>
|
||||||
|
) : (
|
||||||
<div className="flex items-center">
|
<div className="flex items-center">
|
||||||
<Label className="w-32 shrink-0 text-lg">
|
<Label className="w-32 shrink-0 text-lg">
|
||||||
Extracted Information
|
{informationContentLabel}
|
||||||
</Label>
|
</Label>
|
||||||
<Textarea
|
<Textarea rows={5} value={informationContent} readOnly />
|
||||||
rows={5}
|
|
||||||
value={JSON.stringify(task.extracted_information, null, 2)}
|
|
||||||
readOnly
|
|
||||||
/>
|
|
||||||
</div>
|
</div>
|
||||||
) : null}
|
)}
|
||||||
{task?.status === Status.Failed ||
|
|
||||||
task?.status === Status.Terminated ? (
|
|
||||||
<div className="flex items-center">
|
|
||||||
<Label>Failure Reason</Label>
|
|
||||||
<Textarea
|
|
||||||
rows={5}
|
|
||||||
value={JSON.stringify(task.failure_reason)}
|
|
||||||
readOnly
|
|
||||||
/>
|
|
||||||
</div>
|
|
||||||
) : null}
|
|
||||||
</div>
|
</div>
|
||||||
<div className="flex justify-center items-center">
|
<div className="flex justify-center items-center">
|
||||||
<div className="inline-flex border rounded bg-muted p-1">
|
<div className="inline-flex border rounded bg-muted p-1">
|
||||||
|
|||||||
@@ -8,6 +8,7 @@ import {
|
|||||||
CardTitle,
|
CardTitle,
|
||||||
} from "@/components/ui/card";
|
} from "@/components/ui/card";
|
||||||
import { Input } from "@/components/ui/input";
|
import { Input } from "@/components/ui/input";
|
||||||
|
import { Skeleton } from "@/components/ui/skeleton";
|
||||||
import { Textarea } from "@/components/ui/textarea";
|
import { Textarea } from "@/components/ui/textarea";
|
||||||
import { useCredentialGetter } from "@/hooks/useCredentialGetter";
|
import { useCredentialGetter } from "@/hooks/useCredentialGetter";
|
||||||
import { basicTimeFormat } from "@/util/timeFormat";
|
import { basicTimeFormat } from "@/util/timeFormat";
|
||||||
@@ -31,7 +32,11 @@ function TaskParameters() {
|
|||||||
});
|
});
|
||||||
|
|
||||||
if (taskIsFetching) {
|
if (taskIsFetching) {
|
||||||
return <div>Loading parameters...</div>;
|
return (
|
||||||
|
<div className="h-[40rem]">
|
||||||
|
<Skeleton className="h-full" />
|
||||||
|
</div>
|
||||||
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
if (taskIsError || !task) {
|
if (taskIsError || !task) {
|
||||||
|
|||||||
@@ -4,6 +4,7 @@ import { useCredentialGetter } from "@/hooks/useCredentialGetter";
|
|||||||
import { useQuery } from "@tanstack/react-query";
|
import { useQuery } from "@tanstack/react-query";
|
||||||
import { getRecordingURL } from "./artifactUtils";
|
import { getRecordingURL } from "./artifactUtils";
|
||||||
import { useParams } from "react-router-dom";
|
import { useParams } from "react-router-dom";
|
||||||
|
import { Skeleton } from "@/components/ui/skeleton";
|
||||||
|
|
||||||
function TaskRecording() {
|
function TaskRecording() {
|
||||||
const { taskId } = useParams();
|
const { taskId } = useParams();
|
||||||
@@ -22,7 +23,13 @@ function TaskRecording() {
|
|||||||
});
|
});
|
||||||
|
|
||||||
if (taskIsFetching) {
|
if (taskIsFetching) {
|
||||||
return <div>Loading recording...</div>;
|
return (
|
||||||
|
<div className="flex mx-auto">
|
||||||
|
<div className="w-[800px] h-[450px]">
|
||||||
|
<Skeleton className="h-full" />
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
if (taskIsError || !task) {
|
if (taskIsError || !task) {
|
||||||
|
|||||||
Reference in New Issue
Block a user