Skip to content

armgit / Pulse

Public Imported from GitHub
0

Real-time monitoring dashboard for Proxmox VE, PBS, Docker, Kubernetes, TrueNAS and vSphere. Self-hosted, with alerts for failed backups, full disks, unhealthy containers and offline nodes.

Harden recovery activity timeline ranges

rcourtman53ebbf97f8ab
diff --git a/docs/release-control/v6/internal/subsystems/frontend-primitives.md b/docs/release-control/v6/internal/subsystems/frontend-primitives.md
index a777d49923..6e9902405a 100644
--- a/docs/release-control/v6/internal/subsystems/frontend-primitives.md
+++ b/docs/release-control/v6/internal/subsystems/frontend-primitives.md
@@ -445,7 +445,19 @@ prompt explain the same operator-facing priority.
summary-bearing pages must use `ChartVisibilityToggleButton` so the
affordance exposes one `Show charts` / `Hide charts` pressed-state contract
instead of rebuilding a one-option segmented control or an in-summary
- collapse chevron page by page. Compact, stable, mutually-exclusive filters
+ collapse chevron page by page. Feature state hooks under
+ `frontend-modern/src/features/` own route-backed query state, selected item
+ state, and data-window selection for their product surfaces; shared
+ primitives and reusable presentation helpers may own viewport-safe chrome,
+ focus treatment, pressed-state affordances, and accessible label builders
+ for repeated controls. Recovery timeline columns follow that split:
+ storage/recovery owns the range, selected day, chart/table transport
+ windows, and bucket data, while the shared frontend boundary owns the
+ reusable button focus/selected styling and ARIA wording so columns expose
+ singular/plural recovery-point labels plus selected state consistently.
+ Frontend primitives must not fetch recovery data, infer recovery date
+ ranges, or carry a parallel selected-day store just to render timeline
+ columns. Compact, stable, mutually-exclusive filters
with two to five options should use `LabeledFilterToggleGroup` as a
responsive control: toggle buttons at wide desktop widths and the native
select fallback below that. Dynamic, user/environment-sized, or six-plus
diff --git a/docs/release-control/v6/internal/subsystems/storage-recovery.md b/docs/release-control/v6/internal/subsystems/storage-recovery.md
index ba0f78c44d..0b369431e3 100644
--- a/docs/release-control/v6/internal/subsystems/storage-recovery.md
+++ b/docs/release-control/v6/internal/subsystems/storage-recovery.md
@@ -167,6 +167,21 @@ bypass the API fail-closed execution gate.
compatibility path, but event views and event drill-ins must drop
protected-inventory-only state so hidden filters cannot make valid history
look empty.
+ Recovery activity timeline state is also storage/recovery-owned. The
+ route-backed range, selected day, and viewport-derived mobile cadence must
+ stay in `frontend-modern/src/features/recovery/useRecoverySurfaceState.ts`
+ and the Recovery page owner, with one shared transport-query builder feeding
+ the chart window to rollups/series and the table window to points/facets.
+ The series query may append timezone offset for bucket alignment, but
+ presentation components must not rebuild a second query contract or conflate
+ the chart and table windows. The activity chart must preserve readable
+ bucket density across the governed 7, 30, 90, and 365 day ranges: seven-day
+ timelines fit the available viewport without forced horizontal overflow,
+ thirty-day timelines may widen on mobile only, and longer ranges scroll in a
+ bounded chart viewport with sparser labels so first, last, and selected-day
+ context remain visible without overlapping labels. Selecting a timeline
+ column remains route-backed and must not become component-local ephemeral
+ state.
3. Add or change storage page UX through `frontend-modern/src/pages/Storage.tsx`, `frontend-modern/src/pages/Ceph.tsx`, `frontend-modern/src/components/Storage/`, `frontend-modern/src/features/storageBackups/`, and the shared storage-source contract in `frontend-modern/src/utils/storageSources.ts`
The retired dashboard route must not reintroduce storage or recovery
widgets as compatibility panels. Storage capacity, storage health,
@@ -438,7 +453,7 @@ bypass the API fail-closed execution gate.
entitlement refresh targeting: when storage- or recovery-adjacent hosted
routes execute under a tenant org without org-local billing state, the
refresh path must repair the instance-level `default` lease and evaluator
- instead of rewriting the empty tenant org, so AI-assisted recovery and
+ instead of rewriting the empty tenant org, so AI-guided recovery and
hosted diagnostics do not collapse into false free-tier behavior.
19. Preserve shipped local security-doc guidance in shared `internal/api/` config/setup helpers so storage- and recovery-adjacent transport surfaces do not reintroduce GitHub `main` security links when the running build already serves its own local security documentation route.
20. Keep shared `internal/api/` Patrol transport and alert-trigger edits feature-isolated: Patrol-specific recency fields, callback fan-out, or alert-bridge wiring changes must not leak into recovery queries, storage links, or recovery-adjacent install/setup flows unless this contract changes in the same slice.
@@ -2885,7 +2900,7 @@ provider-route truth stays on the shared API/security boundary, where OIDC,
SAML, and multi-provider SSO are Community-tier authentication capabilities.
That same shared `internal/api/` boundary also owns hosted AI bootstrap
continuity. Storage- and recovery-adjacent hosted flows may surface Patrol-
-backed investigation or AI-assisted recovery guidance before an operator has
+backed investigation or AI-guided recovery guidance before an operator has
ever opened AI Settings, but the shared hosted runtime helper must return the
same unconfigured provider-setup state as self-hosted unless an explicit AI
config exists. Adjacent recovery surfaces must not invent their own hosted AI
@@ -2894,7 +2909,7 @@ That same hosted entitlement continuity also depends on the shared refresh path
repairing the correct billing owner. When recovery-adjacent hosted requests run
under a tenant org without org-local billing state, `internal/api/` must
refresh, persist, and re-evaluate the instance-level `default` lease instead of
-rewriting the empty tenant org. Otherwise AI-assisted recovery can degrade to a
+rewriting the empty tenant org. Otherwise AI-guided recovery can degrade to a
false free-tier state even though the hosted machine still has a valid refresh
token and signed entitlement lease.
That same shared persistence path must also clear historical hosted quickstart
diff --git a/frontend-modern/src/components/Recovery/Recovery.tsx b/frontend-modern/src/components/Recovery/Recovery.tsx
index 149ff090cc..93bbee9540 100644
--- a/frontend-modern/src/components/Recovery/Recovery.tsx
+++ b/frontend-modern/src/components/Recovery/Recovery.tsx
@@ -389,7 +389,7 @@ const Recovery: Component = () => {
}));
const maxValue = points.reduce((maximum, point) => Math.max(maximum, point.total), 0);
const axisMax = getRecoveryNiceAxisMax(maxValue);
- const labelEvery = getRecoveryTimelineLabelEvery(points.length);
+ const labelEvery = getRecoveryTimelineLabelEvery(points.length, isMobile());
return { points, axisMax, labelEvery };
});
diff --git a/frontend-modern/src/components/Recovery/RecoveryActivitySection.tsx b/frontend-modern/src/components/Recovery/RecoveryActivitySection.tsx
index 859d24fa7a..79a4a7bf80 100644
--- a/frontend-modern/src/components/Recovery/RecoveryActivitySection.tsx
+++ b/frontend-modern/src/components/Recovery/RecoveryActivitySection.tsx
@@ -16,9 +16,14 @@ import {
import {
getRecoveryTimelineAxisLabelClass,
getRecoveryTimelineAxisTicks,
+ getRecoveryTimelineChartGapPx,
+ getRecoveryTimelineChartMinWidthPx,
RECOVERY_TIMELINE_LEGEND_ITEM_CLASS,
} from '@/utils/recoveryTimelineChartPresentation';
-import { getRecoveryTimelineColumnButtonClass } from '@/utils/recoveryTimelinePresentation';
+import {
+ getRecoveryTimelineColumnAriaLabel,
+ getRecoveryTimelineColumnButtonClass,
+} from '@/utils/recoveryTimelinePresentation';
interface RecoveryRollupSummary {
total: number;
@@ -69,7 +74,21 @@ interface RecoveryActivitySectionProps {
}
function RecoveryActivitySectionContent(props: RecoveryActivitySectionProps): JSX.Element {
- const timelineAxisTicks = () => getRecoveryTimelineAxisTicks(props.timeline().points.length);
+ const timelineAxisTicks = () =>
+ getRecoveryTimelineAxisTicks(
+ props.timeline().points.length,
+ props.isMobile,
+ props.timeline().labelEvery,
+ );
+ const chartMinWidthStyle = () => {
+ const minWidth = getRecoveryTimelineChartMinWidthPx(
+ props.isMobile,
+ props.chartRangeDays(),
+ props.timeline().points.length,
+ );
+ return minWidth > 0 ? `${minWidth}px` : '100%';
+ };
+ const chartGapStyle = () => `${getRecoveryTimelineChartGapPx(props.chartRangeDays())}px`;
const formatActivityAverage = (value: number): string => {
if (!Number.isFinite(value) || value <= 0) return '0/day';
if (value >= 10) return `${Math.round(value)}/day`;
@@ -293,129 +312,141 @@ function RecoveryActivitySectionContent(props: RecoveryActivitySectionProps): JS
</For>
</div>
- <div class="relative h-20">
- <div
- data-testid="recovery-activity-bars"
- class="absolute inset-x-0 bottom-4 top-0 flex items-stretch gap-[3px]"
- >
- <For each={props.timeline().points}>
- {(point) => {
- const total = point.total;
- const heightPct =
- props.timeline().axisMax > 0
- ? (total / props.timeline().axisMax) * 100
- : 0;
- const columnHeight = Math.max(0, Math.min(100, heightPct));
- const snapshotHeight = total > 0 ? (point.snapshot / total) * 100 : 0;
- const localHeight = total > 0 ? (point.local / total) * 100 : 0;
- const remoteHeight = total > 0 ? (point.remote / total) * 100 : 0;
- const isSelected = props.selectedDateKey() === point.key;
+ <div
+ data-testid="recovery-activity-chart-scroll"
+ class="overflow-x-auto overscroll-x-contain pb-1"
+ >
+ <div class="relative h-20" style={{ 'min-width': chartMinWidthStyle() }}>
+ <div
+ data-testid="recovery-activity-bars"
+ class="absolute inset-x-0 bottom-4 top-0 flex items-stretch"
+ style={{ gap: chartGapStyle() }}
+ >
+ <For each={props.timeline().points}>
+ {(point) => {
+ const total = point.total;
+ const heightPct =
+ props.timeline().axisMax > 0
+ ? (total / props.timeline().axisMax) * 100
+ : 0;
+ const columnHeight = Math.max(0, Math.min(100, heightPct));
+ const snapshotHeight = total > 0 ? (point.snapshot / total) * 100 : 0;
+ const localHeight = total > 0 ? (point.local / total) * 100 : 0;
+ const remoteHeight = total > 0 ? (point.remote / total) * 100 : 0;
+ const isSelected = props.selectedDateKey() === point.key;
+ const dateLabel = getRecoveryPrettyDateLabel(point.key);
- return (
- <div class="flex-1 self-stretch">
- <button
- type="button"
- class={`h-full w-full rounded-sm ${getRecoveryTimelineColumnButtonClass(isSelected)}`}
- aria-label={`${getRecoveryPrettyDateLabel(point.key)}: ${total} recovery points`}
- onClick={() => props.toggleSelectedDate(point.key)}
- onMouseEnter={(event) => {
- const rect = event.currentTarget.getBoundingClientRect();
- const breakdown: string[] = [];
- if (point.snapshot > 0) {
- breakdown.push(
- `${getRecoveryArtifactModePresentation('snapshot').aggregateLabel}: ${point.snapshot}`,
- );
- }
- if (point.local > 0) {
- breakdown.push(
- `${getRecoveryArtifactModePresentation('local').aggregateLabel}: ${point.local}`,
- );
- }
- if (point.remote > 0) {
- breakdown.push(
- `${getRecoveryArtifactModePresentation('remote').aggregateLabel}: ${point.remote}`,
- );
- }
- const tooltipText =
- point.total > 0
- ? `${getRecoveryPrettyDateLabel(point.key)}\nAvailable: ${point.total} recovery point${point.total > 1 ? 's' : ''}\n${breakdown.join(' • ')}`
- : `${getRecoveryPrettyDateLabel(point.key)}\nNo recovery points available`;
- showTooltip(tooltipText, rect.left + rect.width / 2, rect.top, {
- align: 'center',
- direction: 'up',
- });
- }}
- onMouseLeave={() => hideTooltip()}
- onFocus={(event) => {
- const rect = event.currentTarget.getBoundingClientRect();
- const tooltipText = `${getRecoveryPrettyDateLabel(point.key)}\nAvailable: ${point.total} recovery point${point.total > 1 ? 's' : ''}`;
- showTooltip(tooltipText, rect.left + rect.width / 2, rect.top, {
- align: 'center',
- direction: 'up',
- });
- }}
- onBlur={() => hideTooltip()}
- >
- <div class="relative h-full w-full">
- <Show when={total > 0}>
- <div
- class="absolute inset-x-0 bottom-0"
- style={{ height: `${columnHeight}%` }}
- >
- <Show when={remoteHeight > 0}>
- <div
- class={`w-full ${getRecoveryArtifactModePresentation('remote').segmentClassName}`}
- style={{ height: `${remoteHeight}%` }}
- />
- </Show>
- <Show when={localHeight > 0}>
- <div
- class={`w-full ${getRecoveryArtifactModePresentation('local').segmentClassName}`}
- style={{ height: `${localHeight}%` }}
- />
- </Show>
- <Show when={snapshotHeight > 0}>
- <div
- class={`w-full ${getRecoveryArtifactModePresentation('snapshot').segmentClassName}`}
- style={{ height: `${snapshotHeight}%` }}
- />
- </Show>
- </div>
- </Show>
- </div>
- </button>
- </div>
- );
- }}
- </For>
- </div>
+ return (
+ <div class="min-w-[3px] flex-1 self-stretch">
+ <button
+ type="button"
+ class={`h-full w-full ${getRecoveryTimelineColumnButtonClass(isSelected)}`}
+ aria-label={getRecoveryTimelineColumnAriaLabel(
+ dateLabel,
+ total,
+ isSelected,
+ )}
+ aria-pressed={isSelected ? 'true' : 'false'}
+ onClick={() => props.toggleSelectedDate(point.key)}
+ onMouseEnter={(event) => {
+ const rect = event.currentTarget.getBoundingClientRect();
+ const breakdown: string[] = [];
+ if (point.snapshot > 0) {
+ breakdown.push(
+ `${getRecoveryArtifactModePresentation('snapshot').aggregateLabel}: ${point.snapshot}`,
+ );
+ }
+ if (point.local > 0) {
+ breakdown.push(
+ `${getRecoveryArtifactModePresentation('local').aggregateLabel}: ${point.local}`,
+ );
+ }
+ if (point.remote > 0) {
+ breakdown.push(
+ `${getRecoveryArtifactModePresentation('remote').aggregateLabel}: ${point.remote}`,
+ );
+ }
+ const tooltipText =
+ point.total > 0
+ ? `${dateLabel}\nAvailable: ${point.total} recovery point${point.total > 1 ? 's' : ''}\n${breakdown.join(' • ')}`
+ : `${dateLabel}\nNo recovery points available`;
+ showTooltip(tooltipText, rect.left + rect.width / 2, rect.top, {
+ align: 'center',
+ direction: 'up',
+ });
+ }}
+ onMouseLeave={() => hideTooltip()}
+ onFocus={(event) => {
+ const rect = event.currentTarget.getBoundingClientRect();
+ const tooltipText = `${dateLabel}\nAvailable: ${point.total} recovery point${point.total > 1 ? 's' : ''}`;
+ showTooltip(tooltipText, rect.left + rect.width / 2, rect.top, {
+ align: 'center',
+ direction: 'up',
+ });
+ }}
+ onBlur={() => hideTooltip()}
+ >
+ <div class="relative h-full w-full overflow-hidden rounded-sm">
+ <Show when={total > 0}>
+ <div
+ class="absolute inset-x-0 bottom-0"
+ style={{ height: `${columnHeight}%` }}
+ >
+ <Show when={remoteHeight > 0}>
+ <div
+ class={`w-full ${getRecoveryArtifactModePresentation('remote').segmentClassName}`}
+ style={{ height: `${remoteHeight}%` }}
+ />
+ </Show>
+ <Show when={localHeight > 0}>
+ <div
+ class={`w-full ${getRecoveryArtifactModePresentation('local').segmentClassName}`}
+ style={{ height: `${localHeight}%` }}
+ />
+ </Show>
+ <Show when={snapshotHeight > 0}>
+ <div
+ class={`w-full ${getRecoveryArtifactModePresentation('snapshot').segmentClassName}`}
+ style={{ height: `${snapshotHeight}%` }}
+ />
+ </Show>
+ </div>
+ </Show>
+ </div>
+ </button>
+ </div>
+ );
+ }}
+ </For>
+ </div>
- <div class="pointer-events-none absolute inset-x-0 bottom-0 h-4">
- <For each={timelineAxisTicks()}>
- {(tick) => {
- const point = props.timeline().points[tick.index];
- const isSelected = props.selectedDateKey() === point.key;
- const alignmentClass =
- tick.align === 'start'
- ? 'left-0 text-left'
- : tick.align === 'end'
- ? 'left-full -translate-x-full text-right'
- : '-translate-x-1/2 text-center';
+ <div class="pointer-events-none absolute inset-x-0 bottom-0 h-4">
+ <For each={timelineAxisTicks()}>
+ {(tick) => {
+ const point = props.timeline().points[tick.index];
+ const isSelected = props.selectedDateKey() === point.key;
+ const alignmentClass =
+ tick.align === 'start'
+ ? 'left-0 text-left'
+ : tick.align === 'end'
+ ? 'left-full -translate-x-full text-right'
+ : '-translate-x-1/2 text-center';
- return (
- <span
- class={`absolute bottom-0 whitespace-nowrap text-[9px] ${
- isSelected
- ? getRecoveryTimelineAxisLabelClass(true)
- : getRecoveryTimelineAxisLabelClass(false)
- } ${alignmentClass}`}
- style={{ left: `${tick.positionPct}%` }}
- >
- {getRecoveryCompactAxisLabel(point.key, props.chartRangeDays())}
- </span>
- );
- }}
- </For>
+ return (
+ <span
+ class={`absolute bottom-0 whitespace-nowrap text-[9px] ${
+ isSelected
+ ? getRecoveryTimelineAxisLabelClass(true)
+ : getRecoveryTimelineAxisLabelClass(false)
+ } ${alignmentClass}`}
+ style={{ left: `${tick.positionPct}%` }}
+ >
+ {getRecoveryCompactAxisLabel(point.key, props.chartRangeDays())}
+ </span>
+ );
+ }}
+ </For>
+ </div>
</div>
</div>
</div>
diff --git a/frontend-modern/src/components/Recovery/__tests__/Recovery.test.tsx b/frontend-modern/src/components/Recovery/__tests__/Recovery.test.tsx
index 3417f3286a..d4c1002902 100644
--- a/frontend-modern/src/components/Recovery/__tests__/Recovery.test.tsx
+++ b/frontend-modern/src/components/Recovery/__tests__/Recovery.test.tsx
@@ -1650,7 +1650,7 @@ describe('Recovery', () => {
);
});
- const timelineButtons = await screen.findAllByRole('button', { name: /recovery points/i });
+ const timelineButtons = await screen.findAllByRole('button', { name: /recovery point/i });
fireEvent.click(timelineButtons[0]);
const selectedDay = '2026-02-13';
diff --git a/frontend-modern/src/components/Recovery/__tests__/RecoveryActivitySection.test.tsx b/frontend-modern/src/components/Recovery/__tests__/RecoveryActivitySection.test.tsx
index 9a183f777f..24dbe0659e 100644
--- a/frontend-modern/src/components/Recovery/__tests__/RecoveryActivitySection.test.tsx
+++ b/frontend-modern/src/components/Recovery/__tests__/RecoveryActivitySection.test.tsx
@@ -39,12 +39,17 @@ describe('RecoveryActivitySection', () => {
const bars = screen.getByTestId('recovery-activity-bars');
expect(bars.className).toContain('items-stretch');
+ expect(bars.style.gap).toBe('3px');
expect(bars.parentElement?.className).toContain('h-20');
+ expect(screen.getByTestId('recovery-activity-chart-scroll').className).toContain(
+ 'overflow-x-auto',
+ );
expect(
screen.queryByText('Daily recovery points across the selected history window.'),
).not.toBeInTheDocument();
expect(screen.queryByText(/^Range$/)).not.toBeInTheDocument();
expect(screen.queryByText(/1.5 \/ day/i)).not.toBeInTheDocument();
- expect(screen.getAllByRole('button', { name: /recovery points/i })).toHaveLength(2);
+ expect(screen.getAllByRole('button', { name: /recovery point/i })).toHaveLength(2);
+ expect(screen.getAllByRole('button', { pressed: false })).toHaveLength(2);
});
});
diff --git a/frontend-modern/src/features/recovery/useRecoverySurfaceState.ts b/frontend-modern/src/features/recovery/useRecoverySurfaceState.ts
index e2698f8f08..b9533f8902 100644
--- a/frontend-modern/src/features/recovery/useRecoverySurfaceState.ts
+++ b/frontend-modern/src/features/recovery/useRecoverySurfaceState.ts
@@ -2,7 +2,7 @@ import { createEffect, createMemo, createSignal, onCleanup, untrack } from 'soli
import { useLocation, useNavigate } from '@solidjs/router';
import { useStorageRecoveryResources } from '@/hooks/useUnifiedResources';
-import { useRecoveryRollups } from '@/hooks/useRecoveryRollups';
+import { useRecoveryRollups, type RecoveryRollupsQuery } from '@/hooks/useRecoveryRollups';
import { useRecoveryPoints } from '@/hooks/useRecoveryPoints';
import { useRecoveryPointsFacets } from '@/hooks/useRecoveryPointsFacets';
import { useRecoveryPointsSeries } from '@/hooks/useRecoveryPointsSeries';
@@ -170,26 +170,40 @@ export function useRecoverySurfaceState() {
return chartWindow();
});
- const recoveryRollups = useRecoveryRollups(() => {
+ const buildRecoveryTransportQuery = (
+ window: { from: string; to: string },
+ includeRollupId = true,
+ ): RecoveryRollupsQuery => {
const rid = rollupId().trim();
- const window = chartWindow();
+ const mode = modeFilter();
+ const outcome = historyOutcomeFilter();
+ const scope: 'workload' | null = scopeFilter() === 'workload' ? 'workload' : null;
const vf = verificationFilter();
return {
- rollupId: rid || null,
+ rollupId: includeRollupId && rid ? rid : null,
platform: platformFilter() === 'all' ? null : platformFilter(),
itemType: itemTypeFilter() === 'all' ? null : itemTypeFilter(),
- mode: modeFilter() === 'all' ? null : modeFilter(),
- outcome: historyOutcomeFilter() === 'all' ? null : historyOutcomeFilter(),
+ mode: mode === 'all' ? null : mode,
+ outcome: outcome === 'all' ? null : outcome,
q: queryFilter().trim() || null,
cluster: clusterFilter() === 'all' ? null : clusterFilter(),
node: nodeFilter() === 'all' ? null : nodeFilter(),
namespace: namespaceFilter() === 'all' ? null : namespaceFilter(),
- scope: scopeFilter() === 'workload' ? 'workload' : null,
+ scope,
verification: vf === 'all' ? null : vf,
from: window.from,
to: window.to,
};
- });
+ };
+
+ const chartTransportQuery = createMemo(() => buildRecoveryTransportQuery(chartWindow()));
+ const tableTransportQuery = createMemo(() => buildRecoveryTransportQuery(tableWindow()));
+ const recoverySeriesTransportQuery = createMemo(() => ({
+ ...chartTransportQuery(),
+ tzOffsetMinutes: tzOffsetMinutes(),
+ }));
+
+ const recoveryRollups = useRecoveryRollups(() => chartTransportQuery());
const rollups = createMemo<ProtectionRollup[]>(() => recoveryRollups.rollups() || []);
const selectedRollup = createMemo<ProtectionRollup | null>(() => {
@@ -200,22 +214,7 @@ export function useRecoverySurfaceState() {
const recoveryHistoryItemCatalog = useRecoveryRollups(() => {
if (!rollupId().trim()) return null;
- const window = chartWindow();
- const vf = verificationFilter();
- return {
- platform: platformFilter() === 'all' ? null : platformFilter(),
- itemType: itemTypeFilter() === 'all' ? null : itemTypeFilter(),
- mode: modeFilter() === 'all' ? null : modeFilter(),
- outcome: historyOutcomeFilter() === 'all' ? null : historyOutcomeFilter(),
- q: queryFilter().trim() || null,
- cluster: clusterFilter() === 'all' ? null : clusterFilter(),
- node: nodeFilter() === 'all' ? null : nodeFilter(),
- namespace: namespaceFilter() === 'all' ? null : namespaceFilter(),
- scope: scopeFilter() === 'workload' ? 'workload' : null,
- verification: vf === 'all' ? null : vf,
- from: window.from,
- to: window.to,
- };
+ return buildRecoveryTransportQuery(chartWindow(), false);
});
const selectableRollups = createMemo<ProtectionRollup[]>(() => {
@@ -308,70 +307,16 @@ export function useRecoverySurfaceState() {
});
const recoveryPoints = useRecoveryPoints(() => {
- const rid = rollupId().trim();
- const window = tableWindow();
- const vf = verificationFilter();
return {
+ ...tableTransportQuery(),
page: currentPage(),
limit: 200,
- rollupId: rid || null,
- platform: platformFilter() === 'all' ? null : platformFilter(),
- itemType: itemTypeFilter() === 'all' ? null : itemTypeFilter(),
- cluster: clusterFilter() === 'all' ? null : clusterFilter(),
- mode: modeFilter() === 'all' ? null : modeFilter(),
- outcome: historyOutcomeFilter() === 'all' ? null : historyOutcomeFilter(),
- q: queryFilter().trim() || null,
- node: nodeFilter() === 'all' ? null : nodeFilter(),
- namespace: namespaceFilter() === 'all' ? null : namespaceFilter(),
- scope: scopeFilter() === 'workload' ? 'workload' : null,
- verification: vf === 'all' ? null : vf,
- from: window.from,
- to: window.to,
};
});
- const recoveryFacets = useRecoveryPointsFacets(() => {
- const rid = rollupId().trim();
- const window = tableWindow();
- const vf = verificationFilter();
- return {
- rollupId: rid || null,
- platform: platformFilter() === 'all' ? null : platformFilter(),
- itemType: itemTypeFilter() === 'all' ? null : itemTypeFilter(),
- cluster: clusterFilter() === 'all' ? null : clusterFilter(),
- mode: modeFilter() === 'all' ? null : modeFilter(),
- outcome: historyOutcomeFilter() === 'all' ? null : historyOutcomeFilter(),
- q: queryFilter().trim() || null,
- scope: scopeFilter() === 'workload' ? 'workload' : null,
- node: nodeFilter() === 'all' ? null : nodeFilter(),
- namespace: namespaceFilter() === 'all' ? null : namespaceFilter(),
- verification: vf === 'all' ? null : vf,
- from: window.from,
- to: window.to,
- };
- });
+ const recoveryFacets = useRecoveryPointsFacets(() => tableTransportQuery());
- const recoverySeries = useRecoveryPointsSeries(() => {
- const rid = rollupId().trim();
- const window = chartWindow();
- const vf = verificationFilter();
- return {
- rollupId: rid || null,
- platform: platformFilter() === 'all' ? null : platformFilter(),
- itemType: itemTypeFilter() === 'all' ? null : itemTypeFilter(),
- cluster: clusterFilter() === 'all' ? null : clusterFilter(),
- mode: modeFilter() === 'all' ? null : modeFilter(),
- outcome: historyOutcomeFilter() === 'all' ? null : historyOutcomeFilter(),
- q: queryFilter().trim() || null,
- node: nodeFilter() === 'all' ? null : nodeFilter(),
- namespace: namespaceFilter() === 'all' ? null : namespaceFilter(),
- scope: scopeFilter() === 'workload' ? 'workload' : null,
- verification: vf === 'all' ? null : vf,
- from: window.from,
- to: window.to,
- tzOffsetMinutes: tzOffsetMinutes(),
- };
- });
+ const recoverySeries = useRecoveryPointsSeries(() => recoverySeriesTransportQuery());
createEffect(() => {
const currentPath = `${location.pathname}${location.search || ''}`;
diff --git a/frontend-modern/src/utils/__tests__/recoveryTimelineChartPresentation.test.ts b/frontend-modern/src/utils/__tests__/recoveryTimelineChartPresentation.test.ts
index 5375eb8c16..b11939612d 100644
--- a/frontend-modern/src/utils/__tests__/recoveryTimelineChartPresentation.test.ts
+++ b/frontend-modern/src/utils/__tests__/recoveryTimelineChartPresentation.test.ts
@@ -3,6 +3,8 @@ import {
getRecoveryTimelineAxisLabelClass,
getRecoveryTimelineAxisTicks,
getRecoveryTimelineBarMinWidthClass,
+ getRecoveryTimelineChartGapPx,
+ getRecoveryTimelineChartMinWidthPx,
getRecoveryTimelineLabelEvery,
RECOVERY_TIMELINE_LEGEND_ITEM_CLASS,
RECOVERY_TIMELINE_RANGE_GROUP_CLASS,
@@ -26,22 +28,40 @@ describe('recoveryTimelineChartPresentation', () => {
it('derives label cadence from day count', () => {
expect(getRecoveryTimelineLabelEvery(7)).toBe(1);
- expect(getRecoveryTimelineLabelEvery(15)).toBe(3);
+ expect(getRecoveryTimelineLabelEvery(15)).toBe(5);
+ expect(getRecoveryTimelineLabelEvery(15, true)).toBe(7);
expect(getRecoveryTimelineLabelEvery(60)).toBe(10);
+ expect(getRecoveryTimelineLabelEvery(60, true)).toBe(15);
+ expect(getRecoveryTimelineLabelEvery(365)).toBe(30);
+ });
+
+ it('derives stable range-aware chart sizing', () => {
+ expect(getRecoveryTimelineChartMinWidthPx(false, 7)).toBe(0);
+ expect(getRecoveryTimelineChartMinWidthPx(false, 30)).toBe(0);
+ expect(getRecoveryTimelineChartMinWidthPx(true, 30)).toBe(560);
+ expect(getRecoveryTimelineChartMinWidthPx(false, 90)).toBe(900);
+ expect(getRecoveryTimelineChartMinWidthPx(false, 365)).toBe(2560);
+ expect(getRecoveryTimelineChartGapPx(30)).toBe(3);
+ expect(getRecoveryTimelineChartGapPx(90)).toBe(2);
+ expect(getRecoveryTimelineChartGapPx(365)).toBe(1);
});
it('renders only visible axis ticks for long ranges', () => {
expect(getRecoveryTimelineAxisTicks(0)).toEqual([]);
expect(getRecoveryTimelineAxisTicks(7)).toHaveLength(7);
expect(getRecoveryTimelineAxisTicks(30).map((tick) => tick.index)).toEqual([
- 0, 3, 6, 9, 12, 15, 18, 21, 24, 27, 29,
+ 0, 5, 10, 15, 20, 29,
]);
expect(getRecoveryTimelineAxisTicks(365).map((tick) => tick.index)).toEqual([
- 0, 10, 20, 30, 40, 50, 60, 70, 80, 90, 100, 110, 120, 130, 140, 150, 160, 170,
- 180, 190, 200, 210, 220, 230, 240, 250, 260, 270, 280, 290, 300, 310, 320, 330,
- 340, 350, 360, 364,
+ 0, 30, 60, 90, 120, 150, 180, 210, 240, 270, 300, 330, 364,
]);
expect(getRecoveryTimelineAxisTicks(365).at(0)?.align).toBe('start');
expect(getRecoveryTimelineAxisTicks(365).at(-1)?.align).toBe('end');
});
+
+ it('honors the timeline model cadence when supplied', () => {
+ expect(getRecoveryTimelineAxisTicks(30, false, 10).map((tick) => tick.index)).toEqual([
+ 0, 10, 29,
+ ]);
+ });
});
diff --git a/frontend-modern/src/utils/__tests__/recoveryTimelinePresentation.test.ts b/frontend-modern/src/utils/__tests__/recoveryTimelinePresentation.test.ts
index c87ac61df6..585f3b6ff9 100644
--- a/frontend-modern/src/utils/__tests__/recoveryTimelinePresentation.test.ts
+++ b/frontend-modern/src/utils/__tests__/recoveryTimelinePresentation.test.ts
@@ -1,12 +1,26 @@
import { describe, expect, it } from 'vitest';
-import { getRecoveryTimelineColumnButtonClass } from '@/utils/recoveryTimelinePresentation';
+import {
+ getRecoveryTimelineColumnAriaLabel,
+ getRecoveryTimelineColumnButtonClass,
+} from '@/utils/recoveryTimelinePresentation';
describe('getRecoveryTimelineColumnButtonClass', () => {
it('returns the canonical selected class', () => {
- expect(getRecoveryTimelineColumnButtonClass(true)).toBe('bg-blue-100 dark:bg-blue-900');
+ expect(getRecoveryTimelineColumnButtonClass(true)).toContain('bg-blue-100');
+ expect(getRecoveryTimelineColumnButtonClass(true)).toContain('ring-blue-500');
});
it('returns the canonical hover class when unselected', () => {
- expect(getRecoveryTimelineColumnButtonClass(false)).toBe('hover:bg-surface-hover');
+ expect(getRecoveryTimelineColumnButtonClass(false)).toContain('hover:bg-surface-hover');
+ expect(getRecoveryTimelineColumnButtonClass(false)).toContain('focus-visible:outline');
+ });
+
+ it('builds accessible selected-day labels', () => {
+ expect(getRecoveryTimelineColumnAriaLabel('Feb 13, 2026', 1, false)).toBe(
+ 'Feb 13, 2026: 1 recovery point',
+ );
+ expect(getRecoveryTimelineColumnAriaLabel('Feb 14, 2026', 2, true)).toBe(
+ 'Feb 14, 2026: 2 recovery points, selected',
+ );
});
});
diff --git a/frontend-modern/src/utils/recoveryTimelineChartPresentation.ts b/frontend-modern/src/utils/recoveryTimelineChartPresentation.ts
index 65553f9e50..b10d7eca2f 100644
--- a/frontend-modern/src/utils/recoveryTimelineChartPresentation.ts
+++ b/frontend-modern/src/utils/recoveryTimelineChartPresentation.ts
@@ -2,6 +2,8 @@ export const RECOVERY_TIMELINE_LEGEND_ITEM_CLASS = 'flex items-center gap-1';
export const RECOVERY_TIMELINE_RANGE_GROUP_CLASS =
'inline-flex rounded border border-border bg-surface p-0.5 text-xs';
+export type RecoveryTimelineRangeDays = 7 | 30 | 90 | 365;
+
export interface RecoveryTimelineAxisTick {
index: number;
positionPct: number;
@@ -23,22 +25,49 @@ export function getRecoveryTimelineBarMinWidthClass(
return 'min-w-[8px]';
}
-export function getRecoveryTimelineLabelEvery(dayCount: number): number {
+export function getRecoveryTimelineChartMinWidthPx(
+ isMobile: boolean,
+ days: RecoveryTimelineRangeDays,
+ pointCount: number = days,
+): number {
+ const effectiveDays = Math.max(days, pointCount);
+ if (effectiveDays <= 7) return 0;
+ if (effectiveDays <= 30) return isMobile ? 560 : 0;
+ if (effectiveDays <= 90) return 900;
+ return 2560;
+}
+
+export function getRecoveryTimelineChartGapPx(days: RecoveryTimelineRangeDays): number {
+ if (days >= 365) return 1;
+ if (days >= 90) return 2;
+ return 3;
+}
+
+export function getRecoveryTimelineLabelEvery(dayCount: number, isMobile = false): number {
if (dayCount <= 7) return 1;
- if (dayCount <= 30) return 3;
- return 10;
+ if (dayCount <= 30) return isMobile ? 7 : 5;
+ if (dayCount <= 90) return isMobile ? 15 : 10;
+ return 30;
}
-export function getRecoveryTimelineAxisTicks(dayCount: number): RecoveryTimelineAxisTick[] {
+export function getRecoveryTimelineAxisTicks(
+ dayCount: number,
+ isMobile = false,
+ labelEveryOverride?: number,
+): RecoveryTimelineAxisTick[] {
if (dayCount <= 0) return [];
- const labelEvery = getRecoveryTimelineLabelEvery(dayCount);
+ const labelEvery =
+ typeof labelEveryOverride === 'number' && Number.isFinite(labelEveryOverride)
+ ? Math.max(1, Math.floor(labelEveryOverride))
+ : getRecoveryTimelineLabelEvery(dayCount, isMobile);
const lastIndex = dayCount - 1;
const ticks: RecoveryTimelineAxisTick[] = [];
for (let index = 0; index < dayCount; index += 1) {
const isBoundary = index === 0 || index === lastIndex;
if (!isBoundary && index % labelEvery !== 0) continue;
+ if (!isBoundary && lastIndex - index < labelEvery) continue;
const positionPct = dayCount === 1 ? 0 : (index / lastIndex) * 100;
ticks.push({
diff --git a/frontend-modern/src/utils/recoveryTimelinePresentation.ts b/frontend-modern/src/utils/recoveryTimelinePresentation.ts
index be20e1a63b..b2ab5e138d 100644
--- a/frontend-modern/src/utils/recoveryTimelinePresentation.ts
+++ b/frontend-modern/src/utils/recoveryTimelinePresentation.ts
@@ -1,3 +1,16 @@
export function getRecoveryTimelineColumnButtonClass(selected: boolean): string {
- return selected ? 'bg-blue-100 dark:bg-blue-900' : 'hover:bg-surface-hover';
+ const base =
+ 'rounded-sm focus-visible:outline focus-visible:outline-2 focus-visible:outline-offset-1 focus-visible:outline-blue-500';
+ return selected
+ ? `${base} bg-blue-100 ring-1 ring-blue-500/70 dark:bg-blue-900`
+ : `${base} hover:bg-surface-hover`;
+}
+
+export function getRecoveryTimelineColumnAriaLabel(
+ dateLabel: string,
+ total: number,
+ selected: boolean,
+): string {
+ const countLabel = `${total} recovery point${total === 1 ? '' : 's'}`;
+ return selected ? `${dateLabel}: ${countLabel}, selected` : `${dateLabel}: ${countLabel}`;
}
diff --git a/tests/integration/tests/17-recovery-layout.spec.ts b/tests/integration/tests/17-recovery-layout.spec.ts
index 8067b61dae..e3e82dc493 100644
--- a/tests/integration/tests/17-recovery-layout.spec.ts
+++ b/tests/integration/tests/17-recovery-layout.spec.ts
@@ -4,6 +4,67 @@ import { ensureAuthenticated } from "./helpers";
const DESKTOP_VIEWPORT = { width: 1280, height: 900 };
const RECOVERY_SUBJECT_LABEL = "Archive VM For Production Ledger Services";
+const RECOVERY_DAY_MS = 24 * 60 * 60 * 1000;
+
+const recoveryUtcDateKey = (date: Date): string => {
+ const year = date.getUTCFullYear();
+ const month = String(date.getUTCMonth() + 1).padStart(2, "0");
+ const day = String(date.getUTCDate()).padStart(2, "0");
+ return `${year}-${month}-${day}`;
+};
+
+const recoveryTransportDay = (date: Date, tzOffsetMinutes: number): number => {
+ const shifted = new Date(date.getTime() + tzOffsetMinutes * 60 * 1000);
+ return Date.UTC(
+ shifted.getUTCFullYear(),
+ shifted.getUTCMonth(),
+ shifted.getUTCDate(),
+ );
+};
+
+const buildRecoverySeries = (url: string) => {
+ const requestUrl = new URL(url);
+ const from = requestUrl.searchParams.get("from");
+ const to = requestUrl.searchParams.get("to");
+ if (!from || !to) return mockRecoveryData.series;
+
+ const fromDate = new Date(from);
+ const toDate = new Date(to);
+ const parsedTzOffset = Number.parseInt(
+ requestUrl.searchParams.get("tzOffsetMinutes") || "0",
+ 10,
+ );
+ const tzOffsetMinutes = Number.isFinite(parsedTzOffset)
+ ? parsedTzOffset
+ : 0;
+ const fromDay = recoveryTransportDay(fromDate, tzOffsetMinutes);
+ const toDay = recoveryTransportDay(toDate, tzOffsetMinutes);
+ const daySpan = Math.floor((toDay - fromDay) / RECOVERY_DAY_MS) + 1;
+ if (!Number.isFinite(daySpan) || daySpan < 1) return mockRecoveryData.series;
+
+ const bucketCount = Math.min(daySpan, 365);
+
+ return {
+ data: Array.from({ length: bucketCount }, (_, index) => {
+ const pointDate = new Date(fromDay + index * RECOVERY_DAY_MS);
+ const day = recoveryUtcDateKey(pointDate);
+ const remote =
+ index === 0 ||
+ index === bucketCount - 1 ||
+ (bucketCount > 30 && index % 29 === 0) ||
+ (bucketCount > 14 && index > bucketCount - 8)
+ ? 1
+ : 0;
+ return {
+ day,
+ total: remote,
+ snapshot: 0,
+ local: 0,
+ remote,
+ };
+ }),
+ };
+};
const mockRecoveryData = {
rollups: {
@@ -117,7 +178,7 @@ async function mockRecoveryEndpoints(page: Page): Promise<void> {
await route.fulfill({
status: 200,
contentType: "application/json",
- body: JSON.stringify(mockRecoveryData.series),
+ body: JSON.stringify(buildRecoverySeries(route.request().url())),
});
});
}
@@ -198,4 +259,111 @@ test.describe("Recovery desktop layout guards", () => {
`Recovery outcome header should stay inside the visible desktop wrapper (wrapperRight=${wrapperRight}, outcomeRight=${outcomeRight})`,
).toBeLessThanOrEqual(wrapperRight + 1);
});
+
+ test("long-range activity timeline stays readable and keeps selected day in the route", async ({
+ page,
+ }, testInfo) => {
+ const seriesRequests: string[] = [];
+
+ if (!testInfo.project.name.startsWith("mobile-")) {
+ await page.setViewportSize(DESKTOP_VIEWPORT);
+ }
+ await ensureAuthenticated(page);
+ await mockRecoveryEndpoints(page);
+ await page.route("**/api/recovery/series*", async (route) => {
+ seriesRequests.push(route.request().url());
+ await route.fulfill({
+ status: 200,
+ contentType: "application/json",
+ body: JSON.stringify(buildRecoverySeries(route.request().url())),
+ });
+ });
+
+ await page.goto("/recovery?view=events&range=365&node=pve-archive-01", {
+ waitUntil: "domcontentloaded",
+ });
+ await expect(page.getByTestId("recovery-page")).toBeVisible();
+
+ const chartScroll = page.getByTestId("recovery-activity-chart-scroll");
+ const bars = page.getByTestId("recovery-activity-bars");
+ await expect(chartScroll).toBeVisible();
+ await expect(bars).toBeVisible();
+
+ const chartMetrics = await chartScroll.evaluate((element) => {
+ const scroller = element as HTMLElement;
+ const labels = Array.from(
+ scroller.querySelectorAll(".pointer-events-none span"),
+ ).map((label) => {
+ const rect = (label as HTMLElement).getBoundingClientRect();
+ return { left: rect.left, right: rect.right, text: label.textContent };
+ });
+ const overlaps = labels.some((label, index) => {
+ const next = labels[index + 1];
+ return next ? label.right > next.left + 1 : false;
+ });
+ return {
+ clientWidth: scroller.clientWidth,
+ scrollWidth: scroller.scrollWidth,
+ labelCount: labels.length,
+ overlaps,
+ firstLabel: labels[0]?.text || "",
+ lastLabel: labels.at(-1)?.text || "",
+ };
+ });
+
+ expect(chartMetrics.scrollWidth).toBeGreaterThan(chartMetrics.clientWidth);
+ expect(chartMetrics.labelCount).toBeGreaterThan(0);
+ expect(chartMetrics.labelCount).toBeLessThanOrEqual(16);
+ expect(chartMetrics.overlaps).toBe(false);
+ expect(chartMetrics.firstLabel).toBeTruthy();
+ expect(chartMetrics.lastLabel).toBeTruthy();
+
+ await expect.poll(() => seriesRequests.length).toBeGreaterThan(0);
+ expect(
+ seriesRequests.some(
+ (url) =>
+ url.includes("/api/recovery/series") &&
+ url.includes("node=pve-archive-01") &&
+ url.includes("tzOffsetMinutes="),
+ ),
+ ).toBe(true);
+
+ const firstTimelineButton = bars.getByRole("button").first();
+ await firstTimelineButton.click();
+ await expect(page).toHaveURL(/\/recovery\?.*day=\d{4}-\d{2}-\d{2}/);
+
+ await page.goto("/recovery?view=events&range=7&node=pve-archive-01", {
+ waitUntil: "domcontentloaded",
+ });
+ await expect(page.getByTestId("recovery-page")).toBeVisible();
+ await expect.poll(() => chartScroll.locator("button").count()).toBe(7);
+
+ const shortRangeMetrics = await chartScroll.evaluate((element) => {
+ const scroller = element as HTMLElement;
+ const labels = Array.from(
+ scroller.querySelectorAll(".pointer-events-none span"),
+ ).map((label) => {
+ const rect = (label as HTMLElement).getBoundingClientRect();
+ return { left: rect.left, right: rect.right, text: label.textContent };
+ });
+ const overlaps = labels.some((label, index) => {
+ const next = labels[index + 1];
+ return next ? label.right > next.left + 1 : false;
+ });
+ return {
+ clientWidth: scroller.clientWidth,
+ scrollWidth: scroller.scrollWidth,
+ labelCount: labels.length,
+ buttonCount: scroller.querySelectorAll("button").length,
+ overlaps,
+ };
+ });
+
+ expect(shortRangeMetrics.scrollWidth).toBeLessThanOrEqual(
+ shortRangeMetrics.clientWidth + 1,
+ );
+ expect(shortRangeMetrics.buttonCount).toBe(7);
+ expect(shortRangeMetrics.labelCount).toBe(7);
+ expect(shortRangeMetrics.overlaps).toBe(false);
+ });
});