AP0.8: Operating Model Extension I (Attention, Blocker, Backlog, Milestone)
Deploy Development / deploy (push) Successful in 45s
Test Suite / pytest-backend (push) Successful in 58s
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 45s
Test Suite / pytest-backend (push) Successful in 58s
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 007, regelbasierte Attention/NextAction im Data Layer, CRUD fuer Blocker/Backlog/Meilensteine, Workspace-Widget und Initiative-Detail-Sektionen. 25 Capabilities. Tests fuer Remote-Pytest auf Pi angepasst (conftest Session-Guard). Co-authored-by: Cursor <cursoragent@cursor.com>
This commit is contained in:
1 parent
6dd9dd4f62
commit
fe3bc4f057
39 files changed
+4333
-22
No files matched your search
@@ -0,0 +1,9 @@
|
||||
import { apiFetch } from './client.js'
|
||||
|
||||
export function getAttentionItems() {
|
||||
return apiFetch('/api/workspace/attention')
|
||||
}
|
||||
|
||||
export function getNextActionCandidates(limit = 10) {
|
||||
return apiFetch(`/api/workspace/next-actions?limit=${limit}`)
|
||||
}
|
||||
@@ -0,0 +1,30 @@
|
||||
import { apiFetch } from './client.js'
|
||||
|
||||
export function listInitiativeBacklog(initiativeId) {
|
||||
return apiFetch(`/api/initiatives/${initiativeId}/backlog`)
|
||||
}
|
||||
|
||||
export function createInitiativeBacklogItem(initiativeId, body) {
|
||||
return apiFetch(`/api/initiatives/${initiativeId}/backlog`, {
|
||||
method: 'POST',
|
||||
body: JSON.stringify(body),
|
||||
})
|
||||
}
|
||||
|
||||
export function updateBacklogItem(backlogItemId, body) {
|
||||
return apiFetch(`/api/backlog/${backlogItemId}`, {
|
||||
method: 'PATCH',
|
||||
body: JSON.stringify(body),
|
||||
})
|
||||
}
|
||||
|
||||
export function deleteBacklogItem(backlogItemId) {
|
||||
return apiFetch(`/api/backlog/${backlogItemId}`, { method: 'DELETE' })
|
||||
}
|
||||
|
||||
export function convertBacklogToAction(backlogItemId, body = {}) {
|
||||
return apiFetch(`/api/backlog/${backlogItemId}/convert-to-action`, {
|
||||
method: 'POST',
|
||||
body: JSON.stringify(body),
|
||||
})
|
||||
}
|
||||
@@ -0,0 +1,23 @@
|
||||
import { apiFetch } from './client.js'
|
||||
|
||||
export function listInitiativeBlockers(initiativeId) {
|
||||
return apiFetch(`/api/initiatives/${initiativeId}/blockers`)
|
||||
}
|
||||
|
||||
export function createInitiativeBlocker(initiativeId, body) {
|
||||
return apiFetch(`/api/initiatives/${initiativeId}/blockers`, {
|
||||
method: 'POST',
|
||||
body: JSON.stringify(body),
|
||||
})
|
||||
}
|
||||
|
||||
export function updateBlocker(blockerId, body) {
|
||||
return apiFetch(`/api/blockers/${blockerId}`, {
|
||||
method: 'PATCH',
|
||||
body: JSON.stringify(body),
|
||||
})
|
||||
}
|
||||
|
||||
export function deleteBlocker(blockerId) {
|
||||
return apiFetch(`/api/blockers/${blockerId}`, { method: 'DELETE' })
|
||||
}
|
||||
@@ -0,0 +1,23 @@
|
||||
import { apiFetch } from './client.js'
|
||||
|
||||
export function listInitiativeMilestones(initiativeId) {
|
||||
return apiFetch(`/api/initiatives/${initiativeId}/milestones`)
|
||||
}
|
||||
|
||||
export function createInitiativeMilestone(initiativeId, body) {
|
||||
return apiFetch(`/api/initiatives/${initiativeId}/milestones`, {
|
||||
method: 'POST',
|
||||
body: JSON.stringify(body),
|
||||
})
|
||||
}
|
||||
|
||||
export function updateMilestone(milestoneId, body) {
|
||||
return apiFetch(`/api/milestones/${milestoneId}`, {
|
||||
method: 'PATCH',
|
||||
body: JSON.stringify(body),
|
||||
})
|
||||
}
|
||||
|
||||
export function deleteMilestone(milestoneId) {
|
||||
return apiFetch(`/api/milestones/${milestoneId}`, { method: 'DELETE' })
|
||||
}
|
||||
@@ -0,0 +1,115 @@
|
||||
import { useState } from 'react'
|
||||
import {
|
||||
BACKLOG_STATUSES,
|
||||
BACKLOG_STATUS_LABELS,
|
||||
} from '../constants/status.js'
|
||||
import { StatusBadge } from './StatusBadge.jsx'
|
||||
import { PriorityBadge } from './PriorityBadge.jsx'
|
||||
import { EmptyState } from './EmptyState.jsx'
|
||||
|
||||
export function BacklogSection({
|
||||
items,
|
||||
canManage,
|
||||
onCreate,
|
||||
onUpdateStatus,
|
||||
onConvert,
|
||||
onDelete,
|
||||
busy,
|
||||
}) {
|
||||
const [title, setTitle] = useState('')
|
||||
const [showForm, setShowForm] = useState(false)
|
||||
|
||||
async function handleSubmit(e) {
|
||||
e.preventDefault()
|
||||
if (!title.trim()) return
|
||||
await onCreate({ title: title.trim() })
|
||||
setTitle('')
|
||||
setShowForm(false)
|
||||
}
|
||||
|
||||
return (
|
||||
<section className="card">
|
||||
<div className="section-header">
|
||||
<h2>Backlog</h2>
|
||||
{canManage && (
|
||||
<button
|
||||
type="button"
|
||||
className="btn btn-primary btn-block-mobile"
|
||||
onClick={() => setShowForm((v) => !v)}
|
||||
>
|
||||
{showForm ? 'Abbrechen' : 'Backlog-Item'}
|
||||
</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
|
||||
/>
|
||||
</label>
|
||||
<button type="submit" className="btn btn-primary" disabled={busy}>
|
||||
Anlegen
|
||||
</button>
|
||||
</form>
|
||||
)}
|
||||
|
||||
{items.length === 0 && <EmptyState message="Backlog ist leer." />}
|
||||
|
||||
<ul className="item-list">
|
||||
{items.map((item) => (
|
||||
<li key={item.id} className="list-item card-list-item">
|
||||
<div className="list-item-main">
|
||||
<strong>{item.title}</strong>
|
||||
{item.description && (
|
||||
<p className="list-item-desc">{item.description}</p>
|
||||
)}
|
||||
</div>
|
||||
<div className="list-item-meta action-controls">
|
||||
<StatusBadge kind="backlog" status={item.status} />
|
||||
<PriorityBadge priority={item.priority} />
|
||||
{canManage && item.status !== 'converted' && (
|
||||
<>
|
||||
<select
|
||||
className="inline-select"
|
||||
value={item.status}
|
||||
onChange={(e) => onUpdateStatus(item.id, e.target.value)}
|
||||
aria-label="Backlog-Status"
|
||||
>
|
||||
{BACKLOG_STATUSES.filter((s) => s !== 'converted').map((s) => (
|
||||
<option key={s} value={s}>
|
||||
{BACKLOG_STATUS_LABELS[s]}
|
||||
</option>
|
||||
))}
|
||||
</select>
|
||||
{item.status === 'accepted' && (
|
||||
<button
|
||||
type="button"
|
||||
className="btn btn-primary"
|
||||
onClick={() => onConvert(item.id)}
|
||||
disabled={busy}
|
||||
>
|
||||
In Maßnahme umwandeln
|
||||
</button>
|
||||
)}
|
||||
<button
|
||||
type="button"
|
||||
className="btn btn-secondary"
|
||||
onClick={() => onDelete(item.id)}
|
||||
>
|
||||
Löschen
|
||||
</button>
|
||||
</>
|
||||
)}
|
||||
</div>
|
||||
</li>
|
||||
))}
|
||||
</ul>
|
||||
</section>
|
||||
)
|
||||
}
|
||||
@@ -0,0 +1,102 @@
|
||||
import { useState } from 'react'
|
||||
import {
|
||||
BLOCKER_STATUSES,
|
||||
BLOCKER_STATUS_LABELS,
|
||||
} from '../constants/status.js'
|
||||
import { StatusBadge } from './StatusBadge.jsx'
|
||||
import { EmptyState } from './EmptyState.jsx'
|
||||
|
||||
export function BlockersSection({
|
||||
blockers,
|
||||
canManage,
|
||||
onCreate,
|
||||
onUpdateStatus,
|
||||
onDelete,
|
||||
busy,
|
||||
}) {
|
||||
const [title, setTitle] = useState('')
|
||||
const [showForm, setShowForm] = useState(false)
|
||||
|
||||
async function handleSubmit(e) {
|
||||
e.preventDefault()
|
||||
if (!title.trim()) return
|
||||
await onCreate({ title: title.trim() })
|
||||
setTitle('')
|
||||
setShowForm(false)
|
||||
}
|
||||
|
||||
return (
|
||||
<section className="card">
|
||||
<div className="section-header">
|
||||
<h2>Blocker</h2>
|
||||
{canManage && (
|
||||
<button
|
||||
type="button"
|
||||
className="btn btn-primary btn-block-mobile"
|
||||
onClick={() => setShowForm((v) => !v)}
|
||||
>
|
||||
{showForm ? 'Abbrechen' : 'Blocker melden'}
|
||||
</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
|
||||
/>
|
||||
</label>
|
||||
<button type="submit" className="btn btn-primary" disabled={busy}>
|
||||
Anlegen
|
||||
</button>
|
||||
</form>
|
||||
)}
|
||||
|
||||
{blockers.length === 0 && <EmptyState message="Keine Blocker." />}
|
||||
|
||||
<ul className="item-list">
|
||||
{blockers.map((blocker) => (
|
||||
<li key={blocker.id} className="list-item card-list-item">
|
||||
<div className="list-item-main">
|
||||
<strong>{blocker.title}</strong>
|
||||
{blocker.description && (
|
||||
<p className="list-item-desc">{blocker.description}</p>
|
||||
)}
|
||||
</div>
|
||||
<div className="list-item-meta action-controls">
|
||||
<StatusBadge kind="blocker" status={blocker.status} />
|
||||
{canManage && (
|
||||
<>
|
||||
<select
|
||||
className="inline-select"
|
||||
value={blocker.status}
|
||||
onChange={(e) => onUpdateStatus(blocker.id, e.target.value)}
|
||||
aria-label="Blocker-Status"
|
||||
>
|
||||
{BLOCKER_STATUSES.map((s) => (
|
||||
<option key={s} value={s}>
|
||||
{BLOCKER_STATUS_LABELS[s]}
|
||||
</option>
|
||||
))}
|
||||
</select>
|
||||
<button
|
||||
type="button"
|
||||
className="btn btn-secondary"
|
||||
onClick={() => onDelete(blocker.id)}
|
||||
>
|
||||
Löschen
|
||||
</button>
|
||||
</>
|
||||
)}
|
||||
</div>
|
||||
</li>
|
||||
))}
|
||||
</ul>
|
||||
</section>
|
||||
)
|
||||
}
|
||||
@@ -0,0 +1,105 @@
|
||||
import { useState } from 'react'
|
||||
import {
|
||||
MILESTONE_STATUSES,
|
||||
MILESTONE_STATUS_LABELS,
|
||||
} from '../constants/status.js'
|
||||
import { StatusBadge } from './StatusBadge.jsx'
|
||||
import { EmptyState } from './EmptyState.jsx'
|
||||
|
||||
export function MilestonesSection({
|
||||
milestones,
|
||||
canManage,
|
||||
onCreate,
|
||||
onUpdateStatus,
|
||||
onDelete,
|
||||
busy,
|
||||
}) {
|
||||
const [title, setTitle] = useState('')
|
||||
const [showForm, setShowForm] = useState(false)
|
||||
|
||||
async function handleSubmit(e) {
|
||||
e.preventDefault()
|
||||
if (!title.trim()) return
|
||||
await onCreate({ title: title.trim() })
|
||||
setTitle('')
|
||||
setShowForm(false)
|
||||
}
|
||||
|
||||
return (
|
||||
<section className="card">
|
||||
<div className="section-header">
|
||||
<h2>Meilensteine</h2>
|
||||
{canManage && (
|
||||
<button
|
||||
type="button"
|
||||
className="btn btn-primary btn-block-mobile"
|
||||
onClick={() => setShowForm((v) => !v)}
|
||||
>
|
||||
{showForm ? 'Abbrechen' : 'Meilenstein'}
|
||||
</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
|
||||
/>
|
||||
</label>
|
||||
<button type="submit" className="btn btn-primary" disabled={busy}>
|
||||
Anlegen
|
||||
</button>
|
||||
</form>
|
||||
)}
|
||||
|
||||
{milestones.length === 0 && <EmptyState message="Keine Meilensteine." />}
|
||||
|
||||
<ul className="item-list">
|
||||
{milestones.map((milestone) => (
|
||||
<li key={milestone.id} className="list-item card-list-item">
|
||||
<div className="list-item-main">
|
||||
<strong>{milestone.title}</strong>
|
||||
{milestone.goal_description && (
|
||||
<p className="list-item-desc">{milestone.goal_description}</p>
|
||||
)}
|
||||
{milestone.target_date && (
|
||||
<p className="muted list-item-sub">Ziel: {milestone.target_date}</p>
|
||||
)}
|
||||
</div>
|
||||
<div className="list-item-meta action-controls">
|
||||
<StatusBadge kind="milestone" status={milestone.status} />
|
||||
{canManage && (
|
||||
<>
|
||||
<select
|
||||
className="inline-select"
|
||||
value={milestone.status}
|
||||
onChange={(e) => onUpdateStatus(milestone.id, e.target.value)}
|
||||
aria-label="Meilenstein-Status"
|
||||
>
|
||||
{MILESTONE_STATUSES.map((s) => (
|
||||
<option key={s} value={s}>
|
||||
{MILESTONE_STATUS_LABELS[s]}
|
||||
</option>
|
||||
))}
|
||||
</select>
|
||||
<button
|
||||
type="button"
|
||||
className="btn btn-secondary"
|
||||
onClick={() => onDelete(milestone.id)}
|
||||
>
|
||||
Löschen
|
||||
</button>
|
||||
</>
|
||||
)}
|
||||
</div>
|
||||
</li>
|
||||
))}
|
||||
</ul>
|
||||
</section>
|
||||
)
|
||||
}
|
||||
@@ -1,4 +1,4 @@
|
||||
import { INITIATIVE_STATUS_LABELS, ACTION_STATUS_LABELS } from '../constants/status.js'
|
||||
import { STATUS_LABELS_BY_KIND } from '../constants/status.js'
|
||||
|
||||
const VARIANTS = {
|
||||
active: 'status-active',
|
||||
@@ -10,10 +10,22 @@ const VARIANTS = {
|
||||
blocked: 'status-blocked',
|
||||
done: 'status-done',
|
||||
discarded: 'status-discarded',
|
||||
new: 'status-open',
|
||||
triaged: 'status-progress',
|
||||
accepted: 'status-active',
|
||||
rejected: 'status-discarded',
|
||||
converted: 'status-done',
|
||||
planned: 'status-open',
|
||||
at_risk: 'status-blocked',
|
||||
reached: 'status-done',
|
||||
moved: 'status-paused',
|
||||
resolved: 'status-done',
|
||||
accepted_risk: 'status-paused',
|
||||
dismissed: 'status-discarded',
|
||||
}
|
||||
|
||||
export function StatusBadge({ kind = 'action', status }) {
|
||||
const labels = kind === 'initiative' ? INITIATIVE_STATUS_LABELS : ACTION_STATUS_LABELS
|
||||
const labels = STATUS_LABELS_BY_KIND[kind] || STATUS_LABELS_BY_KIND.action
|
||||
const label = labels[status] || status
|
||||
const variant = VARIANTS[status] || 'status-default'
|
||||
return <span className={`badge status-badge ${variant}`}>{label}</span>
|
||||
|
||||
@@ -1,5 +1,8 @@
|
||||
export const INITIATIVE_STATUSES = ['active', 'paused', 'completed', 'archived']
|
||||
export const ACTION_STATUSES = ['open', 'in_progress', 'blocked', 'done', 'discarded']
|
||||
export const BLOCKER_STATUSES = ['open', 'in_progress', 'resolved', 'accepted_risk', 'dismissed']
|
||||
export const BACKLOG_STATUSES = ['new', 'triaged', 'accepted', 'rejected', 'converted']
|
||||
export const MILESTONE_STATUSES = ['planned', 'active', 'at_risk', 'reached', 'moved', 'discarded']
|
||||
export const PRIORITIES = ['low', 'normal', 'high']
|
||||
export const OPEN_ACTION_STATUSES = ['open', 'in_progress', 'blocked']
|
||||
|
||||
@@ -18,8 +21,41 @@ export const ACTION_STATUS_LABELS = {
|
||||
discarded: 'Verworfen',
|
||||
}
|
||||
|
||||
export const BLOCKER_STATUS_LABELS = {
|
||||
open: 'Offen',
|
||||
in_progress: 'In Klärung',
|
||||
resolved: 'Gelöst',
|
||||
accepted_risk: 'Risiko akzeptiert',
|
||||
dismissed: 'Verworfen',
|
||||
}
|
||||
|
||||
export const BACKLOG_STATUS_LABELS = {
|
||||
new: 'Neu',
|
||||
triaged: 'Eingeordnet',
|
||||
accepted: 'Freigegeben',
|
||||
rejected: 'Abgelehnt',
|
||||
converted: 'Umgewandelt',
|
||||
}
|
||||
|
||||
export const MILESTONE_STATUS_LABELS = {
|
||||
planned: 'Geplant',
|
||||
active: 'Aktiv',
|
||||
at_risk: 'Gefährdet',
|
||||
reached: 'Erreicht',
|
||||
moved: 'Verschoben',
|
||||
discarded: 'Verworfen',
|
||||
}
|
||||
|
||||
export const PRIORITY_LABELS = {
|
||||
low: 'Niedrig',
|
||||
normal: 'Normal',
|
||||
high: 'Hoch',
|
||||
}
|
||||
|
||||
export const STATUS_LABELS_BY_KIND = {
|
||||
initiative: INITIATIVE_STATUS_LABELS,
|
||||
action: ACTION_STATUS_LABELS,
|
||||
blocker: BLOCKER_STATUS_LABELS,
|
||||
backlog: BACKLOG_STATUS_LABELS,
|
||||
milestone: MILESTONE_STATUS_LABELS,
|
||||
}
|
||||
@@ -6,10 +6,32 @@ import {
|
||||
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 { ACTION_STATUS_LABELS } from '../constants/status.js'
|
||||
import { StatusBadge } from '../components/StatusBadge.jsx'
|
||||
import { PriorityBadge } from '../components/PriorityBadge.jsx'
|
||||
import { ActionForm } from '../components/ActionForm.jsx'
|
||||
import { BlockersSection } from '../components/BlockersSection.jsx'
|
||||
import { BacklogSection } from '../components/BacklogSection.jsx'
|
||||
import { MilestonesSection } from '../components/MilestonesSection.jsx'
|
||||
import { EmptyState } from '../components/EmptyState.jsx'
|
||||
import { ErrorState } from '../components/ErrorState.jsx'
|
||||
import { LoadingState } from '../components/LoadingState.jsx'
|
||||
@@ -20,7 +42,7 @@ import { useSession } from '../context/SessionContext.jsx'
|
||||
export function InitiativeDetailPage() {
|
||||
const { id } = useParams()
|
||||
const { context } = useSession()
|
||||
const { hasCapability } = useCapabilities()
|
||||
const { capabilities } = useCapabilities()
|
||||
const {
|
||||
actors,
|
||||
loading: actorsLoading,
|
||||
@@ -31,6 +53,9 @@ export function InitiativeDetailPage() {
|
||||
|
||||
const [initiative, setInitiative] = useState(null)
|
||||
const [actions, setActions] = useState([])
|
||||
const [blockers, setBlockers] = useState([])
|
||||
const [backlogItems, setBacklogItems] = useState([])
|
||||
const [milestones, setMilestones] = useState([])
|
||||
const [loading, setLoading] = useState(true)
|
||||
const [error, setError] = useState(null)
|
||||
const [showActionForm, setShowActionForm] = useState(false)
|
||||
@@ -48,12 +73,24 @@ export function InitiativeDetailPage() {
|
||||
])
|
||||
setInitiative(initData)
|
||||
setActions(actionData)
|
||||
|
||||
const loads = []
|
||||
if (capabilities.has('kairo.blocker.read')) {
|
||||
loads.push(listInitiativeBlockers(id).then(setBlockers).catch(() => setBlockers([])))
|
||||
}
|
||||
if (capabilities.has('kairo.backlog.read')) {
|
||||
loads.push(listInitiativeBacklog(id).then(setBacklogItems).catch(() => setBacklogItems([])))
|
||||
}
|
||||
if (capabilities.has('kairo.milestone.read')) {
|
||||
loads.push(listInitiativeMilestones(id).then(setMilestones).catch(() => setMilestones([])))
|
||||
}
|
||||
await Promise.all(loads)
|
||||
} catch (err) {
|
||||
setError(err.message)
|
||||
} finally {
|
||||
setLoading(false)
|
||||
}
|
||||
}, [id])
|
||||
}, [id, capabilities])
|
||||
|
||||
useEffect(() => {
|
||||
load()
|
||||
@@ -91,7 +128,7 @@ export function InitiativeDetailPage() {
|
||||
status: payload.status,
|
||||
priority: payload.priority,
|
||||
})
|
||||
if (hasCapability('kairo.action.manage')) {
|
||||
if (capabilities.has('kairo.action.manage')) {
|
||||
await setActionAssignments(actionId, payload.assigned_actor_ids || [])
|
||||
}
|
||||
setEditingAction(null)
|
||||
@@ -104,7 +141,7 @@ export function InitiativeDetailPage() {
|
||||
}
|
||||
|
||||
async function handleQuickStatus(action, status) {
|
||||
if (!hasCapability('kairo.action.manage')) return
|
||||
if (!capabilities.has('kairo.action.manage')) return
|
||||
try {
|
||||
await updateAction(action.id, { status })
|
||||
await load()
|
||||
@@ -113,6 +150,108 @@ export function InitiativeDetailPage() {
|
||||
}
|
||||
}
|
||||
|
||||
async function handleCreateBlocker(body) {
|
||||
setFormBusy(true)
|
||||
try {
|
||||
await createInitiativeBlocker(id, body)
|
||||
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)
|
||||
}
|
||||
}
|
||||
|
||||
if (loading) {
|
||||
return (
|
||||
<div className="app-page">
|
||||
@@ -168,7 +307,7 @@ export function InitiativeDetailPage() {
|
||||
/>
|
||||
Erledigte ausblenden
|
||||
</label>
|
||||
{hasCapability('kairo.action.manage') && (
|
||||
{capabilities.has('kairo.action.manage') && (
|
||||
<button
|
||||
type="button"
|
||||
className="btn btn-primary btn-block-mobile"
|
||||
@@ -232,7 +371,7 @@ export function InitiativeDetailPage() {
|
||||
<div className="list-item-meta action-controls">
|
||||
<StatusBadge status={action.status} />
|
||||
<PriorityBadge priority={action.priority} />
|
||||
{hasCapability('kairo.action.manage') && (
|
||||
{capabilities.has('kairo.action.manage') && (
|
||||
<>
|
||||
<select
|
||||
className="inline-select"
|
||||
@@ -265,6 +404,40 @@ export function InitiativeDetailPage() {
|
||||
))}
|
||||
</ul>
|
||||
</section>
|
||||
|
||||
{capabilities.has('kairo.milestone.read') && (
|
||||
<MilestonesSection
|
||||
milestones={milestones}
|
||||
canManage={capabilities.has('kairo.milestone.manage')}
|
||||
onCreate={handleCreateMilestone}
|
||||
onUpdateStatus={handleMilestoneStatus}
|
||||
onDelete={handleDeleteMilestone}
|
||||
busy={formBusy}
|
||||
/>
|
||||
)}
|
||||
|
||||
{capabilities.has('kairo.backlog.read') && (
|
||||
<BacklogSection
|
||||
items={backlogItems}
|
||||
canManage={capabilities.has('kairo.backlog.manage')}
|
||||
onCreate={handleCreateBacklog}
|
||||
onUpdateStatus={handleBacklogStatus}
|
||||
onConvert={handleConvertBacklog}
|
||||
onDelete={handleDeleteBacklog}
|
||||
busy={formBusy}
|
||||
/>
|
||||
)}
|
||||
|
||||
{capabilities.has('kairo.blocker.read') && (
|
||||
<BlockersSection
|
||||
blockers={blockers}
|
||||
canManage={capabilities.has('kairo.blocker.manage')}
|
||||
onCreate={handleCreateBlocker}
|
||||
onUpdateStatus={handleBlockerStatus}
|
||||
onDelete={handleDeleteBlocker}
|
||||
busy={formBusy}
|
||||
/>
|
||||
)}
|
||||
</div>
|
||||
)
|
||||
}
|
||||
@@ -11,14 +11,17 @@ describe('widgetRegistry', () => {
|
||||
expect(keys).toContain('kairo.blocked_actions')
|
||||
expect(keys).toContain('kairo.tenant_context')
|
||||
expect(keys).toContain('kairo.workspace_summary')
|
||||
expect(keys).toContain('kairo.attention')
|
||||
})
|
||||
|
||||
it('filters widgets by capability', () => {
|
||||
const all = getWidgetsForArea('workspace', [
|
||||
'kairo.action.read',
|
||||
'kairo.initiative.read',
|
||||
'kairo.workspace.read',
|
||||
'kairo.attention.read',
|
||||
])
|
||||
expect(all.length).toBe(4)
|
||||
expect(all.length).toBe(6)
|
||||
|
||||
const readOnly = getWidgetsForArea('workspace', ['kairo.initiative.read'])
|
||||
expect(readOnly.some((w) => w.key === 'kairo.my_open_actions')).toBe(false)
|
||||
|
||||
@@ -3,6 +3,7 @@ import { InitiativesWidget } from '../widgets/InitiativesWidget.jsx'
|
||||
import { BlockedActionsWidget } from '../widgets/BlockedActionsWidget.jsx'
|
||||
import { TenantContextWidget } from '../widgets/TenantContextWidget.jsx'
|
||||
import { WorkspaceSummaryWidget } from '../widgets/WorkspaceSummaryWidget.jsx'
|
||||
import { AttentionWidget } from '../widgets/AttentionWidget.jsx'
|
||||
|
||||
/** @typedef {import('react').ComponentType<any>} WidgetComponent */
|
||||
|
||||
@@ -36,6 +37,15 @@ export const WIDGETS = [
|
||||
defaultOrder: 5,
|
||||
component: WorkspaceSummaryWidget,
|
||||
},
|
||||
{
|
||||
key: 'kairo.attention',
|
||||
title: 'Aufmerksamkeit',
|
||||
description: 'Regelbasierte Attention-Items',
|
||||
area: 'workspace',
|
||||
requiredCapability: 'kairo.attention.read',
|
||||
defaultOrder: 8,
|
||||
component: AttentionWidget,
|
||||
},
|
||||
{
|
||||
key: 'kairo.my_open_actions',
|
||||
title: 'Meine offenen Maßnahmen',
|
||||
|
||||
@@ -311,6 +311,33 @@
|
||||
padding: 12px;
|
||||
}
|
||||
|
||||
.attention-severity {
|
||||
display: inline-block;
|
||||
font-size: 0.7rem;
|
||||
font-weight: 600;
|
||||
text-transform: uppercase;
|
||||
letter-spacing: 0.04em;
|
||||
margin-bottom: 0.25rem;
|
||||
}
|
||||
|
||||
.attention-severity--critical {
|
||||
color: var(--jk-danger, #c0392b);
|
||||
}
|
||||
|
||||
.attention-severity--warning {
|
||||
color: var(--jk-warning, #d68910);
|
||||
}
|
||||
|
||||
.attention-severity--info {
|
||||
color: var(--jk-text-muted);
|
||||
}
|
||||
|
||||
.attention-list .list-item-main {
|
||||
display: flex;
|
||||
flex-direction: column;
|
||||
gap: 0.15rem;
|
||||
}
|
||||
|
||||
.list-item-main {
|
||||
flex: 1;
|
||||
min-width: 0;
|
||||
|
||||
@@ -0,0 +1,89 @@
|
||||
import { useCallback, useEffect, useState } from 'react'
|
||||
import { Link } from 'react-router-dom'
|
||||
import { getAttentionItems } from '../api/attention.js'
|
||||
import { ErrorState } from '../components/ErrorState.jsx'
|
||||
import { LoadingState } from '../components/LoadingState.jsx'
|
||||
import { WidgetCard } from '../components/WidgetCard.jsx'
|
||||
import { EmptyState } from '../components/EmptyState.jsx'
|
||||
|
||||
const SEVERITY_LABELS = {
|
||||
critical: 'Kritisch',
|
||||
warning: 'Warnung',
|
||||
info: 'Hinweis',
|
||||
}
|
||||
|
||||
function attentionLink(item) {
|
||||
if (item.initiative_id && item.action_id) {
|
||||
return `/initiatives/${item.initiative_id}`
|
||||
}
|
||||
if (item.initiative_id) {
|
||||
return `/initiatives/${item.initiative_id}`
|
||||
}
|
||||
return null
|
||||
}
|
||||
|
||||
export function AttentionWidget() {
|
||||
const [items, setItems] = useState([])
|
||||
const [loading, setLoading] = useState(true)
|
||||
const [error, setError] = useState(null)
|
||||
|
||||
const load = useCallback(async () => {
|
||||
setLoading(true)
|
||||
setError(null)
|
||||
try {
|
||||
const data = await getAttentionItems()
|
||||
setItems(Array.isArray(data) ? data.slice(0, 8) : [])
|
||||
} catch (err) {
|
||||
setError(err.message)
|
||||
} finally {
|
||||
setLoading(false)
|
||||
}
|
||||
}, [])
|
||||
|
||||
useEffect(() => {
|
||||
load()
|
||||
}, [load])
|
||||
|
||||
return (
|
||||
<WidgetCard
|
||||
title="Aufmerksamkeit"
|
||||
subtitle="Was braucht jetzt Steuerung?"
|
||||
actions={
|
||||
<button type="button" className="btn btn-ghost" onClick={load} disabled={loading}>
|
||||
Aktualisieren
|
||||
</button>
|
||||
}
|
||||
>
|
||||
{loading && <LoadingState />}
|
||||
{!loading && error && <ErrorState message={error} onRetry={load} />}
|
||||
{!loading && !error && items.length === 0 && (
|
||||
<EmptyState message="Keine Attention-Items — alles im grünen Bereich." />
|
||||
)}
|
||||
{!loading && !error && items.length > 0 && (
|
||||
<ul className="item-list attention-list">
|
||||
{items.map((item) => {
|
||||
const href = attentionLink(item)
|
||||
return (
|
||||
<li key={`${item.kind}-${item.scope_id}`} className="list-item card-list-item">
|
||||
<div className="list-item-main">
|
||||
<span className={`attention-severity attention-severity--${item.severity}`}>
|
||||
{SEVERITY_LABELS[item.severity] || item.severity}
|
||||
</span>
|
||||
<strong>{item.title}</strong>
|
||||
{item.summary && <p className="list-item-desc muted">{item.summary}</p>}
|
||||
</div>
|
||||
<div className="list-item-meta">
|
||||
{href ? (
|
||||
<Link to={href} className="btn btn-secondary btn-sm">
|
||||
Ansehen
|
||||
</Link>
|
||||
) : null}
|
||||
</div>
|
||||
</li>
|
||||
)
|
||||
})}
|
||||
</ul>
|
||||
)}
|
||||
</WidgetCard>
|
||||
)
|
||||
}
|
||||
Reference in new issue
Block a user