mirror of
https://github.com/rcourtman/Pulse.git
synced 2026-09-10 18:45:53 +00:00
dae4fb3bb4
Before this commit the bars / sparklines segmented control inside the Workloads filter only drove the guest table below. The new hosts table on top still showed metric bars regardless of the toggle, which read as half-wired UX once the user noticed. Lift ownership of the metric display mode and the sparkline range to ProxmoxPageSurface: - useWorkloadsControlsState gains optional `metricDisplayMode`, `onMetricDisplayModeChange`, `metricHistoryRange`, and `onMetricHistoryRangeChange` options. When supplied, the controls layer short-circuits to the page-provided accessor + change handler; otherwise it falls back to the existing persistent signals, so standalone Workloads usage is unaffected. - WorkloadsSurface forwards those four overrides through WorkloadsSurfaceProps so platform pages can opt in. - ProxmoxPageSurface creates the two persistent signals at the page level (same `STORAGE_KEYS.WORKLOADS_METRIC_DISPLAY_MODE` / `STORAGE_KEYS.WORKLOADS_METRIC_HISTORY_RANGE` keys, so existing user preference carries over) and passes the accessor + setter down to both the embedded WorkloadsSurface and ProxmoxNodesTable. - ProxmoxNodesTable accepts `metricDisplayMode` + `metricHistoryRange` accessors. When the mode is `sparklines` it renders MetricMiniSparkline for CPU / Memory / Disk using `useWorkloadTableMetricHistory`; the cache key matches the workloads-table reader so the two instances dedupe their fetches. When the mode is `bars` it keeps the canonical ResponsiveMetricCell / StackedMemoryBar / StackedDiskBar rendering from the previous commit. The legacy Node shape that `getNodeMetricSeries` keys on is projected from the canonical Resource (id / name / instance / linkedAgentId). A new contract test pins the override threading + the page-level wiring so a future refactor can't silently fork the toggle state again. performance-and-scalability contract Current-State documents the shared-toggle model.