AP1.16c: Durchführungsplan in Plan-Outline und Action-Detail.
Deploy Development / deploy (push) Successful in 46s
Test Suite / pytest-backend (push) Successful in 2m19s
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 19s
Test Suite / playwright-smoke (push) Successful in 12s
Deploy Development / deploy (push) Successful in 46s
Test Suite / pytest-backend (push) Successful in 2m19s
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 19s
Test Suite / playwright-smoke (push) Successful in 12s
Ready/blocked-Badges, Planning Debt, Vorgänger-Verwaltung — getrennt vom Gate-Designer. Co-authored-by: Cursor <cursoragent@cursor.com>
This commit is contained in:
1 parent
1166a0c7f1
commit
8546c7021b
14 files changed
+583
-20
No files matched your search
@@ -0,0 +1,225 @@
|
||||
import { useCallback, useEffect, useMemo, useState } from 'react'
|
||||
import { Link } from 'react-router-dom'
|
||||
import {
|
||||
createInitiativeActionDependency,
|
||||
deleteInitiativeActionDependency,
|
||||
listInitiativeActionDependencies,
|
||||
} from '../api/executionPlan.js'
|
||||
import { actionPath } from '../utils/routes.js'
|
||||
import { dependenciesForAction } from '../utils/executionGraph.js'
|
||||
import { DependencyKindLabel, ExecutionFlowBadge } from './ExecutionFlowBadge.jsx'
|
||||
import { EmptyState } from './EmptyState.jsx'
|
||||
|
||||
const DEP_KIND_OPTIONS = [
|
||||
{ value: 'requires', label: 'Benötigt (Vorgänger done)' },
|
||||
{ value: 'blocks', label: 'Blockiert solange offen' },
|
||||
{ value: 'relates', label: 'Bezug (kein Block)' },
|
||||
]
|
||||
|
||||
export function ActionDependenciesSection({
|
||||
initiativeId,
|
||||
action,
|
||||
actions = [],
|
||||
graphState = null,
|
||||
canManage = false,
|
||||
}) {
|
||||
const [dependencies, setDependencies] = useState([])
|
||||
const [loading, setLoading] = useState(true)
|
||||
const [error, setError] = useState(null)
|
||||
const [busy, setBusy] = useState(false)
|
||||
const [predecessorId, setPredecessorId] = useState('')
|
||||
const [dependencyKind, setDependencyKind] = useState('requires')
|
||||
|
||||
const actionById = useMemo(
|
||||
() => Object.fromEntries(actions.map((item) => [item.id, item])),
|
||||
[actions],
|
||||
)
|
||||
|
||||
const load = useCallback(async () => {
|
||||
if (!initiativeId) return
|
||||
setLoading(true)
|
||||
setError(null)
|
||||
try {
|
||||
const rows = await listInitiativeActionDependencies(initiativeId)
|
||||
setDependencies(Array.isArray(rows) ? rows : [])
|
||||
} catch (err) {
|
||||
setError(err.message)
|
||||
setDependencies([])
|
||||
} finally {
|
||||
setLoading(false)
|
||||
}
|
||||
}, [initiativeId])
|
||||
|
||||
useEffect(() => {
|
||||
load()
|
||||
}, [load])
|
||||
|
||||
const { predecessors, successors } = useMemo(
|
||||
() => dependenciesForAction(dependencies, action.id),
|
||||
[dependencies, action.id],
|
||||
)
|
||||
|
||||
const candidatePredecessors = useMemo(() => {
|
||||
const existingPreds = new Set(predecessors.map((dep) => dep.predecessor_action_id))
|
||||
return actions.filter(
|
||||
(item) =>
|
||||
item.id !== action.id &&
|
||||
!existingPreds.has(item.id) &&
|
||||
item.status !== 'discarded',
|
||||
)
|
||||
}, [actions, action.id, predecessors])
|
||||
|
||||
const executionMeta = graphState?.items?.[action.id] || null
|
||||
|
||||
async function handleAdd(e) {
|
||||
e.preventDefault()
|
||||
if (!predecessorId || !canManage) return
|
||||
setBusy(true)
|
||||
setError(null)
|
||||
try {
|
||||
await createInitiativeActionDependency(initiativeId, {
|
||||
predecessor_action_id: predecessorId,
|
||||
successor_action_id: action.id,
|
||||
dependency_kind: dependencyKind,
|
||||
})
|
||||
setPredecessorId('')
|
||||
setDependencyKind('requires')
|
||||
await load()
|
||||
} catch (err) {
|
||||
setError(err.message)
|
||||
} finally {
|
||||
setBusy(false)
|
||||
}
|
||||
}
|
||||
|
||||
async function handleRemove(dependencyId) {
|
||||
if (!canManage) return
|
||||
setBusy(true)
|
||||
setError(null)
|
||||
try {
|
||||
await deleteInitiativeActionDependency(initiativeId, dependencyId)
|
||||
await load()
|
||||
} catch (err) {
|
||||
setError(err.message)
|
||||
} finally {
|
||||
setBusy(false)
|
||||
}
|
||||
}
|
||||
|
||||
return (
|
||||
<section className="card action-dependencies-section">
|
||||
<div className="section-header">
|
||||
<div>
|
||||
<h3>Durchführungsplan</h3>
|
||||
<p className="section-lead muted">
|
||||
Vorgänger und Nachfolger — getrennt vom Zielzustands-Graph.
|
||||
</p>
|
||||
</div>
|
||||
<ExecutionFlowBadge meta={executionMeta} actionStatus={action.status} />
|
||||
</div>
|
||||
|
||||
{error && <p className="error">{error}</p>}
|
||||
{loading && <p className="muted">Lade Abhängigkeiten …</p>}
|
||||
|
||||
{!loading && (
|
||||
<>
|
||||
<div className="action-dependencies-section__block">
|
||||
<h4 className="action-dependencies-section__subtitle">Vorgänger</h4>
|
||||
{predecessors.length === 0 ? (
|
||||
<EmptyState message="Keine Vorgänger — Arbeitspaket ist unabhängig oder nutzt sort_order." />
|
||||
) : (
|
||||
<ul className="item-list">
|
||||
{predecessors.map((dep) => {
|
||||
const pred = actionById[dep.predecessor_action_id]
|
||||
return (
|
||||
<li key={dep.id} className="list-item card-list-item">
|
||||
<div className="list-item-main">
|
||||
<Link to={actionPath(dep.predecessor_action_id)}>
|
||||
<strong>{pred?.title || dep.predecessor_action_id.slice(0, 8)}</strong>
|
||||
</Link>
|
||||
<p className="list-item-sub muted">
|
||||
<DependencyKindLabel kind={dep.dependency_kind} />
|
||||
</p>
|
||||
</div>
|
||||
{canManage && (
|
||||
<button
|
||||
type="button"
|
||||
className="btn btn-secondary btn-sm"
|
||||
disabled={busy}
|
||||
onClick={() => handleRemove(dep.id)}
|
||||
>
|
||||
Entfernen
|
||||
</button>
|
||||
)}
|
||||
</li>
|
||||
)
|
||||
})}
|
||||
</ul>
|
||||
)}
|
||||
</div>
|
||||
|
||||
<div className="action-dependencies-section__block">
|
||||
<h4 className="action-dependencies-section__subtitle">Nachfolger</h4>
|
||||
{successors.length === 0 ? (
|
||||
<p className="muted">Keine Nachfolger.</p>
|
||||
) : (
|
||||
<ul className="item-list">
|
||||
{successors.map((dep) => {
|
||||
const succ = actionById[dep.successor_action_id]
|
||||
return (
|
||||
<li key={dep.id} className="list-item card-list-item">
|
||||
<Link to={actionPath(dep.successor_action_id)}>
|
||||
<strong>{succ?.title || dep.successor_action_id.slice(0, 8)}</strong>
|
||||
</Link>
|
||||
<span className="muted"> — </span>
|
||||
<DependencyKindLabel kind={dep.dependency_kind} />
|
||||
</li>
|
||||
)
|
||||
})}
|
||||
</ul>
|
||||
)}
|
||||
</div>
|
||||
|
||||
{canManage && candidatePredecessors.length > 0 && (
|
||||
<form className="form action-dependencies-section__form" onSubmit={handleAdd}>
|
||||
<h4 className="action-dependencies-section__subtitle">Vorgänger hinzufügen</h4>
|
||||
<label>
|
||||
Arbeitspaket
|
||||
<select
|
||||
value={predecessorId}
|
||||
onChange={(e) => setPredecessorId(e.target.value)}
|
||||
required
|
||||
>
|
||||
<option value="">— wählen —</option>
|
||||
{candidatePredecessors.map((item) => (
|
||||
<option key={item.id} value={item.id}>
|
||||
{item.title}
|
||||
</option>
|
||||
))}
|
||||
</select>
|
||||
</label>
|
||||
<label>
|
||||
Art
|
||||
<select
|
||||
value={dependencyKind}
|
||||
onChange={(e) => setDependencyKind(e.target.value)}
|
||||
>
|
||||
{DEP_KIND_OPTIONS.map((opt) => (
|
||||
<option key={opt.value} value={opt.value}>
|
||||
{opt.label}
|
||||
</option>
|
||||
))}
|
||||
</select>
|
||||
</label>
|
||||
<div className="form-actions">
|
||||
<button type="submit" className="btn btn-primary" disabled={busy || !predecessorId}>
|
||||
Hinzufügen
|
||||
</button>
|
||||
</div>
|
||||
</form>
|
||||
)}
|
||||
</>
|
||||
)}
|
||||
</section>
|
||||
)
|
||||
}
|
||||
@@ -0,0 +1,31 @@
|
||||
const KIND_LABELS = {
|
||||
requires: 'benötigt',
|
||||
blocks: 'blockiert',
|
||||
relates: 'bezogen',
|
||||
}
|
||||
|
||||
export function ExecutionFlowBadge({ meta, actionStatus }) {
|
||||
if (!meta) return null
|
||||
if (actionStatus === 'done' || actionStatus === 'discarded') {
|
||||
return null
|
||||
}
|
||||
if (meta.blocked) {
|
||||
return (
|
||||
<span className="badge execution-flow-badge execution-flow-badge--blocked" title="Vorgänger offen">
|
||||
Wartet
|
||||
</span>
|
||||
)
|
||||
}
|
||||
if (meta.ready) {
|
||||
return (
|
||||
<span className="badge execution-flow-badge execution-flow-badge--ready" title="Keine offenen Vorgänger">
|
||||
Bereit
|
||||
</span>
|
||||
)
|
||||
}
|
||||
return null
|
||||
}
|
||||
|
||||
export function DependencyKindLabel({ kind }) {
|
||||
return <span className="muted">{KIND_LABELS[kind] || kind}</span>
|
||||
}
|
||||
@@ -9,6 +9,12 @@ import { ActionTaskPanel } from './ActionTaskPanel.jsx'
|
||||
import { gateTitleById } from './GateSelect.jsx'
|
||||
import { buildProjectPath, collectProjectSubtreeIds } from '../utils/projectTree.js'
|
||||
import { actionPath } from '../utils/routes.js'
|
||||
import {
|
||||
formatBlockedByTitles,
|
||||
getActionExecutionMeta,
|
||||
sortActionsForExecutionPlan,
|
||||
} from '../utils/executionGraph.js'
|
||||
import { ExecutionFlowBadge } from './ExecutionFlowBadge.jsx'
|
||||
|
||||
function formatProjectContext(projects, projectId) {
|
||||
if (!projectId) return 'Direkt am Vorhaben'
|
||||
@@ -31,6 +37,7 @@ export function PlanActionsSection({
|
||||
actorsUsedFallback,
|
||||
onReloadActors,
|
||||
busy,
|
||||
executionGraph = null,
|
||||
}) {
|
||||
const [showCreate, setShowCreate] = useState(false)
|
||||
const [expandedActions, setExpandedActions] = useState(() => new Set())
|
||||
@@ -45,16 +52,7 @@ export function PlanActionsSection({
|
||||
list = list.filter((a) => a.project_id && subtreeIds.has(a.project_id))
|
||||
}
|
||||
|
||||
return list.sort((a, b) => {
|
||||
const projectA = a.project_id || ''
|
||||
const projectB = b.project_id || ''
|
||||
if (projectA !== projectB) {
|
||||
if (!projectA) return -1
|
||||
if (!projectB) return 1
|
||||
return projectA.localeCompare(projectB)
|
||||
}
|
||||
return (a.title || '').localeCompare(b.title || '')
|
||||
})
|
||||
return sortActionsForExecutionPlan(list)
|
||||
}, [actions, hideDone, scopeProjectId, projects])
|
||||
|
||||
async function handleCreate(payload) {
|
||||
@@ -112,13 +110,25 @@ export function PlanActionsSection({
|
||||
)}
|
||||
|
||||
<ul className="item-list plan-actions-list">
|
||||
{visibleActions.map((action) => (
|
||||
{visibleActions.map((action) => {
|
||||
const execMeta = getActionExecutionMeta(executionGraph, action.id)
|
||||
const blockedHint =
|
||||
execMeta?.blocked_by?.length > 0
|
||||
? formatBlockedByTitles(actions, execMeta.blocked_by)
|
||||
: null
|
||||
|
||||
return (
|
||||
<li key={action.id} className="list-item card-list-item plan-actions-list__item">
|
||||
<div className="plan-actions-list__header">
|
||||
<div className="list-item-main">
|
||||
<Link to={actionPath(action.id)} className="plan-actions-list__title">
|
||||
<strong>{action.title}</strong>
|
||||
</Link>
|
||||
{action.action_kind === 'planning' && (
|
||||
<span className="badge execution-flow-badge execution-flow-badge--planning">
|
||||
Planung
|
||||
</span>
|
||||
)}
|
||||
<p className="list-item-sub muted">
|
||||
{formatProjectContext(projects, action.project_id)}
|
||||
</p>
|
||||
@@ -127,11 +137,15 @@ export function PlanActionsSection({
|
||||
Gate: {gateTitleById(roadmapItems, action.roadmap_item_id)}
|
||||
</p>
|
||||
)}
|
||||
{blockedHint && (
|
||||
<p className="list-item-sub muted">Wartet auf: {blockedHint}</p>
|
||||
)}
|
||||
{action.description && (
|
||||
<p className="list-item-desc">{action.description}</p>
|
||||
)}
|
||||
</div>
|
||||
<div className="list-item-meta action-controls">
|
||||
<ExecutionFlowBadge meta={execMeta} actionStatus={action.status} />
|
||||
<StatusBadge kind="action" status={action.status} />
|
||||
<PriorityBadge priority={action.priority} />
|
||||
<Link to={actionPath(action.id)} className="btn btn-secondary btn-sm">
|
||||
@@ -147,7 +161,8 @@ export function PlanActionsSection({
|
||||
onToggle={() => toggleActionTasks(action.id)}
|
||||
/>
|
||||
</li>
|
||||
))}
|
||||
)
|
||||
})}
|
||||
</ul>
|
||||
|
||||
<Modal open={showCreate} title="Arbeitspaket anlegen" onClose={() => setShowCreate(false)} size="lg">
|
||||
|
||||
@@ -3,6 +3,7 @@ import { useEffect, useMemo, useState } from 'react'
|
||||
import { listInitiativeProjects } from '../api/projects.js'
|
||||
import { listInitiativeActions } from '../api/initiatives.js'
|
||||
import { listInitiativeBacklog } from '../api/backlog.js'
|
||||
import { getInitiativeExecutionGraphState } from '../api/executionPlan.js'
|
||||
import { useProgramScope } from '../context/ProgramScopeContext.jsx'
|
||||
import { buildProjectsByParent } from '../utils/projectTree.js'
|
||||
import { projectPath } from '../utils/routes.js'
|
||||
@@ -58,6 +59,7 @@ export function PlanOutlineNav() {
|
||||
const [counts, setCounts] = useState({ inbox: null, work: null })
|
||||
const [projects, setProjects] = useState([])
|
||||
const [openActions, setOpenActions] = useState([])
|
||||
const [executionGraph, setExecutionGraph] = useState(null)
|
||||
const [structureOpen, setStructureOpen] = useState(
|
||||
activeKey === 'structure' || Boolean(activeProjectId),
|
||||
)
|
||||
@@ -100,12 +102,14 @@ export function PlanOutlineNav() {
|
||||
Promise.all([
|
||||
listInitiativeBacklog(initiativeId).catch(() => []),
|
||||
listInitiativeActions(initiativeId).catch(() => []),
|
||||
]).then(([backlog, actions]) => {
|
||||
getInitiativeExecutionGraphState(initiativeId).catch(() => null),
|
||||
]).then(([backlog, actions, graphState]) => {
|
||||
if (cancelled) return
|
||||
const open = actions.filter(
|
||||
(action) => action.status !== 'done' && action.status !== 'discarded',
|
||||
)
|
||||
setOpenActions(open)
|
||||
setExecutionGraph(graphState)
|
||||
setCounts({
|
||||
inbox: backlog.filter((item) => item.status !== 'converted').length,
|
||||
work: open.length,
|
||||
@@ -222,6 +226,7 @@ export function PlanOutlineNav() {
|
||||
openActions={openActions}
|
||||
activeActionId={activeActionId}
|
||||
enabled={workOpen}
|
||||
executionGraph={executionGraph}
|
||||
/>
|
||||
)}
|
||||
</li>
|
||||
|
||||
@@ -3,6 +3,8 @@ import { NavLink } from 'react-router-dom'
|
||||
import { listActionTasks } from '../api/tasks.js'
|
||||
import { actionPath } from '../utils/routes.js'
|
||||
import { buildTasksByParent, countOpenTasks, MAX_TASK_UI_DEPTH } from '../utils/taskTree.js'
|
||||
import { getActionExecutionMeta } from '../utils/executionGraph.js'
|
||||
import { ExecutionFlowBadge } from './ExecutionFlowBadge.jsx'
|
||||
|
||||
function actionTasksHref(actionId) {
|
||||
return `${actionPath(actionId)}#tasks`
|
||||
@@ -80,7 +82,7 @@ function PlanOutlineTaskTree({
|
||||
)
|
||||
}
|
||||
|
||||
function PlanOutlineActionNode({ action, tasks, activeActionId, defaultExpanded }) {
|
||||
function PlanOutlineActionNode({ action, tasks, activeActionId, defaultExpanded, executionGraph }) {
|
||||
const [actionOpen, setActionOpen] = useState(defaultExpanded)
|
||||
const [expandedTaskIds, setExpandedTaskIds] = useState(() => new Set())
|
||||
|
||||
@@ -101,6 +103,8 @@ function PlanOutlineActionNode({ action, tasks, activeActionId, defaultExpanded
|
||||
})
|
||||
}
|
||||
|
||||
const execMeta = getActionExecutionMeta(executionGraph, action.id)
|
||||
|
||||
return (
|
||||
<li>
|
||||
<div className="analysis-split__nav-row">
|
||||
@@ -129,6 +133,7 @@ function PlanOutlineActionNode({ action, tasks, activeActionId, defaultExpanded
|
||||
<span className="analysis-split__nav-meta"> ({openTaskCount})</span>
|
||||
)}
|
||||
</NavLink>
|
||||
<ExecutionFlowBadge meta={execMeta} actionStatus={action.status} />
|
||||
</div>
|
||||
{hasOpenTasks && actionOpen && (
|
||||
<PlanOutlineTaskTree
|
||||
@@ -145,7 +150,7 @@ function PlanOutlineActionNode({ action, tasks, activeActionId, defaultExpanded
|
||||
)
|
||||
}
|
||||
|
||||
export function PlanOutlineWorkTree({ openActions, activeActionId, enabled }) {
|
||||
export function PlanOutlineWorkTree({ openActions, activeActionId, enabled, executionGraph = null }) {
|
||||
const [tasksByAction, setTasksByAction] = useState({})
|
||||
const actionIdsKey = useMemo(
|
||||
() => openActions.map((action) => action.id).join(','),
|
||||
@@ -181,6 +186,7 @@ export function PlanOutlineWorkTree({ openActions, activeActionId, enabled }) {
|
||||
tasks={tasksByAction[action.id] || []}
|
||||
activeActionId={activeActionId}
|
||||
defaultExpanded={activeActionId === action.id}
|
||||
executionGraph={executionGraph}
|
||||
/>
|
||||
))}
|
||||
</ul>
|
||||
|
||||
@@ -0,0 +1,27 @@
|
||||
import { Link } from 'react-router-dom'
|
||||
|
||||
export function PlanningDebtBanner({ planningDebt, hrefWithScope }) {
|
||||
if (!planningDebt?.length || !hrefWithScope) {
|
||||
return null
|
||||
}
|
||||
|
||||
return (
|
||||
<div className="planning-debt-banner" role="status">
|
||||
<p className="planning-debt-banner__title">Planung ausstehend</p>
|
||||
<ul className="planning-debt-banner__list">
|
||||
{planningDebt.map((item) => (
|
||||
<li key={item.roadmap_item_id}>
|
||||
<strong>{item.title || 'Zielzustand'}</strong>
|
||||
<span className="muted"> — {item.message || 'Durchführungsplan fehlt'}</span>
|
||||
</li>
|
||||
))}
|
||||
</ul>
|
||||
<p className="muted planning-debt-banner__hint">
|
||||
Lege Arbeitspakete unter dem aktiven Gate an —{' '}
|
||||
<Link to={hrefWithScope('/plan/gates')}>Zielzustände</Link>
|
||||
{' · '}
|
||||
<Link to={hrefWithScope('/plan/work')}>Arbeit</Link>
|
||||
</p>
|
||||
</div>
|
||||
)
|
||||
}
|
||||
Reference in new issue
Block a user