AP1.5e: Projekt-Detail, Bearbeitung und Lifecycle in der Ausführung.
Deploy Development / deploy (push) Successful in 43s
Test Suite / pytest-backend (push) Failing after 1m48s
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) Successful in 43s
Test Suite / pytest-backend (push) Failing after 1m48s
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
Detail-Route mit vollem Formular, Struktur-Navigator statt Inline-CRUD, Lifecycle sichtbar im Vorhaben-Header und auf Ausführung (0.15.1-ap1.5e).
This commit is contained in:
1 parent
94e815e88a
commit
33831a8c2c
13 files changed
+827
-173
No files matched your search
@@ -0,0 +1,81 @@
|
||||
import { LIFECYCLE_LABELS } from '../constants/operating.js'
|
||||
import { Link } from 'react-router-dom'
|
||||
|
||||
export function InitiativeLifecycleBar({
|
||||
snapshot,
|
||||
loading,
|
||||
error,
|
||||
initiativeId,
|
||||
compact = false,
|
||||
}) {
|
||||
if (loading) {
|
||||
return (
|
||||
<section className="initiative-lifecycle-bar card card--flat">
|
||||
<p className="muted">Steuerungszustand wird geladen …</p>
|
||||
</section>
|
||||
)
|
||||
}
|
||||
|
||||
if (error || !snapshot) {
|
||||
return (
|
||||
<section className="initiative-lifecycle-bar card card--flat initiative-lifecycle-bar--muted">
|
||||
<p className="muted">
|
||||
Steuerungszustand nicht verfügbar — siehe Tab{' '}
|
||||
<Link to={`/initiatives/${initiativeId}`}>Steuerung</Link>.
|
||||
</p>
|
||||
</section>
|
||||
)
|
||||
}
|
||||
|
||||
const displayLabel =
|
||||
snapshot.lifecycle_label ||
|
||||
LIFECYCLE_LABELS[snapshot.lifecycle_state] ||
|
||||
snapshot.lifecycle_state
|
||||
|
||||
const stats = [
|
||||
{ label: 'Offen', value: snapshot.counts?.actions_open ?? 0, warn: false },
|
||||
{
|
||||
label: 'Blockiert',
|
||||
value: snapshot.counts?.actions_blocked ?? 0,
|
||||
warn: (snapshot.counts?.actions_blocked ?? 0) > 0,
|
||||
},
|
||||
{
|
||||
label: 'Review',
|
||||
value: snapshot.counts?.actions_review_required ?? 0,
|
||||
warn: (snapshot.counts?.actions_review_required ?? 0) > 0,
|
||||
},
|
||||
{
|
||||
label: 'Blocker',
|
||||
value: snapshot.counts?.blockers_open ?? 0,
|
||||
warn: (snapshot.counts?.blockers_open ?? 0) > 0,
|
||||
},
|
||||
]
|
||||
|
||||
return (
|
||||
<section
|
||||
className={`initiative-lifecycle-bar card card--flat${compact ? ' initiative-lifecycle-bar--compact' : ''}`}
|
||||
>
|
||||
<div className="initiative-lifecycle-bar-main">
|
||||
<div>
|
||||
<p className="initiative-lifecycle-kicker">Programm-Fortschritt</p>
|
||||
<span className="badge status-badge status-active steering-lifecycle-badge">
|
||||
{displayLabel}
|
||||
</span>
|
||||
</div>
|
||||
<Link className="btn btn-secondary btn-sm" to={`/initiatives/${initiativeId}`}>
|
||||
Steuerung
|
||||
</Link>
|
||||
</div>
|
||||
<div className="initiative-lifecycle-stats">
|
||||
{stats.map(({ label, value, warn }) => (
|
||||
<span
|
||||
key={label}
|
||||
className={`initiative-lifecycle-stat${warn ? ' initiative-lifecycle-stat--warn' : ''}`}
|
||||
>
|
||||
<strong>{value}</strong> {label}
|
||||
</span>
|
||||
))}
|
||||
</div>
|
||||
</section>
|
||||
)
|
||||
}
|
||||
@@ -0,0 +1,140 @@
|
||||
import { INITIATIVE_STATUSES, INITIATIVE_STATUS_LABELS } from '../constants/status.js'
|
||||
import { GateSelect } from './GateSelect.jsx'
|
||||
import { flattenProjectOptions } from '../utils/projectTree.js'
|
||||
|
||||
const CONTAINER_KINDS = [
|
||||
{ value: '', label: '— Standard —' },
|
||||
{ value: 'project', label: 'Projekt' },
|
||||
{ value: 'stream', label: 'Stream' },
|
||||
{ value: 'phase', label: 'Phase' },
|
||||
{ value: 'release', label: 'Release' },
|
||||
]
|
||||
|
||||
export function ProjectForm({
|
||||
initial = {},
|
||||
projects = [],
|
||||
roadmapItems = [],
|
||||
excludeProjectId = '',
|
||||
onSubmit,
|
||||
onCancel,
|
||||
busy = false,
|
||||
submitLabel = 'Speichern',
|
||||
}) {
|
||||
const parentOptions = flattenProjectOptions(
|
||||
projects.filter((p) => p.id !== excludeProjectId),
|
||||
)
|
||||
|
||||
async function handleSubmit(e) {
|
||||
e.preventDefault()
|
||||
const form = e.target
|
||||
const parentValue = form.parent_project_id?.value ?? ''
|
||||
const kindValue = form.container_kind?.value ?? ''
|
||||
const gateValue = form.roadmap_item_id?.value ?? ''
|
||||
const targetValue = form.target_date?.value ?? ''
|
||||
const sortValue = form.sort_order?.value ?? '0'
|
||||
|
||||
await onSubmit({
|
||||
title: form.title.value.trim(),
|
||||
description: form.description.value,
|
||||
status: form.status.value,
|
||||
parent_project_id: parentValue || undefined,
|
||||
clear_parent_project: parentValue === '',
|
||||
container_kind: kindValue || undefined,
|
||||
clear_container_kind: kindValue === '',
|
||||
roadmap_item_id: gateValue || undefined,
|
||||
clear_roadmap_item: gateValue === '',
|
||||
target_date: targetValue || undefined,
|
||||
clear_target_date: !targetValue,
|
||||
sort_order: Number.parseInt(sortValue, 10) || 0,
|
||||
})
|
||||
}
|
||||
|
||||
return (
|
||||
<form className="form workspace-form project-form" onSubmit={handleSubmit}>
|
||||
<label>
|
||||
Titel
|
||||
<input
|
||||
name="title"
|
||||
defaultValue={initial.title || ''}
|
||||
required
|
||||
maxLength={255}
|
||||
placeholder="z. B. Phase 1 — Grundlagen"
|
||||
/>
|
||||
</label>
|
||||
<label>
|
||||
Beschreibung
|
||||
<textarea name="description" rows={4} defaultValue={initial.description || ''} />
|
||||
</label>
|
||||
<div className="form-row form-row--2">
|
||||
<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>
|
||||
Art
|
||||
<select name="container_kind" defaultValue={initial.container_kind || ''}>
|
||||
{CONTAINER_KINDS.map(({ value, label }) => (
|
||||
<option key={value || 'none'} value={value}>
|
||||
{label}
|
||||
</option>
|
||||
))}
|
||||
</select>
|
||||
</label>
|
||||
</div>
|
||||
{parentOptions.length > 0 && (
|
||||
<label>
|
||||
Übergeordnet (optional)
|
||||
<select name="parent_project_id" defaultValue={initial.parent_project_id || ''}>
|
||||
<option value="">— oberste Ebene —</option>
|
||||
{parentOptions.map(({ project, label }) => (
|
||||
<option key={project.id} value={project.id}>
|
||||
{label}
|
||||
</option>
|
||||
))}
|
||||
</select>
|
||||
</label>
|
||||
)}
|
||||
{roadmapItems.length > 0 && (
|
||||
<GateSelect
|
||||
roadmapItems={roadmapItems}
|
||||
defaultValue={initial.roadmap_item_id || ''}
|
||||
/>
|
||||
)}
|
||||
<div className="form-row form-row--2">
|
||||
<label>
|
||||
Zieldatum (optional)
|
||||
<input
|
||||
type="date"
|
||||
name="target_date"
|
||||
defaultValue={initial.target_date || ''}
|
||||
/>
|
||||
</label>
|
||||
<label>
|
||||
Sortierung
|
||||
<input
|
||||
type="number"
|
||||
name="sort_order"
|
||||
defaultValue={String(initial.sort_order ?? 0)}
|
||||
min={0}
|
||||
/>
|
||||
</label>
|
||||
</div>
|
||||
<div className="form-actions">
|
||||
<button type="submit" className="btn btn-primary" disabled={busy}>
|
||||
{busy ? 'Speichern …' : submitLabel}
|
||||
</button>
|
||||
{onCancel && (
|
||||
<button type="button" className="btn btn-secondary" onClick={onCancel} disabled={busy}>
|
||||
Abbrechen
|
||||
</button>
|
||||
)}
|
||||
</div>
|
||||
</form>
|
||||
)
|
||||
}
|
||||
@@ -1,18 +1,18 @@
|
||||
import { useMemo, useState } from 'react'
|
||||
import { Link } from 'react-router-dom'
|
||||
import { useMemo } from 'react'
|
||||
import { EmptyState } from './EmptyState.jsx'
|
||||
import { StatusBadge } from './StatusBadge.jsx'
|
||||
import {
|
||||
buildProjectsByParent,
|
||||
containerKindLabel,
|
||||
flattenProjectOptions,
|
||||
} from '../utils/projectTree.js'
|
||||
import { GateSelect, gateTitleById } from './GateSelect.jsx'
|
||||
import { gateTitleById } from './GateSelect.jsx'
|
||||
|
||||
function ProjectTreeNodes({
|
||||
projects,
|
||||
roadmapItems,
|
||||
initiativeId,
|
||||
parentId,
|
||||
depth,
|
||||
selectedProjectId,
|
||||
onSelectProject,
|
||||
canManage,
|
||||
@@ -28,17 +28,16 @@ function ProjectTreeNodes({
|
||||
<ul className="project-tree-children">
|
||||
{nodes.map((project) => (
|
||||
<li key={project.id} className="project-tree-branch">
|
||||
<div className="list-item card-list-item project-tree-item">
|
||||
<div className="list-item-main">
|
||||
<button
|
||||
type="button"
|
||||
className="link-button"
|
||||
onClick={() =>
|
||||
onSelectProject(selectedProjectId === project.id ? '' : project.id)
|
||||
}
|
||||
<div
|
||||
className={`list-item card-list-item project-tree-item${selectedProjectId === project.id ? ' project-tree-item--selected' : ''}`}
|
||||
>
|
||||
<div className="list-item-main project-tree-item-main">
|
||||
<Link
|
||||
to={`/initiatives/${initiativeId}/execution/projects/${project.id}`}
|
||||
className="project-tree-title-link"
|
||||
>
|
||||
<strong>{project.title}</strong>
|
||||
</button>
|
||||
</Link>
|
||||
{project.container_kind && (
|
||||
<span className="project-kind-badge muted">
|
||||
{containerKindLabel(project.container_kind)}
|
||||
@@ -49,18 +48,29 @@ function ProjectTreeNodes({
|
||||
Gate: {gateTitleById(roadmapItems, project.roadmap_item_id)}
|
||||
</span>
|
||||
)}
|
||||
{project.description && (
|
||||
<p className="list-item-desc muted">{project.description}</p>
|
||||
)}
|
||||
</div>
|
||||
<div className="list-item-meta action-controls">
|
||||
<StatusBadge kind="initiative" status={project.status} />
|
||||
<div className="list-item-meta action-controls project-tree-item-actions">
|
||||
<StatusBadge kind="project" status={project.status} />
|
||||
<button
|
||||
type="button"
|
||||
className={`btn btn-secondary btn-sm${selectedProjectId === project.id ? ' btn-primary' : ''}`}
|
||||
title="Arbeitspakete filtern"
|
||||
onClick={() =>
|
||||
onSelectProject(selectedProjectId === project.id ? '' : project.id)
|
||||
}
|
||||
>
|
||||
{selectedProjectId === project.id ? 'Filter aktiv' : 'Filtern'}
|
||||
</button>
|
||||
{canManage && (
|
||||
<button
|
||||
type="button"
|
||||
className="btn btn-secondary"
|
||||
className="btn btn-secondary btn-sm"
|
||||
disabled={busy}
|
||||
onClick={() => onDelete(project.id)}
|
||||
onClick={() => {
|
||||
if (window.confirm(`Projekt „${project.title}“ wirklich löschen?`)) {
|
||||
onDelete(project.id)
|
||||
}
|
||||
}}
|
||||
>
|
||||
Löschen
|
||||
</button>
|
||||
@@ -70,8 +80,8 @@ function ProjectTreeNodes({
|
||||
<ProjectTreeNodes
|
||||
projects={projects}
|
||||
roadmapItems={roadmapItems}
|
||||
initiativeId={initiativeId}
|
||||
parentId={project.id}
|
||||
depth={depth + 1}
|
||||
selectedProjectId={selectedProjectId}
|
||||
onSelectProject={onSelectProject}
|
||||
canManage={canManage}
|
||||
@@ -85,174 +95,65 @@ function ProjectTreeNodes({
|
||||
}
|
||||
|
||||
export function ProjectsSection({
|
||||
initiativeId,
|
||||
projects,
|
||||
roadmapItems = [],
|
||||
selectedProjectId,
|
||||
onSelectProject,
|
||||
canManage,
|
||||
onCreate,
|
||||
onDelete,
|
||||
busy,
|
||||
}) {
|
||||
const [title, setTitle] = useState('')
|
||||
const [description, setDescription] = useState('')
|
||||
const [parentProjectId, setParentProjectId] = useState('')
|
||||
const [containerKind, setContainerKind] = useState('')
|
||||
const [gateId, setGateId] = useState('')
|
||||
const [showForm, setShowForm] = useState(false)
|
||||
|
||||
const parentOptions = useMemo(
|
||||
() => flattenProjectOptions(projects),
|
||||
[projects]
|
||||
)
|
||||
|
||||
async function handleSubmit(e) {
|
||||
e.preventDefault()
|
||||
if (!title.trim()) return
|
||||
const ok = await onCreate({
|
||||
title: title.trim(),
|
||||
description: description.trim(),
|
||||
parent_project_id: parentProjectId || undefined,
|
||||
container_kind: containerKind || undefined,
|
||||
roadmap_item_id: gateId || undefined,
|
||||
})
|
||||
if (!ok) return
|
||||
setTitle('')
|
||||
setDescription('')
|
||||
setParentProjectId('')
|
||||
setContainerKind('')
|
||||
setGateId('')
|
||||
setShowForm(false)
|
||||
}
|
||||
|
||||
function openFormUnderSelected() {
|
||||
setParentProjectId(selectedProjectId || '')
|
||||
setShowForm(true)
|
||||
}
|
||||
|
||||
return (
|
||||
<section className="card projects-section">
|
||||
<div className="section-header">
|
||||
<div>
|
||||
<h2>Projekte</h2>
|
||||
<h2>Struktur</h2>
|
||||
<p className="section-lead muted">
|
||||
Operative Struktur — verschachtelbar für große Vorhaben. Arbeitspakete nur an
|
||||
Blatt-Projekten. Gates optional.
|
||||
Projekte, Streams und Phasen — Klick öffnet Detail & Bearbeitung. Filter schränkt
|
||||
Arbeitspakete ein; Anlage nur an Blatt-Ebenen für Actions.
|
||||
</p>
|
||||
</div>
|
||||
{canManage && (
|
||||
<div className="section-header-actions">
|
||||
{selectedProjectId && (
|
||||
<button
|
||||
type="button"
|
||||
className="btn btn-secondary btn-block-mobile"
|
||||
onClick={openFormUnderSelected}
|
||||
>
|
||||
Unterprojekt
|
||||
</button>
|
||||
)}
|
||||
<button
|
||||
type="button"
|
||||
className="btn btn-primary btn-block-mobile"
|
||||
onClick={() => setShowForm((v) => !v)}
|
||||
>
|
||||
{showForm ? 'Abbrechen' : 'Projekt'}
|
||||
</button>
|
||||
</div>
|
||||
<Link
|
||||
className="btn btn-primary btn-block-mobile"
|
||||
to={`/initiatives/${initiativeId}/execution/projects/new`}
|
||||
>
|
||||
Neues Projekt
|
||||
</Link>
|
||||
)}
|
||||
</div>
|
||||
|
||||
{showForm && canManage && (
|
||||
<form className="inline-form-block" onSubmit={handleSubmit}>
|
||||
<label>
|
||||
Titel
|
||||
<input
|
||||
value={title}
|
||||
onChange={(e) => setTitle(e.target.value)}
|
||||
maxLength={255}
|
||||
required
|
||||
placeholder="z. B. Phase 1 — Grundlagen"
|
||||
/>
|
||||
</label>
|
||||
<label>
|
||||
Beschreibung
|
||||
<textarea
|
||||
value={description}
|
||||
onChange={(e) => setDescription(e.target.value)}
|
||||
rows={2}
|
||||
/>
|
||||
</label>
|
||||
{parentOptions.length > 0 && (
|
||||
<label>
|
||||
Unter (optional)
|
||||
<select
|
||||
value={parentProjectId}
|
||||
onChange={(e) => setParentProjectId(e.target.value)}
|
||||
>
|
||||
<option value="">— oberste Ebene —</option>
|
||||
{parentOptions.map(({ project, label }) => (
|
||||
<option key={project.id} value={project.id}>
|
||||
{label}
|
||||
</option>
|
||||
))}
|
||||
</select>
|
||||
</label>
|
||||
)}
|
||||
<label>
|
||||
Art (optional)
|
||||
<select value={containerKind} onChange={(e) => setContainerKind(e.target.value)}>
|
||||
<option value="">— Standard —</option>
|
||||
<option value="project">Projekt</option>
|
||||
<option value="stream">Stream</option>
|
||||
<option value="phase">Phase</option>
|
||||
<option value="release">Release</option>
|
||||
</select>
|
||||
</label>
|
||||
{roadmapItems.length > 0 && (
|
||||
<label>
|
||||
Zielzustand (Gate)
|
||||
<select value={gateId} onChange={(e) => setGateId(e.target.value)}>
|
||||
<option value="">— keins —</option>
|
||||
{roadmapItems.map((item) => (
|
||||
<option key={item.id} value={item.id}>
|
||||
{item.title}
|
||||
</option>
|
||||
))}
|
||||
</select>
|
||||
</label>
|
||||
)}
|
||||
<button type="submit" className="btn btn-primary" disabled={busy}>
|
||||
Anlegen
|
||||
</button>
|
||||
</form>
|
||||
)}
|
||||
|
||||
{projects.length === 0 && (
|
||||
<EmptyState message="Noch keine Projekte — optional. Du kannst auch direkt Arbeitspakete anlegen." />
|
||||
<EmptyState message="Noch keine Struktur — lege ein Projekt an oder starte direkt mit Arbeitspaketen." />
|
||||
)}
|
||||
|
||||
<ul className="item-list project-filter-list project-tree-list">
|
||||
<li className="list-item card-list-item">
|
||||
<button
|
||||
type="button"
|
||||
className={`btn btn-secondary${selectedProjectId === '' ? ' btn-primary' : ''}`}
|
||||
onClick={() => onSelectProject('')}
|
||||
>
|
||||
Alle Arbeitspakete
|
||||
</button>
|
||||
</li>
|
||||
</ul>
|
||||
<ProjectTreeNodes
|
||||
projects={projects}
|
||||
roadmapItems={roadmapItems}
|
||||
parentId=""
|
||||
depth={1}
|
||||
selectedProjectId={selectedProjectId}
|
||||
onSelectProject={onSelectProject}
|
||||
canManage={canManage}
|
||||
onDelete={onDelete}
|
||||
busy={busy}
|
||||
/>
|
||||
{projects.length > 0 && (
|
||||
<>
|
||||
<ul className="item-list project-filter-list project-tree-list">
|
||||
<li className="list-item card-list-item">
|
||||
<button
|
||||
type="button"
|
||||
className={`btn btn-secondary btn-sm${selectedProjectId === '' ? ' btn-primary' : ''}`}
|
||||
onClick={() => onSelectProject('')}
|
||||
>
|
||||
Alle Arbeitspakete
|
||||
</button>
|
||||
</li>
|
||||
</ul>
|
||||
<ProjectTreeNodes
|
||||
projects={projects}
|
||||
roadmapItems={roadmapItems}
|
||||
initiativeId={initiativeId}
|
||||
parentId=""
|
||||
selectedProjectId={selectedProjectId}
|
||||
onSelectProject={onSelectProject}
|
||||
canManage={canManage}
|
||||
onDelete={onDelete}
|
||||
busy={busy}
|
||||
/>
|
||||
</>
|
||||
)}
|
||||
</section>
|
||||
)
|
||||
}
|
||||
Reference in new issue
Block a user