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,71 @@
|
||||
import { ACTION_STATUSES, PRIORITIES } from '../constants/status.js'
|
||||
import { ACTION_STATUS_LABELS, PRIORITY_LABELS } from '../constants/status.js'
|
||||
import { ActorSelect } from './ActorSelect.jsx'
|
||||
|
||||
export function ActionForm({
|
||||
initial = {},
|
||||
actors = [],
|
||||
onSubmit,
|
||||
onCancel,
|
||||
busy = false,
|
||||
submitLabel = 'Speichern',
|
||||
}) {
|
||||
async function handleSubmit(e) {
|
||||
e.preventDefault()
|
||||
const form = e.target
|
||||
const selected = actors.filter((a) => form[`actor_${a.id}`]?.checked).map((a) => a.id)
|
||||
await onSubmit({
|
||||
title: form.title.value.trim(),
|
||||
description: form.description.value,
|
||||
status: form.status.value,
|
||||
priority: form.priority.value,
|
||||
assigned_actor_ids: selected,
|
||||
})
|
||||
}
|
||||
|
||||
const defaultActors = initial.assigned_actor_ids || []
|
||||
|
||||
return (
|
||||
<form className="form workspace-form" onSubmit={handleSubmit}>
|
||||
<label>
|
||||
Titel
|
||||
<input name="title" defaultValue={initial.title || ''} required maxLength={255} />
|
||||
</label>
|
||||
<label>
|
||||
Beschreibung
|
||||
<textarea name="description" rows={2} defaultValue={initial.description || ''} />
|
||||
</label>
|
||||
<label>
|
||||
Status
|
||||
<select name="status" defaultValue={initial.status || 'open'}>
|
||||
{ACTION_STATUSES.map((s) => (
|
||||
<option key={s} value={s}>
|
||||
{ACTION_STATUS_LABELS[s]}
|
||||
</option>
|
||||
))}
|
||||
</select>
|
||||
</label>
|
||||
<label>
|
||||
Priorität
|
||||
<select name="priority" defaultValue={initial.priority || 'normal'}>
|
||||
{PRIORITIES.map((p) => (
|
||||
<option key={p} value={p}>
|
||||
{PRIORITY_LABELS[p]}
|
||||
</option>
|
||||
))}
|
||||
</select>
|
||||
</label>
|
||||
<ActorSelect actors={actors} defaultSelected={defaultActors} />
|
||||
<div className="form-actions">
|
||||
<button type="submit" disabled={busy}>
|
||||
{busy ? 'Speichern …' : submitLabel}
|
||||
</button>
|
||||
{onCancel && (
|
||||
<button type="button" className="secondary" onClick={onCancel} disabled={busy}>
|
||||
Abbrechen
|
||||
</button>
|
||||
)}
|
||||
</div>
|
||||
</form>
|
||||
)
|
||||
}
|
||||
@@ -0,0 +1,42 @@
|
||||
import { Link } from 'react-router-dom'
|
||||
import { StatusBadge } from '../components/StatusBadge.jsx'
|
||||
import { PriorityBadge } from '../components/PriorityBadge.jsx'
|
||||
|
||||
export function ActionListItem({ action, showInitiative = false, manageLink }) {
|
||||
return (
|
||||
<li className="list-item action-item">
|
||||
<div className="list-item-main">
|
||||
<strong>{action.title}</strong>
|
||||
{showInitiative && action.initiative_title && (
|
||||
<span className="muted list-item-sub">{action.initiative_title}</span>
|
||||
)}
|
||||
{action.description && <p className="list-item-desc">{action.description}</p>}
|
||||
</div>
|
||||
<div className="list-item-meta">
|
||||
<StatusBadge status={action.status} />
|
||||
<PriorityBadge priority={action.priority} />
|
||||
{manageLink && (
|
||||
<Link to={manageLink} className="link-button">
|
||||
Bearbeiten
|
||||
</Link>
|
||||
)}
|
||||
</div>
|
||||
</li>
|
||||
)
|
||||
}
|
||||
|
||||
export function ActionList({ actions, empty, showInitiative, getManageLink }) {
|
||||
if (!actions.length) return empty
|
||||
return (
|
||||
<ul className="item-list">
|
||||
{actions.map((action) => (
|
||||
<ActionListItem
|
||||
key={action.id}
|
||||
action={action}
|
||||
showInitiative={showInitiative}
|
||||
manageLink={getManageLink?.(action)}
|
||||
/>
|
||||
))}
|
||||
</ul>
|
||||
)
|
||||
}
|
||||
@@ -0,0 +1,31 @@
|
||||
export function ActorSelect({ actors = [], defaultSelected = [], label = 'Zugewiesene Actors' }) {
|
||||
if (!actors.length) {
|
||||
return (
|
||||
<p className="muted actor-select-hint">
|
||||
Kein Actor verfügbar — bitte TenantContext prüfen.
|
||||
</p>
|
||||
)
|
||||
}
|
||||
|
||||
return (
|
||||
<fieldset className="actor-select">
|
||||
<legend>{label}</legend>
|
||||
{actors.map((actor) => (
|
||||
<label key={actor.id} className="checkbox-label">
|
||||
<input
|
||||
type="checkbox"
|
||||
name={`actor_${actor.id}`}
|
||||
defaultChecked={defaultSelected.includes(actor.id)}
|
||||
/>
|
||||
{actor.name}
|
||||
{actor.actor_type && <span className="muted"> ({actor.actor_type})</span>}
|
||||
</label>
|
||||
))}
|
||||
{actors.length === 1 && (
|
||||
<p className="muted actor-select-hint">
|
||||
AP0.6: Nur der aktuelle Actor — Tenant-Actor-Liste folgt in AP0.7.
|
||||
</p>
|
||||
)}
|
||||
</fieldset>
|
||||
)
|
||||
}
|
||||
@@ -0,0 +1,9 @@
|
||||
export function EmptyState({ title, message, action }) {
|
||||
return (
|
||||
<div className="empty-state">
|
||||
{title && <p className="empty-state-title">{title}</p>}
|
||||
{message && <p className="empty-state-message">{message}</p>}
|
||||
{action}
|
||||
</div>
|
||||
)
|
||||
}
|
||||
@@ -0,0 +1,12 @@
|
||||
export function ErrorState({ message, onRetry }) {
|
||||
return (
|
||||
<div className="state-error">
|
||||
<p>{message || 'Ein Fehler ist aufgetreten.'}</p>
|
||||
{onRetry && (
|
||||
<button type="button" className="secondary" onClick={onRetry}>
|
||||
Erneut versuchen
|
||||
</button>
|
||||
)}
|
||||
</div>
|
||||
)
|
||||
}
|
||||
@@ -0,0 +1,64 @@
|
||||
import { INITIATIVE_STATUSES, PRIORITIES } from '../constants/status.js'
|
||||
import { INITIATIVE_STATUS_LABELS, PRIORITY_LABELS } from '../constants/status.js'
|
||||
|
||||
export function InitiativeForm({
|
||||
initial = {},
|
||||
onSubmit,
|
||||
onCancel,
|
||||
busy = false,
|
||||
submitLabel = 'Speichern',
|
||||
}) {
|
||||
async function handleSubmit(e) {
|
||||
e.preventDefault()
|
||||
const form = e.target
|
||||
await onSubmit({
|
||||
title: form.title.value.trim(),
|
||||
goal: form.goal.value,
|
||||
status: form.status.value,
|
||||
priority: form.priority.value,
|
||||
})
|
||||
}
|
||||
|
||||
return (
|
||||
<form className="form workspace-form" onSubmit={handleSubmit}>
|
||||
<label>
|
||||
Titel
|
||||
<input name="title" defaultValue={initial.title || ''} required maxLength={255} />
|
||||
</label>
|
||||
<label>
|
||||
Ziel
|
||||
<textarea name="goal" rows={3} defaultValue={initial.goal || ''} />
|
||||
</label>
|
||||
<label>
|
||||
Status
|
||||
<select name="status" defaultValue={initial.status || 'active'}>
|
||||
{INITIATIVE_STATUSES.map((s) => (
|
||||
<option key={s} value={s}>
|
||||
{INITIATIVE_STATUS_LABELS[s]}
|
||||
</option>
|
||||
))}
|
||||
</select>
|
||||
</label>
|
||||
<label>
|
||||
Priorität
|
||||
<select name="priority" defaultValue={initial.priority || 'normal'}>
|
||||
{PRIORITIES.map((p) => (
|
||||
<option key={p} value={p}>
|
||||
{PRIORITY_LABELS[p]}
|
||||
</option>
|
||||
))}
|
||||
</select>
|
||||
</label>
|
||||
<div className="form-actions">
|
||||
<button type="submit" disabled={busy}>
|
||||
{busy ? 'Speichern …' : submitLabel}
|
||||
</button>
|
||||
{onCancel && (
|
||||
<button type="button" className="secondary" onClick={onCancel} disabled={busy}>
|
||||
Abbrechen
|
||||
</button>
|
||||
)}
|
||||
</div>
|
||||
</form>
|
||||
)
|
||||
}
|
||||
@@ -0,0 +1,3 @@
|
||||
export function LoadingState({ message = 'Lade …' }) {
|
||||
return <p className="state-loading">{message}</p>
|
||||
}
|
||||
@@ -0,0 +1,13 @@
|
||||
import { PRIORITY_LABELS } from '../constants/status.js'
|
||||
|
||||
const VARIANTS = {
|
||||
low: 'priority-low',
|
||||
normal: 'priority-normal',
|
||||
high: 'priority-high',
|
||||
}
|
||||
|
||||
export function PriorityBadge({ priority }) {
|
||||
const label = PRIORITY_LABELS[priority] || priority
|
||||
const variant = VARIANTS[priority] || 'priority-normal'
|
||||
return <span className={`badge priority-badge ${variant}`}>{label}</span>
|
||||
}
|
||||
@@ -0,0 +1,20 @@
|
||||
import { INITIATIVE_STATUS_LABELS, ACTION_STATUS_LABELS } from '../constants/status.js'
|
||||
|
||||
const VARIANTS = {
|
||||
active: 'status-active',
|
||||
paused: 'status-paused',
|
||||
completed: 'status-completed',
|
||||
archived: 'status-archived',
|
||||
open: 'status-open',
|
||||
in_progress: 'status-progress',
|
||||
blocked: 'status-blocked',
|
||||
done: 'status-done',
|
||||
discarded: 'status-discarded',
|
||||
}
|
||||
|
||||
export function StatusBadge({ kind = 'action', status }) {
|
||||
const labels = kind === 'initiative' ? INITIATIVE_STATUS_LABELS : ACTION_STATUS_LABELS
|
||||
const label = labels[status] || status
|
||||
const variant = VARIANTS[status] || 'status-default'
|
||||
return <span className={`badge status-badge ${variant}`}>{label}</span>
|
||||
}
|
||||
@@ -0,0 +1,23 @@
|
||||
import { describe, expect, it } from 'vitest'
|
||||
import { render, screen } from '@testing-library/react'
|
||||
import { StatusBadge } from '../components/StatusBadge.jsx'
|
||||
import { PriorityBadge } from '../components/PriorityBadge.jsx'
|
||||
|
||||
describe('StatusBadge', () => {
|
||||
it('renders known action status', () => {
|
||||
render(<StatusBadge status="blocked" />)
|
||||
expect(screen.getByText('Blockiert')).toBeTruthy()
|
||||
})
|
||||
|
||||
it('renders known initiative status', () => {
|
||||
render(<StatusBadge kind="initiative" status="active" />)
|
||||
expect(screen.getByText('Aktiv')).toBeTruthy()
|
||||
})
|
||||
})
|
||||
|
||||
describe('PriorityBadge', () => {
|
||||
it('renders known priority', () => {
|
||||
render(<PriorityBadge priority="high" />)
|
||||
expect(screen.getByText('Hoch')).toBeTruthy()
|
||||
})
|
||||
})
|
||||
Reference in new issue
Block a user