AP2.2d: Sprint-Planung, Abschluss und Product-Fallback.
Deploy Development / deploy (push) Successful in 48s
Test Suite / pytest-backend (push) Successful in 2m56s
Test Suite / lint-backend (push) Successful in 2s
Test Suite / compose-smoke (push) Has been skipped
Test Suite / k6 /api/health Baseline (push) Successful in 18s
Test Suite / playwright-smoke (push) Has been cancelled

Backlog committet in gewaehlten Sprint, Sprint complete-Endpoint, continuous_product-Ansicht ohne aktiven Sprint.

Co-authored-by: Cursor <cursoragent@cursor.com>
This commit is contained in:
LarsandCursor committed 2026-07-12 19:21:49 +02:00
1 parent 09826d146e
commit f6aba94864
11 files changed
+422 -17

No files matched your search

+128 -5
View File
@@ -1,4 +1,4 @@
import { useMemo, useState } from 'react'
import { useEffect, useMemo, useState } from 'react'
import { StatusBadge } from './StatusBadge.jsx'
import { PriorityBadge } from './PriorityBadge.jsx'
import { EmptyState } from './EmptyState.jsx'
@@ -9,25 +9,58 @@ import { gateTitleById } from './GateSelect.jsx'
import { computeDropPatches, computeMovePatches, sortByOrder } from '../utils/reorder.js'
import { useMinWidth } from '../hooks/useMinWidth.js'
const PLANNING_STATUSES = new Set(['planned', 'active', 'at_risk'])
export function BacklogSection({
items,
roadmapItems = [],
workCycles = [],
activeWorkCycle = null,
sprintPlanningEnabled = false,
canManage,
onCreate,
onUpdate,
onReorder,
onConvert,
onBulkConvert,
onDelete,
busy,
sectionTitle = 'Product Backlog',
sectionLead = 'Eingang vor dem Commit — triagieren, dann in Arbeitspaket (Sprint) umwandeln.',
sectionLead = 'Eingang vor dem Commit — triagieren, dann in den Sprint planen.',
}) {
const [modalMode, setModalMode] = useState(null)
const [dragItemId, setDragItemId] = useState('')
const [dropTargetId, setDropTargetId] = useState('')
const [selectedIds, setSelectedIds] = useState(() => new Set())
const [sprintTargetId, setSprintTargetId] = useState('')
const isDesktop = useMinWidth(1024)
const canReorder = canManage && typeof onReorder === 'function'
const planableSprints = useMemo(
() => workCycles.filter((cycle) => PLANNING_STATUSES.has(cycle.status)),
[workCycles],
)
const showSprintPlanning = sprintPlanningEnabled && planableSprints.length > 0
useEffect(() => {
if (!showSprintPlanning) {
setSprintTargetId('')
return
}
if (sprintTargetId && planableSprints.some((cycle) => cycle.id === sprintTargetId)) {
return
}
const preferred = activeWorkCycle?.id || planableSprints[0]?.id || ''
setSprintTargetId(preferred)
}, [showSprintPlanning, sprintTargetId, planableSprints, activeWorkCycle?.id])
const selectedSprint = planableSprints.find((cycle) => cycle.id === sprintTargetId) || null
const convertLabel = selectedSprint
? `In Sprint „${selectedSprint.title}" planen`
: 'In Arbeitspaket umwandeln'
const sortedItems = useMemo(
() => sortByOrder(items.filter((item) => item.status !== 'converted')),
[items],
@@ -104,6 +137,46 @@ export function BacklogSection({
const modalTitle =
modalMode?.kind === 'create' ? 'Backlog-Item anlegen' : 'Backlog-Item bearbeiten'
const acceptedItems = sortedItems.filter((item) => item.status === 'accepted')
const selectedAccepted = acceptedItems.filter((item) => selectedIds.has(item.id))
function toggleSelected(itemId) {
setSelectedIds((prev) => {
const next = new Set(prev)
if (next.has(itemId)) next.delete(itemId)
else next.add(itemId)
return next
})
}
function convertOptions() {
return sprintTargetId ? { work_cycle_id: sprintTargetId } : {}
}
async function handleSingleConvert(itemId) {
await onConvert(itemId, convertOptions())
setSelectedIds((prev) => {
const next = new Set(prev)
next.delete(itemId)
return next
})
}
async function handleBulkPlan() {
if (!selectedAccepted.length) return
if (typeof onBulkConvert === 'function') {
await onBulkConvert(
selectedAccepted.map((item) => item.id),
convertOptions(),
)
} else {
for (const item of selectedAccepted) {
await onConvert(item.id, convertOptions())
}
}
setSelectedIds(new Set())
}
return (
<section className="card backlog-section">
<div className="section-header">
@@ -122,6 +195,45 @@ export function BacklogSection({
)}
</div>
{showSprintPlanning && canManage && acceptedItems.length > 0 && (
<div className="backlog-sprint-planning card-list-item">
<label className="backlog-sprint-planning__field">
<span className="muted">Sprint-Ziel</span>
<select
value={sprintTargetId}
onChange={(e) => setSprintTargetId(e.target.value)}
disabled={busy}
>
{planableSprints.map((cycle) => (
<option key={cycle.id} value={cycle.id}>
{cycle.title}
{cycle.status === 'active' ? ' (aktiv)' : ''}
</option>
))}
</select>
</label>
{selectedAccepted.length > 0 && (
<button
type="button"
className="btn btn-primary btn-sm"
disabled={busy || !sprintTargetId}
onClick={handleBulkPlan}
>
{selectedAccepted.length} Item{selectedAccepted.length === 1 ? '' : 's'} {convertLabel}
</button>
)}
<p className="muted backlog-sprint-planning__hint">
Items markieren und in den gewählten Sprint committen — Planung unter Plan → Sprint.
</p>
</div>
)}
{sprintPlanningEnabled && canManage && acceptedItems.length > 0 && planableSprints.length === 0 && (
<p className="muted backlog-sprint-planning__hint">
Lege zuerst einen Sprint unter Plan → Sprint an, um Backlog-Items zu planen.
</p>
)}
{items.length === 0 && <EmptyState message="Backlog ist leer." />}
<ul className="item-list backlog-reorder-list">
@@ -150,6 +262,17 @@ export function BacklogSection({
⋮⋮
</span>
)}
{showSprintPlanning && canManage && item.status === 'accepted' && (
<label className="backlog-select-checkbox">
<input
type="checkbox"
checked={selectedIds.has(item.id)}
onChange={() => toggleSelected(item.id)}
disabled={busy}
aria-label={`${item.title} für Sprint-Planung markieren`}
/>
</label>
)}
<button
type="button"
className="list-item-main list-item-main--clickable"
@@ -185,10 +308,10 @@ export function BacklogSection({
<button
type="button"
className="btn btn-primary btn-sm"
onClick={() => onConvert(item.id)}
disabled={busy}
onClick={() => handleSingleConvert(item.id)}
disabled={busy || (showSprintPlanning && !sprintTargetId)}
>
In Arbeitspaket umwandeln
{convertLabel}
</button>
)}
<button
+12 -1
View File
@@ -8,6 +8,7 @@ export function WorkCyclesPanel({
canManage,
onCreate,
onActivate,
onComplete,
busy = false,
}) {
const [title, setTitle] = useState('')
@@ -100,7 +101,17 @@ export function WorkCyclesPanel({
<p className="muted item-meta">{cycle.goal_description}</p>
)}
</div>
{canManage && cycle.status !== 'active' && (
{canManage && cycle.status === 'active' && typeof onComplete === 'function' && (
<button
type="button"
className="btn btn-secondary btn-sm"
disabled={busy}
onClick={() => onComplete(cycle.id)}
>
Abschließen
</button>
)}
{canManage && cycle.status !== 'active' && cycle.status !== 'reached' && (
<button
type="button"
className="btn btn-secondary btn-sm"