AP1.2c: IA-Skeleton — Workspace-Portfolio, Initiative-Übersicht, Unterseiten
Deploy Development / deploy (push) Successful in 46s
Test Suite / pytest-backend (push) Successful in 1m26s
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 17s
Test Suite / playwright-smoke (push) Successful in 12s
Deploy Development / deploy (push) Successful in 46s
Test Suite / pytest-backend (push) Successful in 1m26s
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 17s
Test Suite / playwright-smoke (push) Successful in 12s
Neue Navigation: Steuerung/Plan/Ausführung/Eingang/Journey. InitiativeOperationsContext, Action-Detail-Route, NextActionWidget portfolio/initiative, Portfolio-Widget auf Workspace. Omnibus InitiativeDetail entfernt. Version 0.12.0-ap1.2c.
This commit is contained in:
1 parent
2796965aed
commit
687aad6cbd
23 files changed
+1171
-265
No files matched your search
@@ -0,0 +1,241 @@
|
||||
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 { 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 { ErrorState } from '../components/ErrorState.jsx'
|
||||
import { LoadingState } from '../components/LoadingState.jsx'
|
||||
import { useInitiativeOperations } from '../context/InitiativeOperationsContext.jsx'
|
||||
import { useCapabilities } from '../hooks/useCapabilities.js'
|
||||
import { useActors } from '../hooks/useActors.js'
|
||||
|
||||
function ActionDetailBody({
|
||||
action,
|
||||
context,
|
||||
editing,
|
||||
onEdit,
|
||||
onCancelEdit,
|
||||
onSubmit,
|
||||
onQuickStatus,
|
||||
onCreateBlocker,
|
||||
formBusy,
|
||||
capabilities,
|
||||
actorsState,
|
||||
}) {
|
||||
if (editing) {
|
||||
return (
|
||||
<ActionForm
|
||||
initial={action}
|
||||
actors={actorsState.actors}
|
||||
actorsLoading={actorsState.loading}
|
||||
actorsError={actorsState.error}
|
||||
actorsUsedFallback={actorsState.usedFallback}
|
||||
onReloadActors={actorsState.reload}
|
||||
onSubmit={onSubmit}
|
||||
onCancel={onCancelEdit}
|
||||
busy={formBusy}
|
||||
submitLabel="Speichern"
|
||||
/>
|
||||
)
|
||||
}
|
||||
|
||||
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
|
||||
/>
|
||||
)
|
||||
}
|
||||
|
||||
function ActionDetailStandalone() {
|
||||
const { actionId } = useParams()
|
||||
const { capabilities } = useCapabilities()
|
||||
const actorsState = useActors()
|
||||
const [action, setAction] = useState(null)
|
||||
const [context, setContext] = useState(null)
|
||||
const [loading, setLoading] = useState(true)
|
||||
const [error, setError] = useState(null)
|
||||
const [editing, setEditing] = useState(false)
|
||||
const [formBusy, setFormBusy] = useState(false)
|
||||
|
||||
const load = useCallback(async () => {
|
||||
setLoading(true)
|
||||
setError(null)
|
||||
try {
|
||||
const actionData = await getAction(actionId)
|
||||
setAction(actionData)
|
||||
const snap = await getInitiativeSteeringSnapshot(actionData.initiative_id)
|
||||
setContext((snap.actions || []).find((a) => a.id === actionId) || null)
|
||||
} catch (err) {
|
||||
setError(err.message)
|
||||
} finally {
|
||||
setLoading(false)
|
||||
}
|
||||
}, [actionId])
|
||||
|
||||
useEffect(() => {
|
||||
load()
|
||||
}, [load])
|
||||
|
||||
async function handleSubmit(payload) {
|
||||
setFormBusy(true)
|
||||
try {
|
||||
await updateAction(action.id, {
|
||||
title: payload.title,
|
||||
description: payload.description,
|
||||
status: payload.status,
|
||||
priority: payload.priority,
|
||||
due_at: payload.due_at,
|
||||
clear_due_at: !payload.due_at,
|
||||
})
|
||||
if (capabilities.has('kairo.action.manage')) {
|
||||
await setActionAssignments(action.id, payload.assigned_actor_ids || [])
|
||||
}
|
||||
setEditing(false)
|
||||
await load()
|
||||
} catch (err) {
|
||||
setError(err.message)
|
||||
} finally {
|
||||
setFormBusy(false)
|
||||
}
|
||||
}
|
||||
|
||||
async function handleQuickStatus(status) {
|
||||
if (!capabilities.has('kairo.action.manage')) return
|
||||
try {
|
||||
await updateAction(action.id, { status })
|
||||
await load()
|
||||
} catch (err) {
|
||||
setError(err.message)
|
||||
}
|
||||
}
|
||||
|
||||
async function handleCreateBlocker() {
|
||||
if (!capabilities.has('kairo.blocker.manage')) return
|
||||
setFormBusy(true)
|
||||
try {
|
||||
await createInitiativeBlocker(action.initiative_id, {
|
||||
title: 'Blocker',
|
||||
action_id: action.id,
|
||||
set_action_blocked: true,
|
||||
})
|
||||
await load()
|
||||
} catch (err) {
|
||||
setError(err.message)
|
||||
} finally {
|
||||
setFormBusy(false)
|
||||
}
|
||||
}
|
||||
|
||||
if (loading) {
|
||||
return (
|
||||
<div className="app-page">
|
||||
<LoadingState message="Lade Arbeitspaket …" />
|
||||
</div>
|
||||
)
|
||||
}
|
||||
|
||||
if (error || !action) {
|
||||
return (
|
||||
<div className="app-page">
|
||||
<ErrorState message={error || 'Arbeitspaket nicht gefunden.'} onRetry={load} />
|
||||
</div>
|
||||
)
|
||||
}
|
||||
|
||||
return (
|
||||
<div className="app-page">
|
||||
<nav className="breadcrumb">
|
||||
<Link to="/workspace">Workspace</Link>
|
||||
<span aria-hidden="true"> / </span>
|
||||
<Link to={`/initiatives/${action.initiative_id}`}>Vorhaben</Link>
|
||||
<span aria-hidden="true"> / </span>
|
||||
<Link to={`/initiatives/${action.initiative_id}/execution`}>Ausführung</Link>
|
||||
<span aria-hidden="true"> / </span>
|
||||
<span>{action.title}</span>
|
||||
</nav>
|
||||
<section className="card action-detail-page">
|
||||
<header className="section-header">
|
||||
<h2>Arbeitspaket</h2>
|
||||
</header>
|
||||
<ActionDetailBody
|
||||
action={action}
|
||||
context={context}
|
||||
editing={editing}
|
||||
onEdit={() => setEditing(true)}
|
||||
onCancelEdit={() => setEditing(false)}
|
||||
onSubmit={handleSubmit}
|
||||
onQuickStatus={handleQuickStatus}
|
||||
onCreateBlocker={handleCreateBlocker}
|
||||
formBusy={formBusy}
|
||||
capabilities={capabilities}
|
||||
actorsState={actorsState}
|
||||
/>
|
||||
</section>
|
||||
</div>
|
||||
)
|
||||
}
|
||||
|
||||
function ActionDetailNested() {
|
||||
const { actionId } = useParams()
|
||||
const ops = useInitiativeOperations()
|
||||
const action = ops.actions.find((a) => a.id === actionId)
|
||||
const context = ops.actionContextById[actionId]
|
||||
const [editing, setEditing] = useState(false)
|
||||
|
||||
if (!action) {
|
||||
return <ErrorState message="Arbeitspaket nicht in diesem Vorhaben." onRetry={ops.reload} />
|
||||
}
|
||||
|
||||
return (
|
||||
<section className="card action-detail-page">
|
||||
<header className="section-header">
|
||||
<h2>Arbeitspaket</h2>
|
||||
</header>
|
||||
<ActionDetailBody
|
||||
action={action}
|
||||
context={context}
|
||||
editing={editing}
|
||||
onEdit={() => setEditing(true)}
|
||||
onCancelEdit={() => setEditing(false)}
|
||||
onSubmit={(payload) => ops.handleUpdateAction(action.id, payload)}
|
||||
onQuickStatus={(status) => ops.handleQuickStatus(action, status)}
|
||||
onCreateBlocker={() => ops.handleCreateBlockerForAction(action.id)}
|
||||
formBusy={ops.formBusy}
|
||||
capabilities={ops.capabilities}
|
||||
actorsState={{
|
||||
actors: ops.actors,
|
||||
loading: ops.actorsLoading,
|
||||
error: ops.actorsError,
|
||||
usedFallback: ops.actorsUsedFallback,
|
||||
reload: ops.reloadActors,
|
||||
}}
|
||||
/>
|
||||
</section>
|
||||
)
|
||||
}
|
||||
|
||||
export function ActionDetailPage({ nested = false }) {
|
||||
if (nested) {
|
||||
return <ActionDetailNested />
|
||||
}
|
||||
return <ActionDetailStandalone />
|
||||
}
|
||||
@@ -1,637 +0,0 @@
|
||||
import { useCallback, useEffect, useState } from 'react'
|
||||
import { Link, useParams } from 'react-router-dom'
|
||||
import {
|
||||
getInitiative,
|
||||
getInitiativeSteeringSnapshot,
|
||||
listInitiativeActions,
|
||||
createInitiativeAction,
|
||||
} from '../api/initiatives.js'
|
||||
import { updateAction, setActionAssignments } from '../api/actions.js'
|
||||
import {
|
||||
listInitiativeBlockers,
|
||||
createInitiativeBlocker,
|
||||
updateBlocker,
|
||||
deleteBlocker,
|
||||
} from '../api/blockers.js'
|
||||
import {
|
||||
listInitiativeBacklog,
|
||||
createInitiativeBacklogItem,
|
||||
updateBacklogItem,
|
||||
deleteBacklogItem,
|
||||
convertBacklogToAction,
|
||||
} from '../api/backlog.js'
|
||||
import {
|
||||
listInitiativeMilestones,
|
||||
createInitiativeMilestone,
|
||||
updateMilestone,
|
||||
deleteMilestone,
|
||||
} from '../api/milestones.js'
|
||||
import {
|
||||
listInitiativeEvidence,
|
||||
createInitiativeEvidence,
|
||||
updateEvidence,
|
||||
deleteEvidence,
|
||||
} from '../api/evidence.js'
|
||||
import {
|
||||
listInitiativeDecisions,
|
||||
createInitiativeDecision,
|
||||
updateDecision,
|
||||
deleteDecision,
|
||||
} from '../api/decisions.js'
|
||||
import {
|
||||
listInitiativeReviews,
|
||||
createInitiativeReview,
|
||||
updateReview,
|
||||
deleteReview,
|
||||
} from '../api/reviews.js'
|
||||
import {
|
||||
listInitiativeRecurring,
|
||||
createInitiativeRecurring,
|
||||
updateRecurring,
|
||||
deleteRecurring,
|
||||
} from '../api/recurring.js'
|
||||
import { StatusBadge } from '../components/StatusBadge.jsx'
|
||||
import { PriorityBadge } from '../components/PriorityBadge.jsx'
|
||||
import { BlockersSection } from '../components/BlockersSection.jsx'
|
||||
import { BacklogSection } from '../components/BacklogSection.jsx'
|
||||
import { MilestonesSection } from '../components/MilestonesSection.jsx'
|
||||
import { EvidenceSection } from '../components/EvidenceSection.jsx'
|
||||
import { DecisionsSection } from '../components/DecisionsSection.jsx'
|
||||
import { ReviewsSection } from '../components/ReviewsSection.jsx'
|
||||
import { RecurringSection } from '../components/RecurringSection.jsx'
|
||||
import { SteeringSnapshotPanel } from '../components/SteeringSnapshotPanel.jsx'
|
||||
import { InitiativeActionsHub } from '../components/InitiativeActionsHub.jsx'
|
||||
import { CollapsibleSection } from '../components/CollapsibleSection.jsx'
|
||||
import { listSteeringMethods, updateInitiativeSteeringMethod } from '../api/steering.js'
|
||||
import { ErrorState } from '../components/ErrorState.jsx'
|
||||
import { LoadingState } from '../components/LoadingState.jsx'
|
||||
import { useCapabilities } from '../hooks/useCapabilities.js'
|
||||
import { useActors } from '../hooks/useActors.js'
|
||||
import { useSession } from '../context/SessionContext.jsx'
|
||||
|
||||
export function InitiativeDetailPage() {
|
||||
const { id } = useParams()
|
||||
const { context, loading: sessionLoading } = useSession()
|
||||
const { capabilities } = useCapabilities()
|
||||
const {
|
||||
actors,
|
||||
loading: actorsLoading,
|
||||
error: actorsError,
|
||||
usedFallback: actorsUsedFallback,
|
||||
reload: reloadActors,
|
||||
} = useActors()
|
||||
|
||||
const [initiative, setInitiative] = useState(null)
|
||||
const [actions, setActions] = useState([])
|
||||
const [blockers, setBlockers] = useState([])
|
||||
const [backlogItems, setBacklogItems] = useState([])
|
||||
const [milestones, setMilestones] = useState([])
|
||||
const [evidenceItems, setEvidenceItems] = useState([])
|
||||
const [decisions, setDecisions] = useState([])
|
||||
const [reviews, setReviews] = useState([])
|
||||
const [recurringItems, setRecurringItems] = useState([])
|
||||
const [steeringSnapshot, setSteeringSnapshot] = useState(null)
|
||||
const [steeringSnapshotLoading, setSteeringSnapshotLoading] = useState(false)
|
||||
const [steeringSnapshotError, setSteeringSnapshotError] = useState(null)
|
||||
const [steeringMethods, setSteeringMethods] = useState([])
|
||||
const [methodBusy, setMethodBusy] = useState(false)
|
||||
const [loading, setLoading] = useState(true)
|
||||
const [error, setError] = useState(null)
|
||||
const [showActionForm, setShowActionForm] = useState(false)
|
||||
const [editingAction, setEditingAction] = useState(null)
|
||||
const [formBusy, setFormBusy] = useState(false)
|
||||
const [hideDone, setHideDone] = useState(true)
|
||||
|
||||
const load = useCallback(async () => {
|
||||
if (sessionLoading) return
|
||||
setLoading(true)
|
||||
setError(null)
|
||||
try {
|
||||
const [initData, actionData] = await Promise.all([
|
||||
getInitiative(id),
|
||||
listInitiativeActions(id),
|
||||
])
|
||||
setInitiative(initData)
|
||||
setActions(actionData)
|
||||
|
||||
const loads = []
|
||||
const canReadOm =
|
||||
capabilities.has('kairo.initiative.read') ||
|
||||
capabilities.has('kairo.blocker.read')
|
||||
if (canReadOm) {
|
||||
loads.push(listInitiativeBlockers(id).then(setBlockers).catch(() => setBlockers([])))
|
||||
loads.push(listInitiativeBacklog(id).then(setBacklogItems).catch(() => setBacklogItems([])))
|
||||
loads.push(listInitiativeMilestones(id).then(setMilestones).catch(() => setMilestones([])))
|
||||
loads.push(listInitiativeEvidence(id).then(setEvidenceItems).catch(() => setEvidenceItems([])))
|
||||
loads.push(listInitiativeDecisions(id).then(setDecisions).catch(() => setDecisions([])))
|
||||
loads.push(listInitiativeReviews(id).then(setReviews).catch(() => setReviews([])))
|
||||
loads.push(listInitiativeRecurring(id).then(setRecurringItems).catch(() => setRecurringItems([])))
|
||||
loads.push(
|
||||
listSteeringMethods().then(setSteeringMethods).catch(() => setSteeringMethods([]))
|
||||
)
|
||||
loads.push(
|
||||
(async () => {
|
||||
setSteeringSnapshotLoading(true)
|
||||
setSteeringSnapshotError(null)
|
||||
try {
|
||||
setSteeringSnapshot(await getInitiativeSteeringSnapshot(id))
|
||||
} catch (err) {
|
||||
setSteeringSnapshot(null)
|
||||
setSteeringSnapshotError(err.message || 'Snapshot fehlgeschlagen')
|
||||
} finally {
|
||||
setSteeringSnapshotLoading(false)
|
||||
}
|
||||
})()
|
||||
)
|
||||
}
|
||||
await Promise.all(loads)
|
||||
} catch (err) {
|
||||
setError(err.message)
|
||||
} finally {
|
||||
setLoading(false)
|
||||
}
|
||||
}, [id, capabilities, sessionLoading])
|
||||
|
||||
useEffect(() => {
|
||||
load()
|
||||
}, [load])
|
||||
|
||||
const visibleActions = hideDone
|
||||
? actions.filter((a) => a.status !== 'done' && a.status !== 'discarded')
|
||||
: actions
|
||||
|
||||
const actionContextById = Object.fromEntries(
|
||||
(steeringSnapshot?.actions || []).map((a) => [a.id, a])
|
||||
)
|
||||
|
||||
const unlinkedBlockers = blockers.filter((b) => !b.action_id)
|
||||
|
||||
const advancedSummary = (() => {
|
||||
const c = steeringSnapshot?.counts
|
||||
const parts = []
|
||||
if (backlogItems.length) parts.push(`${backlogItems.length} Backlog`)
|
||||
if (decisions.length) parts.push(`${decisions.length} Entscheidungen`)
|
||||
if (recurringItems.length) parts.push(`${recurringItems.length} Wiederkehrend`)
|
||||
if (unlinkedBlockers.length) parts.push(`${unlinkedBlockers.length} lose Blocker`)
|
||||
if (c?.unlinked_evidence) parts.push(`${c.unlinked_evidence} lose Nachweise`)
|
||||
if (reviews.length) parts.push(`${reviews.length} Reviews`)
|
||||
return parts.length ? parts.join(' · ') : 'Backlog, Entscheidungen, Nachweise …'
|
||||
})()
|
||||
|
||||
async function handleMethodChange(methodKey) {
|
||||
setMethodBusy(true)
|
||||
try {
|
||||
await updateInitiativeSteeringMethod(id, methodKey)
|
||||
setSteeringSnapshot(await getInitiativeSteeringSnapshot(id))
|
||||
} catch (err) {
|
||||
setSteeringSnapshotError(err.message)
|
||||
} finally {
|
||||
setMethodBusy(false)
|
||||
}
|
||||
}
|
||||
|
||||
async function handleCreateAction(payload) {
|
||||
setFormBusy(true)
|
||||
try {
|
||||
const assigned =
|
||||
payload.assigned_actor_ids?.length > 0
|
||||
? payload.assigned_actor_ids
|
||||
: context?.actor?.id
|
||||
? [context.actor.id]
|
||||
: []
|
||||
await createInitiativeAction(id, { ...payload, assigned_actor_ids: assigned })
|
||||
setShowActionForm(false)
|
||||
await load()
|
||||
} catch (err) {
|
||||
setError(err.message)
|
||||
} finally {
|
||||
setFormBusy(false)
|
||||
}
|
||||
}
|
||||
|
||||
async function handleUpdateAction(actionId, payload) {
|
||||
setFormBusy(true)
|
||||
try {
|
||||
await updateAction(actionId, {
|
||||
title: payload.title,
|
||||
description: payload.description,
|
||||
status: payload.status,
|
||||
priority: payload.priority,
|
||||
due_at: payload.due_at,
|
||||
clear_due_at: !payload.due_at,
|
||||
})
|
||||
if (capabilities.has('kairo.action.manage')) {
|
||||
await setActionAssignments(actionId, payload.assigned_actor_ids || [])
|
||||
}
|
||||
setEditingAction(null)
|
||||
await load()
|
||||
} catch (err) {
|
||||
setError(err.message)
|
||||
} finally {
|
||||
setFormBusy(false)
|
||||
}
|
||||
}
|
||||
|
||||
async function handleQuickStatus(action, status) {
|
||||
if (!capabilities.has('kairo.action.manage')) return
|
||||
try {
|
||||
await updateAction(action.id, { status })
|
||||
await load()
|
||||
} catch (err) {
|
||||
setError(err.message)
|
||||
}
|
||||
}
|
||||
|
||||
async function handleCreateBlocker(body) {
|
||||
setFormBusy(true)
|
||||
try {
|
||||
await createInitiativeBlocker(id, body)
|
||||
await load()
|
||||
} catch (err) {
|
||||
setError(err.message)
|
||||
} finally {
|
||||
setFormBusy(false)
|
||||
}
|
||||
}
|
||||
|
||||
async function handleCreateBlockerForAction(actionId) {
|
||||
if (!capabilities.has('kairo.blocker.manage')) return
|
||||
setFormBusy(true)
|
||||
try {
|
||||
await createInitiativeBlocker(id, {
|
||||
title: 'Blocker',
|
||||
action_id: actionId,
|
||||
set_action_blocked: true,
|
||||
})
|
||||
await load()
|
||||
} catch (err) {
|
||||
setError(err.message)
|
||||
} finally {
|
||||
setFormBusy(false)
|
||||
}
|
||||
}
|
||||
|
||||
async function handleBlockerStatus(blockerId, status) {
|
||||
try {
|
||||
await updateBlocker(blockerId, { status })
|
||||
await load()
|
||||
} catch (err) {
|
||||
setError(err.message)
|
||||
}
|
||||
}
|
||||
|
||||
async function handleDeleteBlocker(blockerId) {
|
||||
try {
|
||||
await deleteBlocker(blockerId)
|
||||
await load()
|
||||
} catch (err) {
|
||||
setError(err.message)
|
||||
}
|
||||
}
|
||||
|
||||
async function handleCreateBacklog(body) {
|
||||
setFormBusy(true)
|
||||
try {
|
||||
await createInitiativeBacklogItem(id, body)
|
||||
await load()
|
||||
} catch (err) {
|
||||
setError(err.message)
|
||||
} finally {
|
||||
setFormBusy(false)
|
||||
}
|
||||
}
|
||||
|
||||
async function handleBacklogStatus(itemId, status) {
|
||||
try {
|
||||
await updateBacklogItem(itemId, { status })
|
||||
await load()
|
||||
} catch (err) {
|
||||
setError(err.message)
|
||||
}
|
||||
}
|
||||
|
||||
async function handleConvertBacklog(itemId) {
|
||||
setFormBusy(true)
|
||||
try {
|
||||
await convertBacklogToAction(itemId)
|
||||
await load()
|
||||
} catch (err) {
|
||||
setError(err.message)
|
||||
} finally {
|
||||
setFormBusy(false)
|
||||
}
|
||||
}
|
||||
|
||||
async function handleDeleteBacklog(itemId) {
|
||||
try {
|
||||
await deleteBacklogItem(itemId)
|
||||
await load()
|
||||
} catch (err) {
|
||||
setError(err.message)
|
||||
}
|
||||
}
|
||||
|
||||
async function handleCreateMilestone(body) {
|
||||
setFormBusy(true)
|
||||
try {
|
||||
await createInitiativeMilestone(id, body)
|
||||
await load()
|
||||
} catch (err) {
|
||||
setError(err.message)
|
||||
} finally {
|
||||
setFormBusy(false)
|
||||
}
|
||||
}
|
||||
|
||||
async function handleMilestoneStatus(milestoneId, status) {
|
||||
try {
|
||||
await updateMilestone(milestoneId, { status })
|
||||
await load()
|
||||
} catch (err) {
|
||||
setError(err.message)
|
||||
}
|
||||
}
|
||||
|
||||
async function handleDeleteMilestone(milestoneId) {
|
||||
try {
|
||||
await deleteMilestone(milestoneId)
|
||||
await load()
|
||||
} catch (err) {
|
||||
setError(err.message)
|
||||
}
|
||||
}
|
||||
|
||||
async function handleCreateEvidence(body) {
|
||||
setFormBusy(true)
|
||||
try {
|
||||
await createInitiativeEvidence(id, body)
|
||||
await load()
|
||||
} catch (err) {
|
||||
setError(err.message)
|
||||
} finally {
|
||||
setFormBusy(false)
|
||||
}
|
||||
}
|
||||
|
||||
async function handleEvidenceStatus(evidenceId, status) {
|
||||
try {
|
||||
await updateEvidence(evidenceId, { status })
|
||||
await load()
|
||||
} catch (err) {
|
||||
setError(err.message)
|
||||
}
|
||||
}
|
||||
|
||||
async function handleDeleteEvidence(evidenceId) {
|
||||
try {
|
||||
await deleteEvidence(evidenceId)
|
||||
await load()
|
||||
} catch (err) {
|
||||
setError(err.message)
|
||||
}
|
||||
}
|
||||
|
||||
async function handleCreateDecision(body) {
|
||||
setFormBusy(true)
|
||||
try {
|
||||
await createInitiativeDecision(id, body)
|
||||
await load()
|
||||
} catch (err) {
|
||||
setError(err.message)
|
||||
} finally {
|
||||
setFormBusy(false)
|
||||
}
|
||||
}
|
||||
|
||||
async function handleDecisionStatus(decisionId, status) {
|
||||
try {
|
||||
await updateDecision(decisionId, { status })
|
||||
await load()
|
||||
} catch (err) {
|
||||
setError(err.message)
|
||||
}
|
||||
}
|
||||
|
||||
async function handleDeleteDecision(decisionId) {
|
||||
try {
|
||||
await deleteDecision(decisionId)
|
||||
await load()
|
||||
} catch (err) {
|
||||
setError(err.message)
|
||||
}
|
||||
}
|
||||
|
||||
async function handleCreateReview(body) {
|
||||
setFormBusy(true)
|
||||
try {
|
||||
await createInitiativeReview(id, body)
|
||||
await load()
|
||||
} catch (err) {
|
||||
setError(err.message)
|
||||
} finally {
|
||||
setFormBusy(false)
|
||||
}
|
||||
}
|
||||
|
||||
async function handleReviewStatus(reviewId, status) {
|
||||
try {
|
||||
await updateReview(reviewId, { status })
|
||||
await load()
|
||||
} catch (err) {
|
||||
setError(err.message)
|
||||
}
|
||||
}
|
||||
|
||||
async function handleDeleteReview(reviewId) {
|
||||
try {
|
||||
await deleteReview(reviewId)
|
||||
await load()
|
||||
} catch (err) {
|
||||
setError(err.message)
|
||||
}
|
||||
}
|
||||
|
||||
async function handleCreateRecurring(body) {
|
||||
setFormBusy(true)
|
||||
try {
|
||||
await createInitiativeRecurring(id, body)
|
||||
await load()
|
||||
} catch (err) {
|
||||
setError(err.message)
|
||||
} finally {
|
||||
setFormBusy(false)
|
||||
}
|
||||
}
|
||||
|
||||
async function handleRecurringStatus(recurringId, status) {
|
||||
try {
|
||||
await updateRecurring(recurringId, { status })
|
||||
await load()
|
||||
} catch (err) {
|
||||
setError(err.message)
|
||||
}
|
||||
}
|
||||
|
||||
async function handleDeleteRecurring(recurringId) {
|
||||
try {
|
||||
await deleteRecurring(recurringId)
|
||||
await load()
|
||||
} catch (err) {
|
||||
setError(err.message)
|
||||
}
|
||||
}
|
||||
|
||||
if (loading) {
|
||||
return (
|
||||
<div className="app-page">
|
||||
<LoadingState message="Lade Vorhaben …" />
|
||||
</div>
|
||||
)
|
||||
}
|
||||
if (error && !initiative) {
|
||||
return (
|
||||
<div className="app-page">
|
||||
<ErrorState message={error} onRetry={load} />
|
||||
</div>
|
||||
)
|
||||
}
|
||||
if (!initiative) {
|
||||
return (
|
||||
<div className="app-page">
|
||||
<ErrorState message="Vorhaben nicht gefunden." />
|
||||
</div>
|
||||
)
|
||||
}
|
||||
|
||||
return (
|
||||
<div className="app-page">
|
||||
<nav className="breadcrumb">
|
||||
<Link to="/initiatives">Vorhaben</Link>
|
||||
<span aria-hidden="true"> / </span>
|
||||
<span>{initiative.title}</span>
|
||||
</nav>
|
||||
|
||||
<header className="page-header detail-header">
|
||||
<div>
|
||||
<h1>{initiative.title}</h1>
|
||||
{initiative.goal && <p className="detail-goal">{initiative.goal}</p>}
|
||||
<div className="detail-badges">
|
||||
<StatusBadge kind="initiative" status={initiative.status} />
|
||||
<PriorityBadge priority={initiative.priority} />
|
||||
</div>
|
||||
</div>
|
||||
</header>
|
||||
|
||||
{error && <p className="error">{error}</p>}
|
||||
|
||||
{capabilities.has('kairo.initiative.read') && (
|
||||
<SteeringSnapshotPanel
|
||||
snapshot={steeringSnapshot}
|
||||
loading={steeringSnapshotLoading}
|
||||
error={steeringSnapshotError}
|
||||
methods={steeringMethods}
|
||||
canManageMethod={capabilities.has('kairo.initiative.manage')}
|
||||
onMethodChange={handleMethodChange}
|
||||
methodBusy={methodBusy}
|
||||
/>
|
||||
)}
|
||||
|
||||
<InitiativeActionsHub
|
||||
actions={visibleActions}
|
||||
actionContextById={actionContextById}
|
||||
hideDone={hideDone}
|
||||
onHideDoneChange={setHideDone}
|
||||
showForm={showActionForm}
|
||||
onToggleForm={() => {
|
||||
setShowActionForm((v) => !v)
|
||||
setEditingAction(null)
|
||||
}}
|
||||
editingActionId={editingAction}
|
||||
onEditAction={setEditingAction}
|
||||
onCancelEdit={() => setEditingAction(null)}
|
||||
onCreateAction={handleCreateAction}
|
||||
onUpdateAction={handleUpdateAction}
|
||||
onQuickStatus={handleQuickStatus}
|
||||
onCreateBlockerForAction={handleCreateBlockerForAction}
|
||||
canManage={capabilities.has('kairo.action.manage')}
|
||||
canManageBlocker={capabilities.has('kairo.blocker.manage')}
|
||||
formBusy={formBusy}
|
||||
actors={actors}
|
||||
actorsLoading={actorsLoading}
|
||||
actorsError={actorsError}
|
||||
actorsUsedFallback={actorsUsedFallback}
|
||||
onReloadActors={reloadActors}
|
||||
/>
|
||||
|
||||
{capabilities.has('kairo.initiative.read') && (
|
||||
<MilestonesSection
|
||||
milestones={milestones}
|
||||
canManage={capabilities.has('kairo.milestone.manage')}
|
||||
onCreate={handleCreateMilestone}
|
||||
onUpdateStatus={handleMilestoneStatus}
|
||||
onDelete={handleDeleteMilestone}
|
||||
busy={formBusy}
|
||||
/>
|
||||
)}
|
||||
|
||||
{capabilities.has('kairo.initiative.read') && (
|
||||
<CollapsibleSection title="Erweitert" summary={advancedSummary}>
|
||||
<div className="initiative-advanced-stack">
|
||||
<BacklogSection
|
||||
items={backlogItems}
|
||||
canManage={capabilities.has('kairo.backlog.manage')}
|
||||
onCreate={handleCreateBacklog}
|
||||
onUpdateStatus={handleBacklogStatus}
|
||||
onConvert={handleConvertBacklog}
|
||||
onDelete={handleDeleteBacklog}
|
||||
busy={formBusy}
|
||||
/>
|
||||
<DecisionsSection
|
||||
items={decisions}
|
||||
canManage={capabilities.has('kairo.decision.manage')}
|
||||
onCreate={handleCreateDecision}
|
||||
onUpdateStatus={handleDecisionStatus}
|
||||
onDelete={handleDeleteDecision}
|
||||
busy={formBusy}
|
||||
/>
|
||||
<RecurringSection
|
||||
items={recurringItems}
|
||||
canManage={capabilities.has('kairo.recurring.manage')}
|
||||
onCreate={handleCreateRecurring}
|
||||
onUpdateStatus={handleRecurringStatus}
|
||||
onDelete={handleDeleteRecurring}
|
||||
busy={formBusy}
|
||||
/>
|
||||
<BlockersSection
|
||||
blockers={unlinkedBlockers}
|
||||
heading="Vorhaben-Blocker"
|
||||
lead="Ohne Maßnahmenbezug — verknüpfte Blocker erscheinen am Maßnahmen-Hub."
|
||||
emptyMessage="Keine vorhabenweiten Blocker."
|
||||
canManage={capabilities.has('kairo.blocker.manage')}
|
||||
onCreate={handleCreateBlocker}
|
||||
onUpdateStatus={handleBlockerStatus}
|
||||
onDelete={handleDeleteBlocker}
|
||||
busy={formBusy}
|
||||
/>
|
||||
<EvidenceSection
|
||||
items={evidenceItems}
|
||||
canManage={capabilities.has('kairo.evidence.manage')}
|
||||
onCreate={handleCreateEvidence}
|
||||
onUpdateStatus={handleEvidenceStatus}
|
||||
onDelete={handleDeleteEvidence}
|
||||
busy={formBusy}
|
||||
/>
|
||||
<ReviewsSection
|
||||
items={reviews}
|
||||
canManage={capabilities.has('kairo.review.manage')}
|
||||
onCreate={handleCreateReview}
|
||||
onUpdateStatus={handleReviewStatus}
|
||||
onDelete={handleDeleteReview}
|
||||
busy={formBusy}
|
||||
/>
|
||||
</div>
|
||||
</CollapsibleSection>
|
||||
)}
|
||||
</div>
|
||||
)
|
||||
}
|
||||
@@ -38,7 +38,7 @@ export function WorkspacePage() {
|
||||
<header className="page-header">
|
||||
<div>
|
||||
<h1>Workspace</h1>
|
||||
<p className="page-lead">Was ist dein nächster sinnvoller Schritt?</p>
|
||||
<p className="page-lead">Portfolio-Überblick und nächste Schritte über alle Vorhaben.</p>
|
||||
</div>
|
||||
{hasCapability('kairo.initiative.manage') && (
|
||||
<button
|
||||
|
||||
@@ -0,0 +1,70 @@
|
||||
import { useInitiativeOperations } from '../../context/InitiativeOperationsContext.jsx'
|
||||
import { InitiativeActionsHub } from '../../components/InitiativeActionsHub.jsx'
|
||||
import { BlockersSection } from '../../components/BlockersSection.jsx'
|
||||
|
||||
export function InitiativeExecutionPage() {
|
||||
const ops = useInitiativeOperations()
|
||||
const {
|
||||
visibleActions,
|
||||
actionContextById,
|
||||
hideDone,
|
||||
setHideDone,
|
||||
showActionForm,
|
||||
setShowActionForm,
|
||||
editingAction,
|
||||
setEditingAction,
|
||||
capabilities,
|
||||
formBusy,
|
||||
unlinkedBlockers,
|
||||
initiativeId,
|
||||
error,
|
||||
} = ops
|
||||
|
||||
return (
|
||||
<>
|
||||
{error && <p className="error">{error}</p>}
|
||||
|
||||
<InitiativeActionsHub
|
||||
initiativeId={initiativeId}
|
||||
actions={visibleActions}
|
||||
actionContextById={actionContextById}
|
||||
hideDone={hideDone}
|
||||
onHideDoneChange={setHideDone}
|
||||
showForm={showActionForm}
|
||||
onToggleForm={() => {
|
||||
setShowActionForm((v) => !v)
|
||||
setEditingAction(null)
|
||||
}}
|
||||
editingActionId={editingAction}
|
||||
onEditAction={setEditingAction}
|
||||
onCancelEdit={() => setEditingAction(null)}
|
||||
onCreateAction={ops.handleCreateAction}
|
||||
onUpdateAction={ops.handleUpdateAction}
|
||||
onQuickStatus={ops.handleQuickStatus}
|
||||
onCreateBlockerForAction={ops.handleCreateBlockerForAction}
|
||||
canManage={capabilities.has('kairo.action.manage')}
|
||||
canManageBlocker={capabilities.has('kairo.blocker.manage')}
|
||||
formBusy={formBusy}
|
||||
actors={ops.actors}
|
||||
actorsLoading={ops.actorsLoading}
|
||||
actorsError={ops.actorsError}
|
||||
actorsUsedFallback={ops.actorsUsedFallback}
|
||||
onReloadActors={ops.reloadActors}
|
||||
/>
|
||||
|
||||
{capabilities.has('kairo.initiative.read') && (
|
||||
<BlockersSection
|
||||
blockers={unlinkedBlockers}
|
||||
heading="Vorhaben-Blocker"
|
||||
lead="Ohne Maßnahmenbezug — verknüpfte Blocker erscheinen am Arbeitspaket."
|
||||
emptyMessage="Keine vorhabenweiten Blocker."
|
||||
canManage={capabilities.has('kairo.blocker.manage')}
|
||||
onCreate={ops.handleCreateBlocker}
|
||||
onUpdateStatus={ops.handleBlockerStatus}
|
||||
onDelete={ops.handleDeleteBlocker}
|
||||
busy={formBusy}
|
||||
/>
|
||||
)}
|
||||
</>
|
||||
)
|
||||
}
|
||||
@@ -0,0 +1,34 @@
|
||||
import { useInitiativeOperations } from '../../context/InitiativeOperationsContext.jsx'
|
||||
import { BacklogSection } from '../../components/BacklogSection.jsx'
|
||||
|
||||
export function InitiativeInboxPage() {
|
||||
const {
|
||||
backlogItems,
|
||||
capabilities,
|
||||
formBusy,
|
||||
error,
|
||||
handleCreateBacklog,
|
||||
handleBacklogStatus,
|
||||
handleConvertBacklog,
|
||||
handleDeleteBacklog,
|
||||
} = useInitiativeOperations()
|
||||
|
||||
if (!capabilities.has('kairo.initiative.read')) {
|
||||
return null
|
||||
}
|
||||
|
||||
return (
|
||||
<>
|
||||
{error && <p className="error">{error}</p>}
|
||||
<BacklogSection
|
||||
items={backlogItems}
|
||||
canManage={capabilities.has('kairo.backlog.manage')}
|
||||
onCreate={handleCreateBacklog}
|
||||
onUpdateStatus={handleBacklogStatus}
|
||||
onConvert={handleConvertBacklog}
|
||||
onDelete={handleDeleteBacklog}
|
||||
busy={formBusy}
|
||||
/>
|
||||
</>
|
||||
)
|
||||
}
|
||||
@@ -0,0 +1,57 @@
|
||||
import { useInitiativeOperations } from '../../context/InitiativeOperationsContext.jsx'
|
||||
import { DecisionsSection } from '../../components/DecisionsSection.jsx'
|
||||
import { ReviewsSection } from '../../components/ReviewsSection.jsx'
|
||||
import { RecurringSection } from '../../components/RecurringSection.jsx'
|
||||
import { EvidenceSection } from '../../components/EvidenceSection.jsx'
|
||||
|
||||
export function InitiativeJourneyPage() {
|
||||
const ops = useInitiativeOperations()
|
||||
const { capabilities, error, formBusy } = ops
|
||||
|
||||
if (!capabilities.has('kairo.initiative.read')) {
|
||||
return null
|
||||
}
|
||||
|
||||
return (
|
||||
<>
|
||||
{error && <p className="error">{error}</p>}
|
||||
<p className="section-lead muted initiative-journey-lead">
|
||||
Entscheidungen, Reviews und Nachweise — die Reise-Timeline folgt in AP1.6.
|
||||
</p>
|
||||
<div className="initiative-journey-stack">
|
||||
<DecisionsSection
|
||||
items={ops.decisions}
|
||||
canManage={capabilities.has('kairo.decision.manage')}
|
||||
onCreate={ops.handleCreateDecision}
|
||||
onUpdateStatus={ops.handleDecisionStatus}
|
||||
onDelete={ops.handleDeleteDecision}
|
||||
busy={formBusy}
|
||||
/>
|
||||
<ReviewsSection
|
||||
items={ops.reviews}
|
||||
canManage={capabilities.has('kairo.review.manage')}
|
||||
onCreate={ops.handleCreateReview}
|
||||
onUpdateStatus={ops.handleReviewStatus}
|
||||
onDelete={ops.handleDeleteReview}
|
||||
busy={formBusy}
|
||||
/>
|
||||
<RecurringSection
|
||||
items={ops.recurringItems}
|
||||
canManage={capabilities.has('kairo.recurring.manage')}
|
||||
onCreate={ops.handleCreateRecurring}
|
||||
onUpdateStatus={ops.handleRecurringStatus}
|
||||
onDelete={ops.handleDeleteRecurring}
|
||||
busy={formBusy}
|
||||
/>
|
||||
<EvidenceSection
|
||||
items={ops.evidenceItems}
|
||||
canManage={capabilities.has('kairo.evidence.manage')}
|
||||
onCreate={ops.handleCreateEvidence}
|
||||
onUpdateStatus={ops.handleEvidenceStatus}
|
||||
onDelete={ops.handleDeleteEvidence}
|
||||
busy={formBusy}
|
||||
/>
|
||||
</div>
|
||||
</>
|
||||
)
|
||||
}
|
||||
@@ -0,0 +1,78 @@
|
||||
import { Link } from 'react-router-dom'
|
||||
import { useInitiativeOperations } from '../../context/InitiativeOperationsContext.jsx'
|
||||
import { SteeringSnapshotPanel } from '../../components/SteeringSnapshotPanel.jsx'
|
||||
import { NextActionWidget } from '../../widgets/NextActionWidget.jsx'
|
||||
import { InitiativeNavCards } from '../../components/InitiativeNavCards.jsx'
|
||||
|
||||
export function InitiativeOverviewPage() {
|
||||
const {
|
||||
initiativeId,
|
||||
error,
|
||||
steeringSnapshot,
|
||||
steeringSnapshotLoading,
|
||||
steeringSnapshotError,
|
||||
steeringMethods,
|
||||
methodBusy,
|
||||
capabilities,
|
||||
handleMethodChange,
|
||||
backlogItems,
|
||||
milestones,
|
||||
} = useInitiativeOperations()
|
||||
|
||||
const counts = steeringSnapshot?.counts || {}
|
||||
|
||||
return (
|
||||
<>
|
||||
{error && <p className="error">{error}</p>}
|
||||
|
||||
{capabilities.has('kairo.initiative.read') && (
|
||||
<SteeringSnapshotPanel
|
||||
snapshot={steeringSnapshot}
|
||||
loading={steeringSnapshotLoading}
|
||||
error={steeringSnapshotError}
|
||||
methods={steeringMethods}
|
||||
canManageMethod={capabilities.has('kairo.initiative.manage')}
|
||||
onMethodChange={handleMethodChange}
|
||||
methodBusy={methodBusy}
|
||||
/>
|
||||
)}
|
||||
|
||||
{capabilities.has('kairo.workspace.read') && (
|
||||
<NextActionWidget
|
||||
scope="initiative"
|
||||
initiativeId={initiativeId}
|
||||
items={steeringSnapshot?.next_actions}
|
||||
loading={steeringSnapshotLoading}
|
||||
embedded
|
||||
/>
|
||||
)}
|
||||
|
||||
{(counts.actions_blocked > 0 || counts.blockers_open > 0) && (
|
||||
<section className="card initiative-summary-strip">
|
||||
<h2 className="card-title">Roadblocker</h2>
|
||||
<p className="muted">
|
||||
{counts.actions_blocked > 0 && (
|
||||
<span>{counts.actions_blocked} blockierte Arbeitspakete</span>
|
||||
)}
|
||||
{counts.actions_blocked > 0 && counts.blockers_open > 0 && ' · '}
|
||||
{counts.blockers_open > 0 && (
|
||||
<span>{counts.blockers_open} offene Blocker</span>
|
||||
)}
|
||||
</p>
|
||||
<Link to={`/initiatives/${initiativeId}/execution`} className="btn btn-secondary btn-sm">
|
||||
Zur Ausführung
|
||||
</Link>
|
||||
</section>
|
||||
)}
|
||||
|
||||
<InitiativeNavCards
|
||||
initiativeId={initiativeId}
|
||||
counts={{
|
||||
backlog: backlogItems.length,
|
||||
milestones: milestones.length,
|
||||
actionsOpen: counts.actions_open,
|
||||
}}
|
||||
/>
|
||||
</>
|
||||
)
|
||||
}
|
||||
@@ -0,0 +1,32 @@
|
||||
import { useInitiativeOperations } from '../../context/InitiativeOperationsContext.jsx'
|
||||
import { MilestonesSection } from '../../components/MilestonesSection.jsx'
|
||||
|
||||
export function InitiativePlanPage() {
|
||||
const {
|
||||
milestones,
|
||||
capabilities,
|
||||
formBusy,
|
||||
handleCreateMilestone,
|
||||
handleMilestoneStatus,
|
||||
handleDeleteMilestone,
|
||||
error,
|
||||
} = useInitiativeOperations()
|
||||
|
||||
if (!capabilities.has('kairo.initiative.read')) {
|
||||
return null
|
||||
}
|
||||
|
||||
return (
|
||||
<>
|
||||
{error && <p className="error">{error}</p>}
|
||||
<MilestonesSection
|
||||
milestones={milestones}
|
||||
canManage={capabilities.has('kairo.milestone.manage')}
|
||||
onCreate={handleCreateMilestone}
|
||||
onUpdateStatus={handleMilestoneStatus}
|
||||
onDelete={handleDeleteMilestone}
|
||||
busy={formBusy}
|
||||
/>
|
||||
</>
|
||||
)
|
||||
}
|
||||
Reference in new issue
Block a user