Erfassen und Transparent: Archetyp, Methode und Auspraegung in der UI sichtbar.
Test Suite / pytest-backend (push) Failing after 2s
Test Suite / k6 /api/health Baseline (push) Has been skipped
Test Suite / playwright-smoke (push) Has been skipped
Test Suite / lint-backend (push) Successful in 3s
Test Suite / compose-smoke (push) Has been skipped
Deploy Development / deploy (push) Failing after 50s

Method-Profiles-API und Auswahl beim Anlegen/Profil; Steuerungs-Meta in Listen und Plan; Projekt-Archetyp-Spiegel, Next-Action-Links und Umlaut-Fix fuer testbare Guidance.

Co-authored-by: Cursor <cursoragent@cursor.com>
This commit is contained in:
LarsandCursor committed 2026-07-10 12:36:12 +02:00
1 parent 95b743d6fd
commit efb45a3ee6
31 files changed
+965 -65

No files matched your search

+13 -2
View File
@@ -1,8 +1,9 @@
import { useCallback, useEffect, useState } from 'react'
import { Link } from 'react-router-dom'
import { Link, useNavigate } from 'react-router-dom'
import { listInitiatives, listInitiativeActions, createInitiative } from '../api/initiatives.js'
import { saveInitiativeDynamicFields, splitInitiativeFormPayload } from '../api/entityFields.js'
import { countOpenActions } from '../api/actions.js'
import { ArchetypeBadge } from '../components/ArchetypeBadge.jsx'
import { StatusBadge } from '../components/StatusBadge.jsx'
import { PriorityBadge } from '../components/PriorityBadge.jsx'
import { InitiativeForm } from '../components/InitiativeForm.jsx'
@@ -10,12 +11,15 @@ import { EmptyState } from '../components/EmptyState.jsx'
import { ErrorState } from '../components/ErrorState.jsx'
import { LoadingState } from '../components/LoadingState.jsx'
import { useCapabilities } from '../hooks/useCapabilities.js'
import { useEntityArchetypes } from '../hooks/useEntityArchetypes.js'
import { useSession } from '../context/SessionContext.jsx'
import { scopedPath } from '../utils/routes.js'
export function InitiativesPage() {
const navigate = useNavigate()
const { context } = useSession()
const { hasCapability } = useCapabilities()
const { initiativeArchetypes } = useEntityArchetypes()
const [initiatives, setInitiatives] = useState([])
const [openCounts, setOpenCounts] = useState({})
const [loading, setLoading] = useState(true)
@@ -62,6 +66,7 @@ export function InitiativesPage() {
await saveInitiativeDynamicFields(created.id, dynamicFields)
setShowForm(false)
await load()
navigate(scopedPath('/plan/profile', { initiativeId: created.id }))
} catch (err) {
setError(err.message)
} finally {
@@ -74,7 +79,9 @@ export function InitiativesPage() {
<header className="page-header">
<div>
<h1>Vorhaben</h1>
<p className="page-lead">Aktive und pausierte Vorhaben im Tenant.</p>
<p className="page-lead">
Alle aktiven Vorhaben — Archetyp und Steuerung im Profil und unter Kontrolle einsehen.
</p>
</div>
{hasCapability('kairo.initiative.manage') && (
<button
@@ -115,6 +122,10 @@ export function InitiativesPage() {
{item.goal && <p className="list-item-desc">{item.goal}</p>}
</div>
<div className="list-item-meta">
<ArchetypeBadge
archetypeKey={item.archetype_key}
archetypes={initiativeArchetypes}
/>
<StatusBadge kind="initiative" status={item.status} />
<PriorityBadge priority={item.priority} />
{openCounts[item.id] != null && (
+2 -1
View File
@@ -6,6 +6,7 @@ import { useSession } from '../context/SessionContext.jsx'
import { InitiativeForm } from '../components/InitiativeForm.jsx'
import { createInitiative } from '../api/initiatives.js'
import { saveInitiativeDynamicFields, splitInitiativeFormPayload } from '../api/entityFields.js'
import { scopedPath } from '../utils/routes.js'
import { Link } from 'react-router-dom'
export function WorkspacePage() {
@@ -28,7 +29,7 @@ export function WorkspacePage() {
})
await saveInitiativeDynamicFields(created.id, dynamicFields)
setShowForm(false)
navigate('/initiatives')
navigate(scopedPath('/plan/profile', { initiativeId: created.id }))
} catch (err) {
setFormError(err.message)
} finally {
@@ -6,6 +6,8 @@ import { EmptyState } from '../../components/EmptyState.jsx'
import { ErrorState } from '../../components/ErrorState.jsx'
import { gateTitleById } from '../../components/GateSelect.jsx'
import { useInitiativeOperations } from '../../context/InitiativeOperationsContext.jsx'
import { useEntityArchetypes } from '../../hooks/useEntityArchetypes.js'
import { projectArchetypeLabel } from '../../utils/archetypes.js'
import { gatePath, projectPath, actionPath, scopedPath } from '../../utils/routes.js'
import {
buildProjectPath,
@@ -35,6 +37,8 @@ function ProjectDetailView({
onDelete,
onFilter,
busy,
projectArchetypes,
initiativeArchetypes,
}) {
const path = buildProjectPath(projects, project.id)
const gateTitle = gateTitleById(roadmapItems, project.roadmap_item_id)
@@ -52,6 +56,20 @@ function ProjectDetailView({
<dt>Art</dt>
<dd>{containerKindLabel(project.container_kind) || 'Standard'}</dd>
</div>
<div>
<dt>Archetyp</dt>
<dd>
{projectArchetypeLabel(
project.archetype_key,
projectArchetypes,
initiativeArchetypes,
)}
<span className="muted project-detail-archetype-hint">
{' '}
(vom Vorhaben gespiegelt)
</span>
</dd>
</div>
<div>
<dt>Ebene</dt>
<dd>
@@ -178,6 +196,7 @@ export function ProjectDetailPage() {
const { projectId } = useParams()
const navigate = useNavigate()
const ops = useInitiativeOperations()
const { initiativeArchetypes, projectArchetypes } = useEntityArchetypes()
const isNew = projectId === 'new'
const [editing, setEditing] = useState(isNew)
const [localError, setLocalError] = useState(null)
@@ -304,6 +323,9 @@ export function ProjectDetailPage() {
}
busy={ops.formBusy}
submitLabel={isNew ? 'Anlegen' : 'Speichern'}
initiativeArchetypeKey={ops.initiative?.archetype_key}
initiativeArchetypes={initiativeArchetypes}
projectArchetypes={projectArchetypes}
/>
) : (
project && (
@@ -319,6 +341,8 @@ export function ProjectDetailPage() {
onDelete={handleDelete}
onFilter={handleFilter}
busy={ops.formBusy}
projectArchetypes={projectArchetypes}
initiativeArchetypes={initiativeArchetypes}
/>
)
)}
+2 -2
View File
@@ -8,7 +8,7 @@ import { InitiativeForm } from '../../components/InitiativeForm.jsx'
import { createInitiative } from '../../api/initiatives.js'
import { saveInitiativeDynamicFields, splitInitiativeFormPayload } from '../../api/entityFields.js'
import { ModeShell } from '../../components/ModeShell.jsx'
import { initiativeCatalogPath } from '../../utils/routes.js'
import { initiativeCatalogPath, scopedPath } from '../../utils/routes.js'
export function CockpitPage() {
const navigate = useNavigate()
@@ -30,7 +30,7 @@ export function CockpitPage() {
})
await saveInitiativeDynamicFields(created.id, dynamicFields)
setShowForm(false)
navigate(initiativeCatalogPath())
navigate(scopedPath('/plan/profile', { initiativeId: created.id }))
} catch (err) {
setFormError(err.message)
} finally {
+58 -5
View File
@@ -1,13 +1,18 @@
import { useEffect, useState } from 'react'
import { Link } from 'react-router-dom'
import { RequireInitiativeScope } from '../../components/RequireInitiativeScope.jsx'
import { ScopedInitiativeProvider } from '../../layout/ScopedInitiativeProvider.jsx'
import { StatusBadge } from '../../components/StatusBadge.jsx'
import { LoadingState } from '../../components/LoadingState.jsx'
import { Modal } from '../../components/Modal.jsx'
import { InitiativeForm } from '../../components/InitiativeForm.jsx'
import { InitiativeSteeringMeta } from '../../components/InitiativeSteeringMeta.jsx'
import { MethodProfileSelect } from '../../components/MethodProfileSelect.jsx'
import { PriorityBadge } from '../../components/PriorityBadge.jsx'
import { useInitiativeOperations } from '../../context/InitiativeOperationsContext.jsx'
import { useProgramScope } from '../../context/ProgramScopeContext.jsx'
import { initiativeArchetypeLabel } from '../../constants/initiativeArchetypes.js'
import { useEntityArchetypes } from '../../hooks/useEntityArchetypes.js'
import { scopedPath } from '../../utils/routes.js'
import {
getInitiativeFieldDefinitions,
getInitiativeFields,
@@ -74,9 +79,21 @@ function formatFieldValue(definition, value) {
function PlanProfileInner() {
const ops = useInitiativeOperations()
const { refreshInitiativeMeta } = useProgramScope()
const { initiative, loading, error, capabilities, formBusy } = ops
const { initiativeArchetypes } = useEntityArchetypes()
const {
initiative,
loading,
error,
capabilities,
formBusy,
steeringSnapshot,
steeringMethods,
methodBusy,
handleMethodProfileChange,
actors,
projects,
} = ops
const [editing, setEditing] = useState(false)
const canManage = capabilities.has('kairo.initiative.manage')
if (loading) {
@@ -87,6 +104,11 @@ function PlanProfileInner() {
return <p className="muted">Vorhaben nicht gefunden.</p>
}
const ownerName =
actors.find((actor) => actor.id === initiative.owner_actor_id)?.name ||
initiative.owner_actor_id ||
'—'
async function handleSave(payload) {
const ok = await ops.handleUpdateInitiative(payload)
if (ok) {
@@ -115,9 +137,40 @@ function PlanProfileInner() {
</div>
</header>
{error && <p className="error">{error}</p>}
<InitiativeSteeringMeta
archetypeKey={initiative.archetype_key}
initiativeArchetypes={initiativeArchetypes}
steeringSnapshot={steeringSnapshot}
steeringMethods={steeringMethods}
/>
{canManage && (
<div className="plan-profile__steering-edit">
<MethodProfileSelect
archetypeKey={initiative.archetype_key}
value={steeringSnapshot?.method_profile_key || ''}
disabled={methodBusy}
onChange={handleMethodProfileChange}
/>
</div>
)}
<div className="plan-profile__field">
<h3 className="plan-profile__label">Archetyp</h3>
<p>{initiativeArchetypeLabel(initiative.archetype_key)}</p>
<h3 className="plan-profile__label">Verantwortlich (Owner)</h3>
<p>{ownerName}</p>
</div>
<div className="plan-profile__field">
<h3 className="plan-profile__label">Struktur</h3>
<p>
{projects.length} Projekt{projects.length === 1 ? '' : 'e'} ·{' '}
<Link to={scopedPath('/plan/structure', { initiativeId: initiative.id })}>
Struktur pflegen
</Link>
</p>
</div>
<div className="plan-profile__field">
<h3 className="plan-profile__label">Priorität</h3>
<p>
<PriorityBadge priority={initiative.priority} />
</p>
</div>
{initiative.goal ? (
<div className="plan-profile__field">
@@ -3,10 +3,13 @@ import { ScopedInitiativeProvider } from '../../layout/ScopedInitiativeProvider.
import { ProjectsSection } from '../../components/ProjectsSection.jsx'
import { LoadingState } from '../../components/LoadingState.jsx'
import { useInitiativeOperations } from '../../context/InitiativeOperationsContext.jsx'
import { useEntityArchetypes } from '../../hooks/useEntityArchetypes.js'
function PlanStructureInner() {
const ops = useInitiativeOperations()
const { initiativeArchetypes, projectArchetypes } = useEntityArchetypes()
const {
initiative,
initiativeId,
projects,
roadmapItems,
@@ -35,6 +38,9 @@ function PlanStructureInner() {
onDelete={ops.handleDeleteProject}
onReorder={ops.handleReorderProjects}
busy={ops.formBusy}
initiativeArchetypeKey={initiative?.archetype_key}
initiativeArchetypes={initiativeArchetypes}
projectArchetypes={projectArchetypes}
/>
</>
)