feat(solo): preview-then-confirm flow in SoloBoard Voer-alle-uit
Vervang directe enqueueAllTodoJobsAction door previewEnqueueAllAction + BatchEnqueueBlockerDialog. Geen blocker → enqueueClaudeJobsBatchAction direct. Wel blocker → dialog met prefix-enqueue of annuleer. Loading-state op knop tijdens preview en confirm. 5 integratie-tests.
This commit is contained in:
parent
80a7d793b6
commit
94b99198ed
2 changed files with 265 additions and 4 deletions
|
|
@ -8,7 +8,8 @@ import {
|
|||
import { toast } from 'sonner'
|
||||
import { useSoloStore } from '@/stores/solo-store'
|
||||
import { taskStatusToApi } from '@/lib/task-status'
|
||||
import { enqueueAllTodoJobsAction } from '@/actions/claude-jobs'
|
||||
import { previewEnqueueAllAction, enqueueClaudeJobsBatchAction } from '@/actions/claude-jobs'
|
||||
import { BatchEnqueueBlockerDialog } from './batch-enqueue-blocker-dialog'
|
||||
import { Button } from '@/components/ui/button'
|
||||
import { DemoTooltip } from '@/components/shared/demo-tooltip'
|
||||
import { SplitPane } from '@/components/split-pane/split-pane'
|
||||
|
|
@ -61,6 +62,15 @@ export function SoloBoard({
|
|||
const [unassignedStories, setUnassignedStories] = useState(initialUnassigned)
|
||||
const [, startTransition] = useTransition()
|
||||
const [batchPending, startBatchTransition] = useTransition()
|
||||
const [confirmPending, startConfirmTransition] = useTransition()
|
||||
|
||||
type BlockerDialogState = {
|
||||
prefixCount: number
|
||||
blockerReason: 'task-review' | 'pbi-blocked'
|
||||
blockerLabel: string
|
||||
prefixIds: string[]
|
||||
}
|
||||
const [blockerDialog, setBlockerDialog] = useState<BlockerDialogState | null>(null)
|
||||
|
||||
const taskKey = initialTasks.map(t => t.id).join(',')
|
||||
useEffect(() => {
|
||||
|
|
@ -140,7 +150,42 @@ export function SoloBoard({
|
|||
function handleStartAll() {
|
||||
if (queueableCount === 0) return
|
||||
startBatchTransition(async () => {
|
||||
const result = await enqueueAllTodoJobsAction(productId)
|
||||
const preview = await previewEnqueueAllAction(productId)
|
||||
if ('error' in preview) {
|
||||
toast.error(preview.error)
|
||||
return
|
||||
}
|
||||
if (preview.blockerIndex === null) {
|
||||
const todoIds = preview.tasks.filter(t => t.status === 'TO_DO').map(t => t.id)
|
||||
const result = await enqueueClaudeJobsBatchAction(productId, todoIds)
|
||||
if ('error' in result) {
|
||||
toast.error(result.error)
|
||||
} else if (result.count === 0) {
|
||||
toast.info('Geen taken om te starten')
|
||||
} else {
|
||||
toast.success(`${result.count} ${result.count === 1 ? 'agent' : 'agents'} ingeschakeld`)
|
||||
}
|
||||
} else {
|
||||
const blockerTask = preview.tasks[preview.blockerIndex]
|
||||
const blockerLabel = preview.blockerReason === 'task-review'
|
||||
? `${blockerTask.story_title} — ${blockerTask.title}`
|
||||
: blockerTask.story_title
|
||||
setBlockerDialog({
|
||||
prefixCount: preview.blockerIndex,
|
||||
blockerReason: preview.blockerReason!,
|
||||
blockerLabel,
|
||||
prefixIds: preview.tasks.slice(0, preview.blockerIndex).map(t => t.id),
|
||||
})
|
||||
}
|
||||
})
|
||||
}
|
||||
|
||||
function handleBlockerConfirm() {
|
||||
if (!blockerDialog) return
|
||||
const { prefixIds } = blockerDialog
|
||||
setBlockerDialog(null)
|
||||
startConfirmTransition(async () => {
|
||||
const result = await enqueueClaudeJobsBatchAction(productId, prefixIds)
|
||||
if ('error' in result) {
|
||||
toast.error(result.error)
|
||||
} else if (result.count === 0) {
|
||||
|
|
@ -159,9 +204,9 @@ export function SoloBoard({
|
|||
<Button
|
||||
size="sm"
|
||||
onClick={handleStartAll}
|
||||
disabled={isDemo || batchPending || queueableCount === 0}
|
||||
disabled={isDemo || batchPending || confirmPending || queueableCount === 0}
|
||||
>
|
||||
{batchPending ? 'Starten…' : `Start agents (${queueableCount})`}
|
||||
{batchPending || confirmPending ? 'Starten…' : `Start agents (${queueableCount})`}
|
||||
</Button>
|
||||
</DemoTooltip>
|
||||
{sprintGoal && (
|
||||
|
|
@ -234,6 +279,18 @@ export function SoloBoard({
|
|||
onOpenChange={setSheetOpen}
|
||||
onClaim={(id) => setUnassignedStories(prev => prev.filter(s => s.id !== id))}
|
||||
/>
|
||||
|
||||
{blockerDialog && (
|
||||
<BatchEnqueueBlockerDialog
|
||||
open
|
||||
onOpenChange={(v) => { if (!v) setBlockerDialog(null) }}
|
||||
prefixCount={blockerDialog.prefixCount}
|
||||
blockerReason={blockerDialog.blockerReason}
|
||||
blockerLabel={blockerDialog.blockerLabel}
|
||||
onConfirm={handleBlockerConfirm}
|
||||
onCancel={() => setBlockerDialog(null)}
|
||||
/>
|
||||
)}
|
||||
</div>
|
||||
)
|
||||
}
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue