Fix edit
This commit is contained in:
@@ -9,6 +9,8 @@ import {
|
|||||||
ChevronDown,
|
ChevronDown,
|
||||||
ChevronUp,
|
ChevronUp,
|
||||||
Settings2,
|
Settings2,
|
||||||
|
Edit,
|
||||||
|
Trash2,
|
||||||
} from "lucide-react";
|
} from "lucide-react";
|
||||||
import { Button } from "@/components/ui/button";
|
import { Button } from "@/components/ui/button";
|
||||||
|
|
||||||
@@ -45,6 +47,8 @@ interface TaskDetailsPanelProps {
|
|||||||
projectId: string;
|
projectId: string;
|
||||||
isOpen: boolean;
|
isOpen: boolean;
|
||||||
onClose: () => void;
|
onClose: () => void;
|
||||||
|
onEditTask?: (task: TaskWithAttemptStatus) => void;
|
||||||
|
onDeleteTask?: (taskId: string) => void;
|
||||||
}
|
}
|
||||||
|
|
||||||
const statusLabels: Record<TaskStatus, string> = {
|
const statusLabels: Record<TaskStatus, string> = {
|
||||||
@@ -119,6 +123,8 @@ export function TaskDetailsPanel({
|
|||||||
projectId,
|
projectId,
|
||||||
isOpen,
|
isOpen,
|
||||||
onClose,
|
onClose,
|
||||||
|
onEditTask,
|
||||||
|
onDeleteTask,
|
||||||
}: TaskDetailsPanelProps) {
|
}: TaskDetailsPanelProps) {
|
||||||
const [taskAttempts, setTaskAttempts] = useState<TaskAttempt[]>([]);
|
const [taskAttempts, setTaskAttempts] = useState<TaskAttempt[]>([]);
|
||||||
const [selectedAttempt, setSelectedAttempt] = useState<TaskAttempt | null>(
|
const [selectedAttempt, setSelectedAttempt] = useState<TaskAttempt | null>(
|
||||||
@@ -350,6 +356,24 @@ export function TaskDetailsPanel({
|
|||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
<div className="flex items-center gap-1">
|
<div className="flex items-center gap-1">
|
||||||
|
{onEditTask && (
|
||||||
|
<Button
|
||||||
|
variant="ghost"
|
||||||
|
size="icon"
|
||||||
|
onClick={() => onEditTask(task)}
|
||||||
|
>
|
||||||
|
<Edit className="h-4 w-4" />
|
||||||
|
</Button>
|
||||||
|
)}
|
||||||
|
{onDeleteTask && (
|
||||||
|
<Button
|
||||||
|
variant="ghost"
|
||||||
|
size="icon"
|
||||||
|
onClick={() => onDeleteTask(task.id)}
|
||||||
|
>
|
||||||
|
<Trash2 className="h-4 w-4 text-red-500" />
|
||||||
|
</Button>
|
||||||
|
)}
|
||||||
<Button variant="ghost" size="icon" onClick={onClose}>
|
<Button variant="ghost" size="icon" onClick={onClose}>
|
||||||
<X className="h-4 w-4" />
|
<X className="h-4 w-4" />
|
||||||
</Button>
|
</Button>
|
||||||
@@ -590,8 +614,14 @@ export function TaskDetailsPanel({
|
|||||||
] && (
|
] && (
|
||||||
<div className="mt-2">
|
<div className="mt-2">
|
||||||
<ExecutionOutputViewer
|
<ExecutionOutputViewer
|
||||||
executionProcess={executionProcesses[activity.execution_process_id]}
|
executionProcess={
|
||||||
executor={selectedAttempt?.executor || undefined}
|
executionProcesses[
|
||||||
|
activity.execution_process_id
|
||||||
|
]
|
||||||
|
}
|
||||||
|
executor={
|
||||||
|
selectedAttempt?.executor || undefined
|
||||||
|
}
|
||||||
/>
|
/>
|
||||||
</div>
|
</div>
|
||||||
)}
|
)}
|
||||||
@@ -606,7 +636,7 @@ export function TaskDetailsPanel({
|
|||||||
</div>
|
</div>
|
||||||
|
|
||||||
{/* Footer */}
|
{/* Footer */}
|
||||||
<div className="border-t p-4">
|
{/* <div className="border-t p-4">
|
||||||
<div className="space-y-2">
|
<div className="space-y-2">
|
||||||
<Label className="text-sm font-medium">
|
<Label className="text-sm font-medium">
|
||||||
Follow-up question
|
Follow-up question
|
||||||
@@ -630,7 +660,7 @@ export function TaskDetailsPanel({
|
|||||||
Follow-up functionality coming soon
|
Follow-up functionality coming soon
|
||||||
</p>
|
</p>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div> */}
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
</>
|
</>
|
||||||
|
|||||||
@@ -104,6 +104,15 @@ export function ProjectTasks() {
|
|||||||
if (JSON.stringify(prevTasks) === JSON.stringify(newTasks)) {
|
if (JSON.stringify(prevTasks) === JSON.stringify(newTasks)) {
|
||||||
return prevTasks; // Return same reference to prevent re-render
|
return prevTasks; // Return same reference to prevent re-render
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// Update selectedTask if it exists and has been modified
|
||||||
|
if (selectedTask) {
|
||||||
|
const updatedSelectedTask = newTasks.find(task => task.id === selectedTask.id);
|
||||||
|
if (updatedSelectedTask && JSON.stringify(selectedTask) !== JSON.stringify(updatedSelectedTask)) {
|
||||||
|
setSelectedTask(updatedSelectedTask);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
return newTasks;
|
return newTasks;
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
@@ -375,6 +384,8 @@ export function ProjectTasks() {
|
|||||||
projectId={projectId!}
|
projectId={projectId!}
|
||||||
isOpen={isPanelOpen}
|
isOpen={isPanelOpen}
|
||||||
onClose={handleClosePanel}
|
onClose={handleClosePanel}
|
||||||
|
onEditTask={handleEditTask}
|
||||||
|
onDeleteTask={handleDeleteTask}
|
||||||
/>
|
/>
|
||||||
)}
|
)}
|
||||||
</div>
|
</div>
|
||||||
|
|||||||
Reference in New Issue
Block a user