AP1.4c: Gate-Checkliste statt Freitext-DoD.
Deploy Development / deploy (push) Successful in 47s
Test Suite / pytest-backend (push) Successful in 2m13s
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) Successful in 12s
Deploy Development / deploy (push) Successful in 47s
Test Suite / pytest-backend (push) Successful in 2m13s
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) Successful in 12s
Kriterien-Fortschritt in der Gate-Liste, Modal-UX fuer Checklisten und optionales Erst-Kriterium beim Anlegen. Co-authored-by: Cursor <cursoragent@cursor.com>
This commit is contained in:
1 parent
dbe6f4f684
commit
bd64340ca1
10 files changed
+509
-198
No files matched your search
@@ -0,0 +1,253 @@
|
||||
import { useState } from 'react'
|
||||
import {
|
||||
CRITERION_KIND_LABELS,
|
||||
CRITERION_STATUS_LABELS,
|
||||
} from '../constants/status.js'
|
||||
import { Modal } from './Modal.jsx'
|
||||
import { GateCriterionForm } from './GateCriterionForm.jsx'
|
||||
import {
|
||||
createRoadmapItemCriterion,
|
||||
deleteRoadmapCriterion,
|
||||
deferRoadmapCriterion,
|
||||
satisfyRoadmapCriterion,
|
||||
updateRoadmapCriterion,
|
||||
waiveRoadmapCriterion,
|
||||
} from '../api/roadmap.js'
|
||||
|
||||
function CriterionDecisionForm({ label, onSubmit, busy, onCancel }) {
|
||||
const [title, setTitle] = useState('')
|
||||
const [description, setDescription] = useState('')
|
||||
|
||||
return (
|
||||
<form
|
||||
className="inline-form-block criterion-decision-form"
|
||||
onSubmit={async (e) => {
|
||||
e.preventDefault()
|
||||
if (!title.trim()) return
|
||||
await onSubmit({
|
||||
decision_title: title.trim(),
|
||||
decision_description: description.trim(),
|
||||
})
|
||||
setTitle('')
|
||||
setDescription('')
|
||||
}}
|
||||
>
|
||||
<label>
|
||||
{label} — Begründung (Decision)
|
||||
<input
|
||||
value={title}
|
||||
onChange={(e) => setTitle(e.target.value)}
|
||||
required
|
||||
maxLength={255}
|
||||
placeholder="Kurzbegründung"
|
||||
/>
|
||||
</label>
|
||||
<label>
|
||||
Details
|
||||
<textarea
|
||||
value={description}
|
||||
onChange={(e) => setDescription(e.target.value)}
|
||||
rows={2}
|
||||
/>
|
||||
</label>
|
||||
<div className="form-actions">
|
||||
<button type="submit" className="btn btn-secondary" disabled={busy}>
|
||||
Speichern
|
||||
</button>
|
||||
{onCancel && (
|
||||
<button type="button" className="btn btn-secondary" onClick={onCancel} disabled={busy}>
|
||||
Abbrechen
|
||||
</button>
|
||||
)}
|
||||
</div>
|
||||
</form>
|
||||
)
|
||||
}
|
||||
|
||||
export function GateCriteriaSection({
|
||||
itemId,
|
||||
itemStatus = 'planned',
|
||||
criteria = [],
|
||||
progress = null,
|
||||
canManage = false,
|
||||
busy = false,
|
||||
onChanged,
|
||||
onAction,
|
||||
}) {
|
||||
const [showCreate, setShowCreate] = useState(false)
|
||||
const [editingCriterion, setEditingCriterion] = useState(null)
|
||||
const [decisionModal, setDecisionModal] = useState(null)
|
||||
|
||||
const closedCount = progress?.closed ?? criteria.filter((c) =>
|
||||
['satisfied', 'waived', 'deferred'].includes(c.status),
|
||||
).length
|
||||
const totalCount = progress?.total ?? criteria.length
|
||||
const itemReached = itemStatus === 'reached'
|
||||
|
||||
async function runAction(fn) {
|
||||
if (onAction) {
|
||||
await onAction(fn)
|
||||
return
|
||||
}
|
||||
await fn()
|
||||
await onChanged?.()
|
||||
}
|
||||
|
||||
return (
|
||||
<section className="gate-criteria-section">
|
||||
<div className="section-header">
|
||||
<div>
|
||||
<h3>Checkliste</h3>
|
||||
<p className="section-lead muted">
|
||||
{closedCount}/{totalCount} Kriterien abgeschlossen — prüfbare Akzeptanz statt Freitext-DoD.
|
||||
</p>
|
||||
</div>
|
||||
{canManage && (
|
||||
<button
|
||||
type="button"
|
||||
className="btn btn-primary btn-sm"
|
||||
onClick={() => setShowCreate(true)}
|
||||
disabled={busy}
|
||||
>
|
||||
Kriterium
|
||||
</button>
|
||||
)}
|
||||
</div>
|
||||
|
||||
{criteria.length === 0 && (
|
||||
<p className="muted gate-criteria-section__empty">
|
||||
Noch keine Kriterien — lege prüfbare Akzeptanzpunkte an.
|
||||
</p>
|
||||
)}
|
||||
|
||||
<ul className="item-list criterion-list">
|
||||
{criteria.map((crit) => (
|
||||
<li key={crit.id} className="list-item card-list-item">
|
||||
<div className="list-item-main">
|
||||
<strong>{crit.title}</strong>
|
||||
<p className="muted list-item-sub">
|
||||
{CRITERION_KIND_LABELS[crit.criterion_kind] || crit.criterion_kind}
|
||||
</p>
|
||||
{crit.description && <p className="list-item-desc">{crit.description}</p>}
|
||||
</div>
|
||||
<div className="list-item-meta action-controls">
|
||||
<span className="status-pill">
|
||||
{CRITERION_STATUS_LABELS[crit.status] || crit.status}
|
||||
</span>
|
||||
{canManage && crit.status === 'open' && (
|
||||
<>
|
||||
<button
|
||||
type="button"
|
||||
className="btn btn-primary btn-sm"
|
||||
disabled={busy}
|
||||
onClick={() => runAction(() => satisfyRoadmapCriterion(crit.id))}
|
||||
>
|
||||
Erfüllt
|
||||
</button>
|
||||
<button
|
||||
type="button"
|
||||
className="btn btn-secondary btn-sm"
|
||||
disabled={busy}
|
||||
onClick={() => setDecisionModal({ id: crit.id, action: 'waive' })}
|
||||
>
|
||||
Auslassen
|
||||
</button>
|
||||
<button
|
||||
type="button"
|
||||
className="btn btn-secondary btn-sm"
|
||||
disabled={busy}
|
||||
onClick={() => setDecisionModal({ id: crit.id, action: 'defer' })}
|
||||
>
|
||||
Verschieben
|
||||
</button>
|
||||
</>
|
||||
)}
|
||||
{canManage && (
|
||||
<button
|
||||
type="button"
|
||||
className="btn btn-secondary btn-sm"
|
||||
disabled={busy}
|
||||
onClick={() => setEditingCriterion(crit)}
|
||||
>
|
||||
Bearbeiten
|
||||
</button>
|
||||
)}
|
||||
{canManage && criteria.length > 1 && (
|
||||
<button
|
||||
type="button"
|
||||
className="btn btn-secondary btn-sm"
|
||||
disabled={busy}
|
||||
onClick={() => runAction(() => deleteRoadmapCriterion(crit.id))}
|
||||
>
|
||||
Entfernen
|
||||
</button>
|
||||
)}
|
||||
</div>
|
||||
</li>
|
||||
))}
|
||||
</ul>
|
||||
|
||||
<Modal open={showCreate} title="Kriterium anlegen" onClose={() => setShowCreate(false)}>
|
||||
<GateCriterionForm
|
||||
mode="create"
|
||||
submitLabel="Anlegen"
|
||||
busy={busy}
|
||||
onCancel={() => setShowCreate(false)}
|
||||
onSubmit={async (payload) => {
|
||||
await runAction(async () => {
|
||||
await createRoadmapItemCriterion(itemId, payload)
|
||||
setShowCreate(false)
|
||||
})
|
||||
}}
|
||||
/>
|
||||
</Modal>
|
||||
|
||||
<Modal
|
||||
open={Boolean(editingCriterion)}
|
||||
title="Kriterium bearbeiten"
|
||||
onClose={() => setEditingCriterion(null)}
|
||||
>
|
||||
{editingCriterion && (
|
||||
<GateCriterionForm
|
||||
mode="edit"
|
||||
initial={editingCriterion}
|
||||
itemReached={itemReached}
|
||||
submitLabel="Speichern"
|
||||
busy={busy}
|
||||
onCancel={() => setEditingCriterion(null)}
|
||||
onSubmit={async (payload) => {
|
||||
await runAction(async () => {
|
||||
await updateRoadmapCriterion(editingCriterion.id, payload)
|
||||
setEditingCriterion(null)
|
||||
})
|
||||
}}
|
||||
/>
|
||||
)}
|
||||
</Modal>
|
||||
|
||||
<Modal
|
||||
open={Boolean(decisionModal)}
|
||||
title={decisionModal?.action === 'defer' ? 'Kriterium verschieben' : 'Kriterium auslassen'}
|
||||
onClose={() => setDecisionModal(null)}
|
||||
>
|
||||
{decisionModal && (
|
||||
<CriterionDecisionForm
|
||||
label={decisionModal.action === 'defer' ? 'Verschieben' : 'Auslassen'}
|
||||
busy={busy}
|
||||
onCancel={() => setDecisionModal(null)}
|
||||
onSubmit={async (body) => {
|
||||
await runAction(async () => {
|
||||
const fn =
|
||||
decisionModal.action === 'defer'
|
||||
? deferRoadmapCriterion
|
||||
: waiveRoadmapCriterion
|
||||
await fn(decisionModal.id, body)
|
||||
setDecisionModal(null)
|
||||
})
|
||||
}}
|
||||
/>
|
||||
)}
|
||||
</Modal>
|
||||
</section>
|
||||
)
|
||||
}
|
||||
@@ -0,0 +1,81 @@
|
||||
import { CRITERION_KIND_LABELS, CRITERION_KINDS } from '../constants/status.js'
|
||||
|
||||
export function GateCriterionForm({
|
||||
initial = {},
|
||||
onSubmit,
|
||||
onCancel,
|
||||
busy = false,
|
||||
submitLabel = 'Speichern',
|
||||
mode = 'create',
|
||||
itemReached = false,
|
||||
}) {
|
||||
async function handleSubmit(e) {
|
||||
e.preventDefault()
|
||||
const form = e.target
|
||||
const payload = {
|
||||
title: form.title.value.trim(),
|
||||
description: form.description.value.trim(),
|
||||
criterion_kind: form.criterion_kind.value,
|
||||
}
|
||||
if (mode === 'edit' && itemReached) {
|
||||
payload.change_reason = form.change_reason.value.trim()
|
||||
}
|
||||
await onSubmit(payload)
|
||||
}
|
||||
|
||||
return (
|
||||
<form className="form workspace-form gate-criterion-form" onSubmit={handleSubmit}>
|
||||
<label>
|
||||
Titel
|
||||
<input
|
||||
name="title"
|
||||
defaultValue={initial.title || ''}
|
||||
maxLength={500}
|
||||
required
|
||||
autoFocus
|
||||
placeholder="z. B. Akzeptanzkriterium dokumentiert"
|
||||
/>
|
||||
</label>
|
||||
<label>
|
||||
Beschreibung (optional)
|
||||
<textarea
|
||||
name="description"
|
||||
rows={3}
|
||||
defaultValue={initial.description || ''}
|
||||
placeholder="Prüfhinweis oder Kontext"
|
||||
/>
|
||||
</label>
|
||||
<label>
|
||||
Art
|
||||
<select name="criterion_kind" defaultValue={initial.criterion_kind || 'manual'}>
|
||||
{CRITERION_KINDS.map((k) => (
|
||||
<option key={k} value={k}>
|
||||
{CRITERION_KIND_LABELS[k]}
|
||||
</option>
|
||||
))}
|
||||
</select>
|
||||
</label>
|
||||
{mode === 'edit' && itemReached && (
|
||||
<label>
|
||||
Begründung (Gate bereits erreicht)
|
||||
<input
|
||||
name="change_reason"
|
||||
maxLength={500}
|
||||
required
|
||||
placeholder="Warum wird das Kriterium geändert?"
|
||||
/>
|
||||
</label>
|
||||
)}
|
||||
<div className="form-actions">
|
||||
<button type="submit" className="btn btn-primary" disabled={busy}>
|
||||
{busy ? 'Speichern …' : submitLabel}
|
||||
</button>
|
||||
{onCancel && (
|
||||
<button type="button" className="btn btn-secondary" onClick={onCancel} disabled={busy}>
|
||||
Abbrechen
|
||||
</button>
|
||||
)}
|
||||
</div>
|
||||
</form>
|
||||
)
|
||||
}
|
||||
@@ -29,6 +29,12 @@ export function RoadmapItemForm({
|
||||
item_type: form.item_type.value,
|
||||
sequencing_mode: form.sequencing_mode.value,
|
||||
}
|
||||
if (mode === 'create') {
|
||||
const initialCriterion = form.initial_criterion_title?.value?.trim()
|
||||
if (initialCriterion) {
|
||||
payload.initial_criterion_title = initialCriterion
|
||||
}
|
||||
}
|
||||
if (mode === 'edit') {
|
||||
payload.status = form.status.value
|
||||
}
|
||||
@@ -63,15 +69,31 @@ export function RoadmapItemForm({
|
||||
/>
|
||||
</label>
|
||||
<label>
|
||||
Ziel / Definition of Done
|
||||
Zielkontext (optional)
|
||||
<textarea
|
||||
name="goal_description"
|
||||
rows={3}
|
||||
defaultValue={initial.goal_description || ''}
|
||||
placeholder="Woran erkennst du, dass dieses Element erreicht ist?"
|
||||
placeholder="Kurzer Kontext — prüfbare Akzeptanz legst du als Kriterien an."
|
||||
disabled={statusLocked}
|
||||
/>
|
||||
<span className="muted form-hint">
|
||||
Die Checkliste auf der Gate-Detailseite ist führend für Verify.
|
||||
</span>
|
||||
</label>
|
||||
{mode === 'create' && (
|
||||
<label>
|
||||
Erstes Kriterium (optional)
|
||||
<input
|
||||
name="initial_criterion_title"
|
||||
maxLength={500}
|
||||
placeholder="z. B. Demo mit Stakeholdern durchgeführt"
|
||||
/>
|
||||
<span className="muted form-hint">
|
||||
Ohne Angabe wird „Gate allgemein“ als Standard-Kriterium angelegt.
|
||||
</span>
|
||||
</label>
|
||||
)}
|
||||
<div className="form-row form-row--2">
|
||||
<label>
|
||||
Abfolge
|
||||
|
||||
@@ -1,6 +1,7 @@
|
||||
import { useMemo, useState } from 'react'
|
||||
import { useEffect, useMemo, useState } from 'react'
|
||||
import { Link } from 'react-router-dom'
|
||||
import { gatePath } from '../utils/routes.js'
|
||||
import { listInitiativeRoadmapCriteriaProgress } from '../api/roadmap.js'
|
||||
import {
|
||||
ROADMAP_ITEM_TYPE_LABELS,
|
||||
SEQUENCING_MODE_LABELS,
|
||||
@@ -36,9 +37,28 @@ export function RoadmapPlanSection({
|
||||
const [showCreate, setShowCreate] = useState(false)
|
||||
const [dragItemId, setDragItemId] = useState('')
|
||||
const [dropTargetId, setDropTargetId] = useState('')
|
||||
const [criteriaProgress, setCriteriaProgress] = useState({})
|
||||
const isDesktop = useMinWidth(1024)
|
||||
const canReorder = canManage && typeof onReorder === 'function'
|
||||
|
||||
useEffect(() => {
|
||||
if (!initiativeId) {
|
||||
setCriteriaProgress({})
|
||||
return undefined
|
||||
}
|
||||
let cancelled = false
|
||||
listInitiativeRoadmapCriteriaProgress(initiativeId)
|
||||
.then((data) => {
|
||||
if (!cancelled) setCriteriaProgress(data || {})
|
||||
})
|
||||
.catch(() => {
|
||||
if (!cancelled) setCriteriaProgress({})
|
||||
})
|
||||
return () => {
|
||||
cancelled = true
|
||||
}
|
||||
}, [initiativeId, items])
|
||||
|
||||
const sortedItems = useMemo(() => sortByOrder(items), [items])
|
||||
|
||||
async function handleCreateSubmit(payload) {
|
||||
@@ -115,6 +135,11 @@ export function RoadmapPlanSection({
|
||||
{sortedItems.map((item, index) => {
|
||||
const isDragging = dragItemId === item.id
|
||||
const isDropTarget = dropTargetId === item.id && dragItemId && dragItemId !== item.id
|
||||
const progress = criteriaProgress[item.id]
|
||||
const progressLabel =
|
||||
progress && progress.total > 0
|
||||
? `${progress.closed}/${progress.total} Kriterien`
|
||||
: null
|
||||
|
||||
return (
|
||||
<li
|
||||
@@ -159,6 +184,9 @@ export function RoadmapPlanSection({
|
||||
Zieltermin: {formatDate(item.target_date)}
|
||||
</p>
|
||||
)}
|
||||
{progressLabel && (
|
||||
<p className="muted list-item-sub">Checkliste: {progressLabel}</p>
|
||||
)}
|
||||
</div>
|
||||
<div className="list-item-meta action-controls">
|
||||
<StatusBadge kind="milestone" status={item.status} />
|
||||
|
||||
Reference in new issue
Block a user