Fix running and queued action navigation (#449)
This commit is contained in:
@@ -55,7 +55,7 @@ export type StepApiResponse = {
|
|||||||
is_last: boolean;
|
is_last: boolean;
|
||||||
order: number;
|
order: number;
|
||||||
organization_id: string;
|
organization_id: string;
|
||||||
output: {
|
output?: {
|
||||||
actions_and_results: ActionAndResultApiResponse[];
|
actions_and_results: ActionAndResultApiResponse[];
|
||||||
errors: unknown[];
|
errors: unknown[];
|
||||||
};
|
};
|
||||||
|
|||||||
@@ -13,7 +13,7 @@ function TaskActions() {
|
|||||||
|
|
||||||
const activeAction = data?.[selectedActionIndex];
|
const activeAction = data?.[selectedActionIndex];
|
||||||
|
|
||||||
if (isFetching || !data) {
|
if (isFetching) {
|
||||||
return (
|
return (
|
||||||
<div className="flex gap-2">
|
<div className="flex gap-2">
|
||||||
<div className="h-[40rem] w-3/4">
|
<div className="h-[40rem] w-3/4">
|
||||||
@@ -26,8 +26,12 @@ function TaskActions() {
|
|||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if (!data) {
|
||||||
|
return <div>No actions</div>;
|
||||||
|
}
|
||||||
|
|
||||||
if (!activeAction) {
|
if (!activeAction) {
|
||||||
return <div>No action</div>;
|
return <div>No active action</div>;
|
||||||
}
|
}
|
||||||
|
|
||||||
return (
|
return (
|
||||||
|
|||||||
@@ -53,7 +53,7 @@ function useActions(taskId: string): {
|
|||||||
|
|
||||||
const actions = stepsQuery.data
|
const actions = stepsQuery.data
|
||||||
?.map((step) => {
|
?.map((step) => {
|
||||||
const actionsAndResults = step.output.actions_and_results;
|
const actionsAndResults = step.output?.actions_and_results ?? [];
|
||||||
|
|
||||||
const actions = actionsAndResults.map((actionAndResult, index) => {
|
const actions = actionsAndResults.map((actionAndResult, index) => {
|
||||||
const action = actionAndResult[0];
|
const action = actionAndResult[0];
|
||||||
|
|||||||
@@ -55,7 +55,7 @@ function QueuedTasks() {
|
|||||||
key={task.task_id}
|
key={task.task_id}
|
||||||
className="w-4"
|
className="w-4"
|
||||||
onClick={() => {
|
onClick={() => {
|
||||||
navigate(task.task_id);
|
navigate(`${task.task_id}/actions`);
|
||||||
}}
|
}}
|
||||||
>
|
>
|
||||||
<TableCell className="w-1/4">{task.task_id}</TableCell>
|
<TableCell className="w-1/4">{task.task_id}</TableCell>
|
||||||
|
|||||||
@@ -42,7 +42,7 @@ function RunningTasks() {
|
|||||||
key={task.task_id}
|
key={task.task_id}
|
||||||
className="hover:bg-muted/50 cursor-pointer"
|
className="hover:bg-muted/50 cursor-pointer"
|
||||||
onClick={() => {
|
onClick={() => {
|
||||||
navigate(`/tasks/${task.task_id}`);
|
navigate(`/tasks/${task.task_id}/actions`);
|
||||||
}}
|
}}
|
||||||
>
|
>
|
||||||
<CardHeader>
|
<CardHeader>
|
||||||
|
|||||||
Reference in New Issue
Block a user