AP0.6: Kairo Workspace UX mit Frontend Widget/View Registry und Vitest.
Deploy Development / deploy (push) Successful in 43s
Test Suite / pytest-backend (push) Successful in 29s
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 43s
Test Suite / pytest-backend (push) Successful in 29s
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
This commit is contained in:
1 parent
802c9259dc
commit
0e7184a59e
38 files changed
+2362
-386
No files matched your search
@@ -0,0 +1,54 @@
|
||||
import { useCallback, useEffect, useState } from 'react'
|
||||
import { Link } from 'react-router-dom'
|
||||
import { listMyOpenActions } from '../api/actions.js'
|
||||
import { ActionList } from '../components/ActionList.jsx'
|
||||
import { EmptyState } from '../components/EmptyState.jsx'
|
||||
import { ErrorState } from '../components/ErrorState.jsx'
|
||||
import { LoadingState } from '../components/LoadingState.jsx'
|
||||
|
||||
export function BlockedActionsWidget() {
|
||||
const [actions, setActions] = useState([])
|
||||
const [loading, setLoading] = useState(true)
|
||||
const [error, setError] = useState(null)
|
||||
|
||||
const load = useCallback(async () => {
|
||||
setLoading(true)
|
||||
setError(null)
|
||||
try {
|
||||
const data = await listMyOpenActions()
|
||||
setActions(data.filter((a) => a.status === 'blocked'))
|
||||
} catch (err) {
|
||||
setError(err.message)
|
||||
} finally {
|
||||
setLoading(false)
|
||||
}
|
||||
}, [])
|
||||
|
||||
useEffect(() => {
|
||||
load()
|
||||
}, [load])
|
||||
|
||||
return (
|
||||
<div className="widget-card widget-card-alert">
|
||||
<div className="widget-header">
|
||||
<h3>Blockierte Maßnahmen</h3>
|
||||
<button type="button" className="link-button" onClick={load} disabled={loading}>
|
||||
Aktualisieren
|
||||
</button>
|
||||
</div>
|
||||
{loading && <LoadingState />}
|
||||
{!loading && error && <ErrorState message={error} onRetry={load} />}
|
||||
{!loading && !error && (
|
||||
<ActionList
|
||||
actions={actions}
|
||||
showInitiative
|
||||
getManageLink={(a) => `/initiatives/${a.initiative_id}`}
|
||||
empty={<EmptyState message="Keine blockierten Maßnahmen." />}
|
||||
/>
|
||||
)}
|
||||
{!loading && !error && actions.length > 0 && (
|
||||
<p className="widget-footer muted">Blockierte Maßnahmen erfordern Aufmerksamkeit.</p>
|
||||
)}
|
||||
</div>
|
||||
)
|
||||
}
|
||||
@@ -0,0 +1,64 @@
|
||||
import { useCallback, useEffect, useState } from 'react'
|
||||
import { Link } from 'react-router-dom'
|
||||
import { listInitiatives } from '../api/initiatives.js'
|
||||
import { StatusBadge } from '../components/StatusBadge.jsx'
|
||||
import { PriorityBadge } from '../components/PriorityBadge.jsx'
|
||||
import { EmptyState } from '../components/EmptyState.jsx'
|
||||
import { ErrorState } from '../components/ErrorState.jsx'
|
||||
import { LoadingState } from '../components/LoadingState.jsx'
|
||||
|
||||
export function InitiativesWidget() {
|
||||
const [initiatives, setInitiatives] = useState([])
|
||||
const [loading, setLoading] = useState(true)
|
||||
const [error, setError] = useState(null)
|
||||
|
||||
const load = useCallback(async () => {
|
||||
setLoading(true)
|
||||
setError(null)
|
||||
try {
|
||||
const data = await listInitiatives()
|
||||
setInitiatives(
|
||||
data.filter((i) => i.status === 'active' || i.status === 'paused').slice(0, 5),
|
||||
)
|
||||
} catch (err) {
|
||||
setError(err.message)
|
||||
} finally {
|
||||
setLoading(false)
|
||||
}
|
||||
}, [])
|
||||
|
||||
useEffect(() => {
|
||||
load()
|
||||
}, [load])
|
||||
|
||||
return (
|
||||
<div className="widget-card">
|
||||
<div className="widget-header">
|
||||
<h3>Aktive Vorhaben</h3>
|
||||
<Link to="/initiatives" className="link-button">
|
||||
Alle
|
||||
</Link>
|
||||
</div>
|
||||
{loading && <LoadingState />}
|
||||
{!loading && error && <ErrorState message={error} onRetry={load} />}
|
||||
{!loading && !error && initiatives.length === 0 && (
|
||||
<EmptyState message="Noch keine aktiven Vorhaben. Lege dein erstes Vorhaben an." />
|
||||
)}
|
||||
{!loading && !error && initiatives.length > 0 && (
|
||||
<ul className="item-list">
|
||||
{initiatives.map((item) => (
|
||||
<li key={item.id} className="list-item">
|
||||
<Link to={`/initiatives/${item.id}`} className="list-item-link">
|
||||
<strong>{item.title}</strong>
|
||||
</Link>
|
||||
<div className="list-item-meta">
|
||||
<StatusBadge kind="initiative" status={item.status} />
|
||||
<PriorityBadge priority={item.priority} />
|
||||
</div>
|
||||
</li>
|
||||
))}
|
||||
</ul>
|
||||
)}
|
||||
</div>
|
||||
)
|
||||
}
|
||||
@@ -0,0 +1,58 @@
|
||||
import { useCallback, useEffect, useState } from 'react'
|
||||
import { Link } from 'react-router-dom'
|
||||
import { listMyOpenActions } from '../api/actions.js'
|
||||
import { ActionList } from '../components/ActionList.jsx'
|
||||
import { EmptyState } from '../components/EmptyState.jsx'
|
||||
import { ErrorState } from '../components/ErrorState.jsx'
|
||||
import { LoadingState } from '../components/LoadingState.jsx'
|
||||
|
||||
export function MyOpenActionsWidget() {
|
||||
const [actions, setActions] = useState([])
|
||||
const [loading, setLoading] = useState(true)
|
||||
const [error, setError] = useState(null)
|
||||
|
||||
const load = useCallback(async () => {
|
||||
setLoading(true)
|
||||
setError(null)
|
||||
try {
|
||||
const data = await listMyOpenActions()
|
||||
setActions(data.filter((a) => a.status !== 'blocked'))
|
||||
} catch (err) {
|
||||
setError(err.message)
|
||||
} finally {
|
||||
setLoading(false)
|
||||
}
|
||||
}, [])
|
||||
|
||||
useEffect(() => {
|
||||
load()
|
||||
}, [load])
|
||||
|
||||
return (
|
||||
<div className="widget-card">
|
||||
<div className="widget-header">
|
||||
<h3>Meine offenen Maßnahmen</h3>
|
||||
<button type="button" className="link-button" onClick={load} disabled={loading}>
|
||||
Aktualisieren
|
||||
</button>
|
||||
</div>
|
||||
{loading && <LoadingState />}
|
||||
{!loading && error && <ErrorState message={error} onRetry={load} />}
|
||||
{!loading && !error && (
|
||||
<ActionList
|
||||
actions={actions}
|
||||
showInitiative
|
||||
getManageLink={(a) => `/initiatives/${a.initiative_id}`}
|
||||
empty={
|
||||
<EmptyState message="Keine offenen Maßnahmen. Du kannst eine neue Maßnahme in einem Vorhaben anlegen." />
|
||||
}
|
||||
/>
|
||||
)}
|
||||
{!loading && !error && actions.length > 0 && (
|
||||
<p className="widget-footer">
|
||||
<Link to="/initiatives">Alle Vorhaben →</Link>
|
||||
</p>
|
||||
)}
|
||||
</div>
|
||||
)
|
||||
}
|
||||
@@ -0,0 +1,42 @@
|
||||
import { useSession } from '../context/SessionContext.jsx'
|
||||
|
||||
export function TenantContextWidget() {
|
||||
const { context, me } = useSession()
|
||||
|
||||
if (!context?.tenant) {
|
||||
return (
|
||||
<div className="widget-card">
|
||||
<h3>Kontext</h3>
|
||||
<p className="muted">Kein aktiver Tenant — bitte Tenant wählen.</p>
|
||||
</div>
|
||||
)
|
||||
}
|
||||
|
||||
return (
|
||||
<div className="widget-card">
|
||||
<h3>Kontext</h3>
|
||||
<dl className="context-dl">
|
||||
<div>
|
||||
<dt>Nutzer</dt>
|
||||
<dd>{me?.display_name}</dd>
|
||||
</div>
|
||||
<div>
|
||||
<dt>Tenant</dt>
|
||||
<dd>{context.tenant.name}</dd>
|
||||
</div>
|
||||
<div>
|
||||
<dt>Tenant-Rolle</dt>
|
||||
<dd>{context.tenant.role}</dd>
|
||||
</div>
|
||||
{context.actor && (
|
||||
<div>
|
||||
<dt>Actor</dt>
|
||||
<dd>
|
||||
{context.actor.type} · {context.actor.id.slice(0, 8)}…
|
||||
</dd>
|
||||
</div>
|
||||
)}
|
||||
</dl>
|
||||
</div>
|
||||
)
|
||||
}
|
||||
Reference in new issue
Block a user