Skip to content

Commit d9859ac

Browse files
committed
feat(agents): enable editing existing agents
Add Edit action to card menu; reuse CreateAgent in edit mode; refresh list after save.
1 parent 316cd89 commit d9859ac

File tree

1 file changed

+20
-1
lines changed

1 file changed

+20
-1
lines changed

src/components/Agents.tsx

Lines changed: 20 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
import React, { useState, useEffect } from 'react';
22
import { motion, AnimatePresence } from 'framer-motion';
3-
import { Bot, Loader2, Play, Clock, CheckCircle, XCircle, Trash2, Import, ChevronDown, ChevronRight, FileJson, Globe, Download, Plus, History } from 'lucide-react';
3+
import { Bot, Loader2, Play, Clock, CheckCircle, XCircle, Trash2, Import, ChevronDown, ChevronRight, FileJson, Globe, Download, Plus, History, Edit } from 'lucide-react';
44
import {
55
DropdownMenu,
66
DropdownMenuContent,
@@ -22,6 +22,7 @@ import { useTabState } from '@/hooks/useTabState';
2222
export const Agents: React.FC = () => {
2323
const [activeTab, setActiveTab] = useState('agents');
2424
const [showCreateAgent, setShowCreateAgent] = useState(false);
25+
const [editingAgent, setEditingAgent] = useState<Agent | null>(null);
2526
const [agents, setAgents] = useState<Agent[]>([]);
2627
const [runningAgents, setRunningAgents] = useState<AgentRunWithMetrics[]>([]);
2728
const [loading, setLoading] = useState(true);
@@ -184,6 +185,20 @@ export const Agents: React.FC = () => {
184185
);
185186
}
186187

188+
// Show CreateAgent component in edit mode
189+
if (editingAgent) {
190+
return (
191+
<CreateAgent
192+
agent={editingAgent}
193+
onBack={() => setEditingAgent(null)}
194+
onAgentCreated={() => {
195+
setEditingAgent(null);
196+
loadAgents(); // Reload agents after update
197+
}}
198+
/>
199+
);
200+
}
201+
187202
return (
188203
<div className="h-full overflow-y-auto">
189204
<div className="max-w-6xl mx-auto flex flex-col h-full">
@@ -344,6 +359,10 @@ export const Agents: React.FC = () => {
344359
</Button>
345360
</DropdownMenuTrigger>
346361
<DropdownMenuContent align="end">
362+
<DropdownMenuItem onClick={() => setEditingAgent(agent)}>
363+
<Edit className="w-4 h-4 mr-2" />
364+
Edit
365+
</DropdownMenuItem>
347366
<DropdownMenuItem onClick={() => handleRunAgent(agent)}>
348367
<Play className="w-4 h-4 mr-2" />
349368
Run

0 commit comments

Comments
 (0)