feat(ext): rerun tasks from history

This commit is contained in:
adonis
2026-03-19 23:54:08 +08:00
parent ba242d3a1b
commit 0bc47a997d
3 changed files with 87 additions and 20 deletions

View File

@@ -1,4 +1,4 @@
import { ArrowLeft } from 'lucide-react'
import { ArrowLeft, RotateCcw } from 'lucide-react'
import { useEffect, useState } from 'react'
import { Button } from '@/components/ui/button'
@@ -6,7 +6,17 @@ import { type SessionRecord, getSession } from '@/lib/db'
import { EventCard } from './cards'
export function HistoryDetail({ sessionId, onBack }: { sessionId: string; onBack: () => void }) {
export function HistoryDetail({
sessionId,
onBack,
onRerun,
rerunDisabled = false,
}: {
sessionId: string
onBack: () => void
onRerun: (task: string) => void
rerunDisabled?: boolean
}) {
const [session, setSession] = useState<SessionRecord | null>(null)
useEffect(() => {
@@ -37,6 +47,19 @@ export function HistoryDetail({ sessionId, onBack }: { sessionId: string; onBack
<div className="text-xs font-medium" title={session.task}>
{session.task}
</div>
<div className="mt-2">
<Button
type="button"
variant="secondary"
size="sm"
onClick={() => onRerun(session.task)}
disabled={rerunDisabled}
className="h-7 cursor-pointer text-[10px]"
>
<RotateCcw className="size-3" />
Run again
</Button>
</div>
</div>
{/* Events (read-only) */}