PBI-47: schema, pause_context Zod, resumePausedSprintRunAction, PAUSED-banner UI (#137)
Scrum4Me-side counterpart of scrum4me-mcp@f7f5a48 (PBI-9 + PBI-47):
- prisma migration: ClaudeJob.{base_sha,head_sha} + SprintRun.pause_context
- lib/pause-context.ts: Zod schema + parsePauseContext + pauseReasonLabel
helper; single source of truth for the JSON pause_context shape produced
by the mcp sprint-run flow (MERGE_CONFLICT pause)
- actions/sprint-runs.ts: resumePausedSprintRunAction — separate from the
existing FAILED-resume flow, requires SprintRun.status === PAUSED, closes
the linked ClaudeQuestion, clears pause_context, sets RUNNING/QUEUED based
on whether a claim is still active
- components/sprint/sprint-run-controls.tsx: PAUSED banner with reason label,
PR link, conflict-files list (max 5 + "+N more"), Resume button with
confirm() guard
- app/(app)/products/[id]/sprint/page.tsx: load pause_context from active
SprintRun and pass through to SprintRunControls
All MD3 tokens (warning-container, on-warning-container, primary). No raw
Tailwind utility colours.
Tests: 532 passing across 72 files (Scrum4Me side).
Co-authored-by: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
This commit is contained in:
parent
77617e89ac
commit
d3e79021c1
6 changed files with 173 additions and 2 deletions
|
|
@ -5,6 +5,7 @@ import { toast } from 'sonner'
|
|||
import {
|
||||
startSprintRunAction,
|
||||
resumeSprintAction,
|
||||
resumePausedSprintRunAction,
|
||||
cancelSprintRunAction,
|
||||
type PreFlightBlocker,
|
||||
} from '@/actions/sprint-runs'
|
||||
|
|
@ -17,6 +18,7 @@ import {
|
|||
DialogHeader,
|
||||
DialogTitle,
|
||||
} from '@/components/ui/dialog'
|
||||
import { type PauseContext, pauseReasonLabel } from '@/lib/pause-context'
|
||||
|
||||
type SprintStatusValue = 'ACTIVE' | 'COMPLETED' | 'FAILED'
|
||||
type SprintRunStatusValue =
|
||||
|
|
@ -34,6 +36,7 @@ interface Props {
|
|||
sprintStatus: SprintStatusValue
|
||||
activeSprintRunId: string | null
|
||||
activeSprintRunStatus: SprintRunStatusValue
|
||||
pauseContext: PauseContext | null
|
||||
isDemo: boolean
|
||||
}
|
||||
|
||||
|
|
@ -60,6 +63,7 @@ export function SprintRunControls({
|
|||
sprintStatus,
|
||||
activeSprintRunId,
|
||||
activeSprintRunStatus,
|
||||
pauseContext,
|
||||
isDemo,
|
||||
}: Props) {
|
||||
const [pending, startTransition] = useTransition()
|
||||
|
|
@ -73,6 +77,8 @@ export function SprintRunControls({
|
|||
|
||||
const canStart = sprintStatus === 'ACTIVE' && !hasActiveRun
|
||||
const canResume = sprintStatus === 'FAILED'
|
||||
const canResumePaused =
|
||||
activeSprintRunStatus === 'PAUSED' && pauseContext !== null
|
||||
const canCancel = hasActiveRun
|
||||
|
||||
function handleStart() {
|
||||
|
|
@ -101,6 +107,25 @@ export function SprintRunControls({
|
|||
})
|
||||
}
|
||||
|
||||
function handleResumePaused() {
|
||||
if (!activeSprintRunId || !pauseContext) return
|
||||
if (
|
||||
!confirm(
|
||||
`Sprint hervatten? Bevestig dat het ${pauseReasonLabel(
|
||||
pauseContext.pause_reason,
|
||||
).toLowerCase()} is opgelost.`,
|
||||
)
|
||||
)
|
||||
return
|
||||
startTransition(async () => {
|
||||
const result = await resumePausedSprintRunAction({
|
||||
sprint_run_id: activeSprintRunId,
|
||||
})
|
||||
if (result.ok) toast.success('Sprint hervat')
|
||||
else toast.error(result.error)
|
||||
})
|
||||
}
|
||||
|
||||
function handleCancel() {
|
||||
if (!activeSprintRunId) return
|
||||
if (!confirm('Sprint annuleren? Openstaande taken blijven TO_DO.')) return
|
||||
|
|
@ -113,6 +138,39 @@ export function SprintRunControls({
|
|||
|
||||
return (
|
||||
<>
|
||||
{canResumePaused && pauseContext && (
|
||||
<div className="rounded-md border border-warning/40 bg-warning-container/20 p-3 mb-2">
|
||||
<div className="text-xs uppercase tracking-wide text-on-warning-container">
|
||||
Gepauzeerd: {pauseReasonLabel(pauseContext.pause_reason)}
|
||||
</div>
|
||||
<a
|
||||
href={pauseContext.pr_url}
|
||||
target="_blank"
|
||||
rel="noreferrer"
|
||||
className="text-sm text-primary hover:underline break-all"
|
||||
>
|
||||
{pauseContext.pr_url}
|
||||
</a>
|
||||
{pauseContext.conflict_files.length > 0 && (
|
||||
<ul className="mt-1 text-xs text-muted-foreground">
|
||||
{pauseContext.conflict_files.slice(0, 5).map((f) => (
|
||||
<li key={f}>· {f}</li>
|
||||
))}
|
||||
{pauseContext.conflict_files.length > 5 && (
|
||||
<li>· + {pauseContext.conflict_files.length - 5} meer</li>
|
||||
)}
|
||||
</ul>
|
||||
)}
|
||||
<Button
|
||||
size="sm"
|
||||
onClick={handleResumePaused}
|
||||
disabled={pending || isDemo}
|
||||
className="text-xs mt-2"
|
||||
>
|
||||
Hervat gepauzeerde sprint
|
||||
</Button>
|
||||
</div>
|
||||
)}
|
||||
<div className="flex items-center gap-2">
|
||||
{canStart && (
|
||||
<Button
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue