@@ -23,6 +23,7 @@ import {
2323 FileText ,
2424 AlertTriangle ,
2525 PlayCircle ,
26+ Pencil ,
2627} from "lucide-react" ;
2728import {
2829 getAutomationById ,
@@ -43,6 +44,8 @@ import { DiscoveredJobDetail } from "@/components/automations/DiscoveredJobDetai
4344import { RunHistoryList } from "@/components/automations/RunHistoryList" ;
4445import { LogsTab } from "@/components/automations/LogsTab" ;
4546import Loading from "@/components/Loading" ;
47+ import { AutomationWizard } from "@/components/automations/AutomationWizard" ;
48+ import { getResumeList } from "@/actions/profile.actions" ;
4649import { parseKeywords , parseLocations } from "@/utils/automation.utils" ;
4750import { LocationBadge } from "@/components/ui/location-badge" ;
4851
@@ -60,6 +63,8 @@ export default function AutomationDetailPage() {
6063 const [ loading , setLoading ] = useState ( true ) ;
6164 const [ actionLoading , setActionLoading ] = useState ( false ) ;
6265 const [ runNowLoading , setRunNowLoading ] = useState ( false ) ;
66+ const [ editOpen , setEditOpen ] = useState ( false ) ;
67+ const [ resumes , setResumes ] = useState < { id : string ; title : string } [ ] > ( [ ] ) ;
6368 const [ selectedJob , setSelectedJob ] = useState < DiscoveredJob | null > ( null ) ;
6469 const [ selectedJobMatchData , setSelectedJobMatchData ] =
6570 useState < JobMatchResponse | null > ( null ) ;
@@ -69,10 +74,11 @@ export default function AutomationDetailPage() {
6974 const loadData = useCallback ( async ( ) => {
7075 setLoading ( true ) ;
7176 try {
72- const [ automationResult , runsResult , jobsResult ] = await Promise . all ( [
77+ const [ automationResult , runsResult , jobsResult , resumeResult ] = await Promise . all ( [
7378 getAutomationById ( automationId ) ,
7479 getAutomationRuns ( automationId ) ,
7580 getDiscoveredJobs ( automationId ) ,
81+ getResumeList ( 1 , 100 ) ,
7682 ] ) ;
7783
7884 if ( automationResult . success && automationResult . data ) {
@@ -95,6 +101,10 @@ export default function AutomationDetailPage() {
95101 if ( jobsResult . success && jobsResult . data ) {
96102 setJobs ( jobsResult . data as any ) ;
97103 }
104+
105+ if ( resumeResult . success && resumeResult . data ) {
106+ setResumes ( resumeResult . data . map ( ( r : any ) => ( { id : r . id , title : r . title } ) ) ) ;
107+ }
98108 } catch ( error ) {
99109 toast ( {
100110 title : "Error" ,
@@ -237,6 +247,13 @@ export default function AutomationDetailPage() {
237247 < Button variant = "outline" size = "icon" onClick = { loadData } >
238248 < RefreshCw className = "h-4 w-4" />
239249 </ Button >
250+ < Button
251+ variant = "outline"
252+ onClick = { ( ) => setEditOpen ( true ) }
253+ >
254+ < Pencil className = "h-4 w-4 mr-2" />
255+ Edit
256+ </ Button >
240257 < Button
241258 variant = "outline"
242259 onClick = { handlePauseResume }
@@ -377,6 +394,22 @@ export default function AutomationDetailPage() {
377394 onOpenChange = { setDetailOpen }
378395 onRefresh = { loadData }
379396 />
397+
398+ { automation && (
399+ < AutomationWizard
400+ open = { editOpen }
401+ onOpenChange = { ( open ) => {
402+ setEditOpen ( open ) ;
403+ if ( ! open ) loadData ( ) ;
404+ } }
405+ onSuccess = { ( ) => {
406+ setEditOpen ( false ) ;
407+ loadData ( ) ;
408+ } }
409+ editAutomation = { automation }
410+ resumes = { resumes }
411+ />
412+ ) }
380413 </ div >
381414 ) ;
382415}
0 commit comments