feat: Update reference values and introduce pilot visualization module
Deploy Development / deploy (push) Successful in 47s
Build Test / lint-backend (push) Successful in 0s
Build Test / build-frontend (push) Successful in 23s

- Bumped version of reference_values module to 1.3.0.
- Added new imports and functionality for reference values in the backend, enhancing data retrieval.
- Introduced a new PilotVizPage in the frontend for visualizing data, linked from the SettingsPage for easy access.
- Updated routing in App.jsx to include the new pilot visualization route.
This commit is contained in:
Lars committed 2026-04-07 10:15:13 +02:00
1 parent 3e916c082c
commit 932bceb1e1
10 files changed
+428 -146

No files matched your search

+2
View File
@@ -24,6 +24,7 @@ import Analysis from './pages/Analysis'
import SettingsPage from './pages/SettingsPage'
import SettingsShell from './layouts/SettingsShell'
import ProfileReferenceValuesPage from './pages/ProfileReferenceValuesPage'
import PilotVizPage from './pages/PilotVizPage'
import GuidePage from './pages/GuidePage'
import AdminTierLimitsPage from './pages/AdminTierLimitsPage'
import AdminFeaturesPage from './pages/AdminFeaturesPage'
@@ -253,6 +254,7 @@ function AppShell() {
</Route>
<Route path="/workflow-editor/:id" element={<WorkflowEditorPage/>}/>
<Route path="/subscription" element={<SubscriptionPage/>}/>
<Route path="/pilot/viz" element={<PilotVizPage />} />
</Routes>
</main>
</div>
@@ -0,0 +1,88 @@
import { useState, useEffect } from 'react'
import { Link } from 'react-router-dom'
import { api } from '../../utils/api'
function formatEntryValue(row) {
if (row.value_numeric != null && row.value_numeric !== '') {
const n = Number(row.value_numeric)
return Number.isFinite(n) ? String(n) : String(row.value_numeric)
}
return row.value_text != null ? String(row.value_text) : '–'
}
export default function ReferenceValuesSummaryWidget() {
const [tiles, setTiles] = useState([])
const [loading, setLoading] = useState(true)
const [err, setErr] = useState(null)
useEffect(() => {
let cancelled = false
;(async () => {
try {
const data = await api.listProfileReferenceValuesSummary()
if (!cancelled) {
setTiles(Array.isArray(data?.tiles) ? data.tiles : [])
setErr(null)
}
} catch (e) {
if (!cancelled) {
setErr(e.message || 'Laden fehlgeschlagen')
setTiles([])
}
} finally {
if (!cancelled) setLoading(false)
}
})()
return () => {
cancelled = true
}
}, [])
if (loading) {
return (
<div style={{ padding: 20, textAlign: 'center' }}>
<div className="spinner" />
</div>
)
}
if (err) {
return <div style={{ fontSize: 13, color: 'var(--danger)' }}>{err}</div>
}
if (tiles.length === 0) {
return (
<p style={{ fontSize: 13, color: 'var(--text2)', margin: 0 }}>
Noch keine Referenzwerte erfasst.{' '}
<Link to="/settings/reference-values" style={{ color: 'var(--accent)' }}>
Zur Erfassung
</Link>
</p>
)
}
return (
<div className="ref-value-tiles-grid">
{tiles
.filter((t) => t?.latest)
.map((tile) => (
<div
key={tile.type_key}
className="card"
style={{ margin: 0, padding: 14, boxSizing: 'border-box' }}
>
<div style={{ fontSize: 12, fontWeight: 600, color: 'var(--text2)' }}>{tile.type_label}</div>
<div style={{ fontSize: 20, fontWeight: 700, marginTop: 6 }}>
{formatEntryValue(tile.latest)}
{tile.latest.unit ? (
<span style={{ fontSize: 14, fontWeight: 600, color: 'var(--text2)', marginLeft: 6 }}>
{tile.latest.unit}
</span>
) : null}
</div>
<div style={{ fontSize: 11, color: 'var(--text3)', marginTop: 6 }}>
Stand {String(tile.latest.effective_date || '').slice(0, 10)}
</div>
</div>
))}
</div>
)
}
+49
View File
@@ -0,0 +1,49 @@
import { FlaskConical } from 'lucide-react'
import { Link } from 'react-router-dom'
import { getPilotWidgetsInOrder } from '../pilot/widgetRegistry'
/**
* Pilot: Widget-Schicht (Layer 3b) parallel zum produktiven Dashboard.
* Daten für Referenzwerte: Layer 1 (backend/data_layer/reference_values.py) → API.
*/
export default function PilotVizPage() {
const widgets = getPilotWidgetsInOrder()
return (
<div style={{ paddingBottom: 96, textAlign: 'left', maxWidth: 900, margin: '0 auto' }}>
<div style={{ marginBottom: 20 }}>
<Link
to="/settings"
className="btn btn-secondary"
style={{ display: 'inline-flex', marginBottom: 12, textDecoration: 'none' }}
>
← Einstellungen
</Link>
<h1 className="page-title" style={{ display: 'flex', alignItems: 'center', gap: 10 }}>
<FlaskConical size={26} color="var(--accent)" />
Pilot: Visualisierungs-Module
</h1>
<p style={{ fontSize: 14, color: 'var(--text2)', lineHeight: 1.6, marginTop: 8 }}>
Testumgebung für die zukünftige Widget-Registry. Die produktive Übersicht und der Verlauf bleiben
unverändert. Referenzwerte-Summary wird über die gleiche API geladen wie in der Erfassungs-UI, angeboten
durch den Data Layer (Layer 1).
</p>
</div>
{widgets.map((def) => {
const { Component } = def
return (
<section key={def.id} className="card section-gap" style={{ overflow: 'hidden' }}>
<div className="card-title">{def.title}</div>
{def.description && (
<p style={{ fontSize: 13, color: 'var(--text2)', marginTop: 4, marginBottom: 14, lineHeight: 1.5 }}>
{def.description}
</p>
)}
<Component />
</section>
)
})}
</div>
)
}
+19
View File
@@ -441,6 +441,25 @@ export default function SettingsPage() {
</Link>
</div>
<div
className="card section-gap"
style={{ borderStyle: 'dashed', borderColor: 'var(--border2)', background: 'var(--surface2)' }}
>
<div className="card-title" style={{ fontSize: 14 }}>
Pilot: Visualisierungs-Module
</div>
<p style={{ fontSize: 12, color: 'var(--text2)', marginBottom: 12, lineHeight: 1.5 }}>
Testumgebung für die Widget-Schicht (Layer 3b). Die Übersicht und der Verlauf bleiben unverändert.
</p>
<Link
to="/pilot/viz"
className="btn btn-secondary btn-full"
style={{ textAlign: 'center', textDecoration: 'none', boxSizing: 'border-box' }}
>
Pilot öffnen
</Link>
</div>
{/* Auth actions */}
<div className="card section-gap">
<div className="card-title">🔐 Konto</div>
+20
View File
@@ -0,0 +1,20 @@
import ReferenceValuesSummaryWidget from '../components/pilot/ReferenceValuesSummaryWidget'
/**
* Pilot: konfigurierbare Widget-Reihenfolge (Layer 3b-Vorspiel).
* Nur für /pilot/viz – produktives Dashboard bleibt unverändert.
*/
export const PILOT_WIDGET_ORDER = ['reference_values_summary']
export const PILOT_WIDGET_DEFS = {
reference_values_summary: {
id: 'reference_values_summary',
title: 'Referenzwerte',
description: 'Aktuellste Kennwerte pro Typ (Daten via Layer 1 → bestehende API).',
Component: ReferenceValuesSummaryWidget,
},
}
export function getPilotWidgetsInOrder() {
return PILOT_WIDGET_ORDER.map((id) => PILOT_WIDGET_DEFS[id]).filter(Boolean)
}