AP1.5: Project, Task und Ausführung als Ist-Kern
Deploy Development / deploy (push) Successful in 44s
Test Suite / pytest-backend (push) Successful in 1m39s
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

Schema 013; Projekte/Arbeitspakete/Aufgaben pflegbar; Tab Zielzustände vs Ausführung.

Co-authored-by: Cursor <cursoragent@cursor.com>
This commit is contained in:
LarsandCursor committed 2026-07-06 08:19:05 +02:00
1 parent 2e7651812a
commit 6eeddfdc76
27 files changed
+1459 -50

No files matched your search

+23
View File
@@ -0,0 +1,23 @@
import { apiFetch } from './client.js'
export function listInitiativeProjects(initiativeId) {
return apiFetch(`/api/initiatives/${initiativeId}/projects`)
}
export function createInitiativeProject(initiativeId, body) {
return apiFetch(`/api/initiatives/${initiativeId}/projects`, {
method: 'POST',
body: JSON.stringify(body),
})
}
export function updateProject(projectId, body) {
return apiFetch(`/api/projects/${projectId}`, {
method: 'PATCH',
body: JSON.stringify(body),
})
}
export function deleteProject(projectId) {
return apiFetch(`/api/projects/${projectId}`, { method: 'DELETE' })
}
+23
View File
@@ -0,0 +1,23 @@
import { apiFetch } from './client.js'
export function listActionTasks(actionId) {
return apiFetch(`/api/actions/${actionId}/tasks`)
}
export function createActionTask(actionId, body) {
return apiFetch(`/api/actions/${actionId}/tasks`, {
method: 'POST',
body: JSON.stringify(body),
})
}
export function updateTask(taskId, body) {
return apiFetch(`/api/tasks/${taskId}`, {
method: 'PATCH',
body: JSON.stringify(body),
})
}
export function deleteTask(taskId) {
return apiFetch(`/api/tasks/${taskId}`, { method: 'DELETE' })
}
+15
View File
@@ -11,6 +11,7 @@ function isoToLocalInput(iso) {
export function ActionForm({
initial = {},
projects = [],
actors = [],
actorsLoading = false,
actorsError = null,
@@ -31,6 +32,7 @@ export function ActionForm({
status: form.status.value,
priority: form.priority.value,
due_at: form.due_at.value ? new Date(form.due_at.value).toISOString() : null,
project_id: form.project_id?.value || undefined,
assigned_actor_ids: selected,
})
}
@@ -75,6 +77,19 @@ export function ActionForm({
defaultValue={isoToLocalInput(initial.due_at)}
/>
</label>
{projects.length > 0 && (
<label>
Projekt (optional)
<select name="project_id" defaultValue={initial.project_id || ''}>
<option value="">— keins —</option>
{projects.map((p) => (
<option key={p.id} value={p.id}>
{p.title}
</option>
))}
</select>
</label>
)}
<ActorSelect
actors={actors}
defaultSelected={defaultActors}
@@ -5,6 +5,7 @@ import { EmptyState } from './EmptyState.jsx'
export function InitiativeActionsHub({
initiativeId,
actions,
projects = [],
actionContextById,
hideDone,
onHideDoneChange,
@@ -30,9 +31,10 @@ export function InitiativeActionsHub({
<section className="card initiative-actions-hub">
<div className="section-header">
<div>
<h2>Maßnahmen — operative Arbeit</h2>
<h2>Arbeitspakete</h2>
<p className="section-lead muted">
Blocker, Nachweise und Reviews hängen an der Maßnahme, nicht lose im Vorhaben.
Committete operative Einheit — Aufgaben im Detail. Blocker, Nachweise und Reviews
hängen am Arbeitspaket.
</p>
</div>
<div className="section-actions">
@@ -50,7 +52,7 @@ export function InitiativeActionsHub({
className="btn btn-primary btn-block-mobile"
onClick={onToggleForm}
>
{showForm ? 'Abbrechen' : 'Maßnahme anlegen'}
{showForm ? 'Abbrechen' : 'Arbeitspaket'}
</button>
)}
</div>
@@ -59,6 +61,7 @@ export function InitiativeActionsHub({
{showForm && canManage && (
<div className="inline-form-block">
<ActionForm
projects={projects}
actors={actors}
actorsLoading={actorsLoading}
actorsError={actorsError}
@@ -67,13 +70,13 @@ export function InitiativeActionsHub({
onSubmit={onCreateAction}
onCancel={onToggleForm}
busy={formBusy}
submitLabel="Maßnahme anlegen"
submitLabel="Arbeitspaket anlegen"
/>
</div>
)}
{actions.length === 0 && (
<EmptyState message="Noch keine Maßnahmen — lege die erste operative Maßnahme an oder wandle Backlog um." />
<EmptyState message="Noch keine Arbeitspakete — lege operative Schritte an oder wandle Backlog um." />
)}
<div className="action-hub-grid">
+1 -1
View File
@@ -2,7 +2,7 @@ import { NavLink, useParams } from 'react-router-dom'
const TABS = [
{ to: '', label: 'Steuerung', end: true },
{ to: 'plan', label: 'Plan' },
{ to: 'plan', label: 'Zielzustände' },
{ to: 'execution', label: 'Ausführung' },
{ to: 'inbox', label: 'Eingang' },
{ to: 'journey', label: 'Nachvollziehbarkeit' },
+124
View File
@@ -0,0 +1,124 @@
import { useState } from 'react'
import { EmptyState } from './EmptyState.jsx'
import { StatusBadge } from './StatusBadge.jsx'
export function ProjectsSection({
projects,
selectedProjectId,
onSelectProject,
canManage,
onCreate,
onDelete,
busy,
}) {
const [title, setTitle] = useState('')
const [description, setDescription] = useState('')
const [showForm, setShowForm] = useState(false)
async function handleSubmit(e) {
e.preventDefault()
if (!title.trim()) return
await onCreate({
title: title.trim(),
description: description.trim(),
})
setTitle('')
setDescription('')
setShowForm(false)
}
return (
<section className="card projects-section">
<div className="section-header">
<div>
<h2>Projekte</h2>
<p className="section-lead muted">
Operative Struktur — Arbeitspakete gruppieren. Zielzustände (Gates) sind optional.
</p>
</div>
{canManage && (
<button
type="button"
className="btn btn-primary btn-block-mobile"
onClick={() => setShowForm((v) => !v)}
>
{showForm ? 'Abbrechen' : 'Projekt'}
</button>
)}
</div>
{showForm && canManage && (
<form className="inline-form-block" onSubmit={handleSubmit}>
<label>
Titel
<input
value={title}
onChange={(e) => setTitle(e.target.value)}
maxLength={255}
required
placeholder="z. B. Phase 1 — Grundlagen"
/>
</label>
<label>
Beschreibung
<textarea
value={description}
onChange={(e) => setDescription(e.target.value)}
rows={2}
/>
</label>
<button type="submit" className="btn btn-primary" disabled={busy}>
Anlegen
</button>
</form>
)}
{projects.length === 0 && (
<EmptyState message="Noch keine Projekte — optional. Du kannst auch direkt Arbeitspakete anlegen." />
)}
<ul className="item-list project-filter-list">
<li className="list-item card-list-item">
<button
type="button"
className={`btn btn-secondary${selectedProjectId === '' ? ' btn-primary' : ''}`}
onClick={() => onSelectProject('')}
>
Alle Arbeitspakete
</button>
</li>
{projects.map((project) => (
<li key={project.id} className="list-item card-list-item">
<div className="list-item-main">
<button
type="button"
className="link-button"
onClick={() =>
onSelectProject(selectedProjectId === project.id ? '' : project.id)
}
>
<strong>{project.title}</strong>
</button>
{project.description && (
<p className="list-item-desc muted">{project.description}</p>
)}
</div>
<div className="list-item-meta action-controls">
<StatusBadge kind="initiative" status={project.status} />
{canManage && (
<button
type="button"
className="btn btn-secondary"
disabled={busy}
onClick={() => onDelete(project.id)}
>
Löschen
</button>
)}
</div>
</li>
))}
</ul>
</section>
)
}
@@ -67,10 +67,10 @@ export function RoadmapPlanSection({
<section className="card">
<div className="section-header">
<div>
<h2>Plan</h2>
<h2>Zielzustände (Gates)</h2>
<p className="section-lead muted">
Roadmap-Elemente methodenneutral — Gates, Reifegrade oder Review-Punkte.
Erreicht nur über Verify (Evidence, Review oder Decision).
Überprüfbare Zielpunkte — optional. Operative Planung läuft unter Ausführung.
Erreicht nur über Verify (Kriterien, Evidence, Review).
</p>
</div>
{canManage && (
+151
View File
@@ -0,0 +1,151 @@
import { useCallback, useEffect, useState } from 'react'
import {
createActionTask,
deleteTask,
listActionTasks,
updateTask,
} from '../api/tasks.js'
import { TASK_STATUSES, TASK_STATUS_LABELS } from '../constants/status.js'
import { EmptyState } from './EmptyState.jsx'
export function TasksSection({ actionId, canManage }) {
const [tasks, setTasks] = useState([])
const [loading, setLoading] = useState(true)
const [error, setError] = useState(null)
const [busy, setBusy] = useState(false)
const [title, setTitle] = useState('')
const load = useCallback(async () => {
if (!actionId) return
setLoading(true)
setError(null)
try {
setTasks(await listActionTasks(actionId))
} catch (err) {
setError(err.message)
} finally {
setLoading(false)
}
}, [actionId])
useEffect(() => {
load()
}, [load])
async function handleCreate(e) {
e.preventDefault()
if (!title.trim()) return
setBusy(true)
try {
await createActionTask(actionId, { title: title.trim() })
setTitle('')
await load()
} catch (err) {
setError(err.message)
} finally {
setBusy(false)
}
}
async function handleStatus(taskId, status) {
setBusy(true)
try {
await updateTask(taskId, { status })
await load()
} catch (err) {
setError(err.message)
} finally {
setBusy(false)
}
}
async function handleDelete(taskId) {
setBusy(true)
try {
await deleteTask(taskId)
await load()
} catch (err) {
setError(err.message)
} finally {
setBusy(false)
}
}
if (loading) return <p className="muted">Tasks werden geladen…</p>
return (
<section className="card tasks-section">
<div className="section-header">
<div>
<h3>Aufgaben</h3>
<p className="section-lead muted">
Kleinste ausführbare Schritte — später Zuordnung zu Gates (Zielerreichung).
</p>
</div>
</div>
{error && <p className="error">{error}</p>}
{canManage && (
<form className="inline-form-block task-inline-form" onSubmit={handleCreate}>
<label>
Neue Aufgabe
<input
value={title}
onChange={(e) => setTitle(e.target.value)}
maxLength={255}
required
placeholder="Konkreter nächster Schritt"
/>
</label>
<button type="submit" className="btn btn-primary" disabled={busy}>
Hinzufügen
</button>
</form>
)}
{tasks.length === 0 && (
<EmptyState message="Noch keine Aufgaben — zerlege das Arbeitspaket in umsetzbare Schritte." />
)}
<ul className="item-list task-list">
{tasks.map((task) => (
<li key={task.id} className="list-item card-list-item">
<div className="list-item-main">
<strong>{task.title}</strong>
</div>
<div className="list-item-meta action-controls">
{canManage ? (
<select
className="inline-select"
value={task.status}
disabled={busy}
onChange={(e) => handleStatus(task.id, e.target.value)}
aria-label="Task-Status"
>
{TASK_STATUSES.map((s) => (
<option key={s} value={s}>
{TASK_STATUS_LABELS[s]}
</option>
))}
</select>
) : (
<span>{TASK_STATUS_LABELS[task.status] || task.status}</span>
)}
{canManage && (
<button
type="button"
className="btn btn-secondary"
disabled={busy}
onClick={() => handleDelete(task.id)}
>
Entfernen
</button>
)}
</div>
</li>
))}
</ul>
</section>
)
}
+8
View File
@@ -15,6 +15,7 @@ export const EVIDENCE_STATUSES = ['submitted', 'accepted', 'rejected']
export const DECISION_STATUSES = ['proposed', 'decided', 'superseded']
export const REVIEW_STATUSES = ['planned', 'completed', 'skipped']
export const RECURRING_STATUSES = ['active', 'paused', 'ended']
export const TASK_STATUSES = ['open', 'in_progress', 'done', 'discarded']
export const PRIORITIES = ['low', 'normal', 'high']
export const OPEN_ACTION_STATUSES = ['open', 'ready', 'in_progress', 'blocked', 'review_required']
@@ -114,6 +115,13 @@ export const RECURRING_STATUS_LABELS = {
ended: 'Beendet',
}
export const TASK_STATUS_LABELS = {
open: 'Offen',
in_progress: 'In Arbeit',
done: 'Erledigt',
discarded: 'Verworfen',
}
export const PRIORITY_LABELS = {
low: 'Niedrig',
normal: 'Normal',
@@ -34,6 +34,11 @@ import {
deleteRoadmapItem,
verifyRoadmapItemReached,
} from '../api/roadmap.js'
import {
listInitiativeProjects,
createInitiativeProject,
deleteProject,
} from '../api/projects.js'
import {
listInitiativeEvidence,
createInitiativeEvidence,
@@ -76,6 +81,8 @@ export function InitiativeOperationsProvider({ children }) {
const [blockers, setBlockers] = useState([])
const [backlogItems, setBacklogItems] = useState([])
const [roadmapItems, setRoadmapItems] = useState([])
const [projects, setProjects] = useState([])
const [selectedProjectId, setSelectedProjectId] = useState('')
const [evidenceItems, setEvidenceItems] = useState([])
const [decisions, setDecisions] = useState([])
const [reviews, setReviews] = useState([])
@@ -112,6 +119,7 @@ export function InitiativeOperationsProvider({ children }) {
loads.push(listInitiativeBlockers(id).then(setBlockers).catch(() => setBlockers([])))
loads.push(listInitiativeBacklog(id).then(setBacklogItems).catch(() => setBacklogItems([])))
loads.push(listInitiativeRoadmapItems(id).then(setRoadmapItems).catch(() => setRoadmapItems([])))
loads.push(listInitiativeProjects(id).then(setProjects).catch(() => setProjects([])))
loads.push(listInitiativeEvidence(id).then(setEvidenceItems).catch(() => setEvidenceItems([])))
loads.push(listInitiativeDecisions(id).then(setDecisions).catch(() => setDecisions([])))
loads.push(listInitiativeReviews(id).then(setReviews).catch(() => setReviews([])))
@@ -147,11 +155,16 @@ export function InitiativeOperationsProvider({ children }) {
}, [load])
const visibleActions = useMemo(
() =>
hideDone
() => {
let list = hideDone
? actions.filter((a) => a.status !== 'done' && a.status !== 'discarded')
: actions,
[actions, hideDone]
: actions
if (selectedProjectId) {
list = list.filter((a) => a.project_id === selectedProjectId)
}
return list
},
[actions, hideDone, selectedProjectId]
)
const actionContextById = useMemo(
@@ -185,7 +198,11 @@ export function InitiativeOperationsProvider({ children }) {
: context?.actor?.id
? [context.actor.id]
: []
await createInitiativeAction(id, { ...payload, assigned_actor_ids: assigned })
await createInitiativeAction(id, {
...payload,
project_id: payload.project_id || selectedProjectId || undefined,
assigned_actor_ids: assigned,
})
setShowActionForm(false)
await load()
} catch (err) {
@@ -205,6 +222,8 @@ export function InitiativeOperationsProvider({ children }) {
priority: payload.priority,
due_at: payload.due_at,
clear_due_at: !payload.due_at,
project_id: payload.project_id,
clear_project: payload.project_id === '' || payload.project_id === null,
})
if (capabilities.has('kairo.action.manage')) {
await setActionAssignments(actionId, payload.assigned_actor_ids || [])
@@ -386,6 +405,28 @@ export function InitiativeOperationsProvider({ children }) {
}
}
async function handleCreateProject(body) {
setFormBusy(true)
try {
await createInitiativeProject(id, body)
await load()
} catch (err) {
setError(err.message)
} finally {
setFormBusy(false)
}
}
async function handleDeleteProject(projectId) {
try {
await deleteProject(projectId)
if (selectedProjectId === projectId) setSelectedProjectId('')
await load()
} catch (err) {
setError(err.message)
}
}
const milestones = useMemo(
() => roadmapItems.filter((item) => item.item_type === 'milestone'),
[roadmapItems]
@@ -520,6 +561,9 @@ export function InitiativeOperationsProvider({ children }) {
unlinkedBlockers,
backlogItems,
roadmapItems,
projects,
selectedProjectId,
setSelectedProjectId,
milestones,
evidenceItems,
decisions,
@@ -567,7 +611,9 @@ export function InitiativeOperationsProvider({ children }) {
handleDeleteRoadmapItem,
handleCreateMilestone: handleCreateRoadmapItem,
handleMilestoneStatus: handleRoadmapItemStatus,
handleDeleteMilestone: handleDeleteRoadmapItem,
handleDeleteMilestone: handleDeleteRoadmapItem,
handleCreateProject,
handleDeleteProject,
handleCreateEvidence,
handleEvidenceStatus,
handleDeleteEvidence,
+37 -20
View File
@@ -2,10 +2,12 @@ import { useCallback, useEffect, useState } from 'react'
import { Link, useParams } from 'react-router-dom'
import { getAction } from '../api/actions.js'
import { getInitiativeSteeringSnapshot } from '../api/initiatives.js'
import { listInitiativeProjects } from '../api/projects.js'
import { updateAction, setActionAssignments } from '../api/actions.js'
import { createInitiativeBlocker } from '../api/blockers.js'
import { ActionHubCard } from '../components/ActionHubCard.jsx'
import { ActionForm } from '../components/ActionForm.jsx'
import { TasksSection } from '../components/TasksSection.jsx'
import { ErrorState } from '../components/ErrorState.jsx'
import { LoadingState } from '../components/LoadingState.jsx'
import { useInitiativeOperations } from '../context/InitiativeOperationsContext.jsx'
@@ -24,11 +26,13 @@ function ActionDetailBody({
formBusy,
capabilities,
actorsState,
projects = [],
}) {
if (editing) {
return (
<ActionForm
initial={action}
projects={projects}
actors={actorsState.actors}
actorsLoading={actorsState.loading}
actorsError={actorsState.error}
@@ -43,25 +47,31 @@ function ActionDetailBody({
}
return (
<ActionHubCard
action={action}
context={context}
editing={false}
onEdit={onEdit}
onCancelEdit={onCancelEdit}
onSubmitEdit={onSubmit}
onQuickStatus={onQuickStatus}
onCreateBlocker={onCreateBlocker}
canManage={capabilities.has('kairo.action.manage')}
canManageBlocker={capabilities.has('kairo.blocker.manage')}
formBusy={formBusy}
actors={actorsState.actors}
actorsLoading={actorsState.loading}
actorsError={actorsState.error}
actorsUsedFallback={actorsState.usedFallback}
onReloadActors={actorsState.reload}
detailMode
/>
<>
<ActionHubCard
action={action}
context={context}
editing={false}
onEdit={onEdit}
onCancelEdit={onCancelEdit}
onSubmitEdit={onSubmit}
onQuickStatus={onQuickStatus}
onCreateBlocker={onCreateBlocker}
canManage={capabilities.has('kairo.action.manage')}
canManageBlocker={capabilities.has('kairo.blocker.manage')}
formBusy={formBusy}
actors={actorsState.actors}
actorsLoading={actorsState.loading}
actorsError={actorsState.error}
actorsUsedFallback={actorsState.usedFallback}
onReloadActors={actorsState.reload}
detailMode
/>
<TasksSection
actionId={action.id}
canManage={capabilities.has('kairo.action.manage')}
/>
</>
)
}
@@ -70,6 +80,7 @@ function ActionDetailStandalone() {
const { capabilities } = useCapabilities()
const actorsState = useActors()
const [action, setAction] = useState(null)
const [projects, setProjects] = useState([])
const [context, setContext] = useState(null)
const [loading, setLoading] = useState(true)
const [error, setError] = useState(null)
@@ -82,7 +93,11 @@ function ActionDetailStandalone() {
try {
const actionData = await getAction(actionId)
setAction(actionData)
const snap = await getInitiativeSteeringSnapshot(actionData.initiative_id)
const [snap, projectData] = await Promise.all([
getInitiativeSteeringSnapshot(actionData.initiative_id),
listInitiativeProjects(actionData.initiative_id).catch(() => []),
])
setProjects(projectData)
setContext((snap.actions || []).find((a) => a.id === actionId) || null)
} catch (err) {
setError(err.message)
@@ -188,6 +203,7 @@ function ActionDetailStandalone() {
formBusy={formBusy}
capabilities={capabilities}
actorsState={actorsState}
projects={projects}
/>
</section>
</div>
@@ -228,6 +244,7 @@ function ActionDetailNested() {
usedFallback: ops.actorsUsedFallback,
reload: ops.reloadActors,
}}
projects={ops.projects}
/>
</section>
)
@@ -1,11 +1,15 @@
import { useInitiativeOperations } from '../../context/InitiativeOperationsContext.jsx'
import { InitiativeActionsHub } from '../../components/InitiativeActionsHub.jsx'
import { ProjectsSection } from '../../components/ProjectsSection.jsx'
import { BlockersSection } from '../../components/BlockersSection.jsx'
export function InitiativeExecutionPage() {
const ops = useInitiativeOperations()
const {
visibleActions,
projects,
selectedProjectId,
setSelectedProjectId,
actionContextById,
hideDone,
setHideDone,
@@ -24,9 +28,20 @@ export function InitiativeExecutionPage() {
<>
{error && <p className="error">{error}</p>}
<ProjectsSection
projects={projects}
selectedProjectId={selectedProjectId}
onSelectProject={setSelectedProjectId}
canManage={capabilities.has('kairo.project.manage')}
onCreate={ops.handleCreateProject}
onDelete={ops.handleDeleteProject}
busy={formBusy}
/>
<InitiativeActionsHub
initiativeId={initiativeId}
actions={visibleActions}
projects={projects}
actionContextById={actionContextById}
hideDone={hideDone}
onHideDoneChange={setHideDone}
@@ -56,7 +71,7 @@ export function InitiativeExecutionPage() {
<BlockersSection
blockers={unlinkedBlockers}
heading="Vorhaben-Blocker"
lead="Ohne Maßnahmenbezug — verknüpfte Blocker erscheinen am Arbeitspaket."
lead="Ohne Arbeitspaketbezug — verknüpfte Blocker erscheinen am Arbeitspaket."
emptyMessage="Keine vorhabenweiten Blocker."
canManage={capabilities.has('kairo.blocker.manage')}
onCreate={ops.handleCreateBlocker}
@@ -131,7 +131,7 @@ export function RoadmapItemDetailPage() {
return (
<section className="card roadmap-item-detail">
<p className="breadcrumb muted">
<Link to={`/initiatives/${initiativeId}/plan`}>Plan</Link>
<Link to={`/initiatives/${initiativeId}/plan`}>Zielzustände</Link>
{' · '}
{item.title}
</p>