- Added support for the "kpi_board" widget in the dashboard configuration, allowing for chart_days validation. - Updated the widget catalog description to reflect the new configuration options for KPI tiles. - Enhanced the DashboardLabPage to manage chart_days input for the KPI board, improving user experience. - Introduced normalization functions for KPI kcal window days to maintain consistent behavior. - Bumped app_dashboard version to 1.4.0 to reflect these enhancements.
58 lines
1.8 KiB
JavaScript
58 lines
1.8 KiB
JavaScript
/**
|
|
* Pilot/Lab-Widgets registrieren. IDs müssen zu backend/widget_catalog.WIDGET_CATALOG passen.
|
|
*/
|
|
import PilotWelcome from '../components/pilot/PilotWelcome'
|
|
import PilotQuickCapture from '../components/pilot/PilotQuickCapture'
|
|
import PilotKpiBoard from '../components/pilot/PilotKpiBoard'
|
|
import PilotBodySection from '../components/pilot/PilotBodySection'
|
|
import PilotActivitySection from '../components/pilot/PilotActivitySection'
|
|
import { normalizeBodyChartDays, normalizeKpiKcalWindowDays } from './bodyChartDays'
|
|
import { registerDashboardWidget } from './dashboardWidgetRegistry'
|
|
|
|
let _registered = false
|
|
|
|
export function ensurePilotLabWidgetsRegistered() {
|
|
if (_registered) return
|
|
_registered = true
|
|
|
|
registerDashboardWidget({
|
|
id: 'welcome',
|
|
Component: PilotWelcome,
|
|
mapProps: () => ({}),
|
|
})
|
|
registerDashboardWidget({
|
|
id: 'quick_capture',
|
|
Component: PilotQuickCapture,
|
|
mapProps: (ctx) => ({ onSaved: ctx.requestRefresh }),
|
|
})
|
|
registerDashboardWidget({
|
|
id: 'kpi_board',
|
|
Component: PilotKpiBoard,
|
|
mapProps: (ctx) => ({
|
|
refreshTick: ctx.refreshTick,
|
|
kcalWindowDays: normalizeKpiKcalWindowDays(ctx.layoutEntry?.config?.chart_days),
|
|
}),
|
|
})
|
|
registerDashboardWidget({
|
|
id: 'body_overview',
|
|
Component: PilotBodySection,
|
|
mapProps: (ctx) => ({
|
|
refreshTick: ctx.refreshTick,
|
|
chartDays: normalizeBodyChartDays(ctx.layoutEntry?.config?.chart_days),
|
|
}),
|
|
})
|
|
registerDashboardWidget({
|
|
id: 'activity_overview',
|
|
Component: PilotActivitySection,
|
|
mapProps: (ctx) => ({
|
|
refreshTick: ctx.refreshTick,
|
|
chartDays: normalizeBodyChartDays(ctx.layoutEntry?.config?.chart_days),
|
|
}),
|
|
})
|
|
}
|
|
|
|
/** @internal Nur für Tests */
|
|
export function __resetPilotLabRegistrationForTests() {
|
|
_registered = false
|
|
}
|