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.

refactor(recovery): move range control to summary

rcourtmandecb276af570
diff --git a/docs/release-control/v6/internal/subsystems/storage-recovery.md b/docs/release-control/v6/internal/subsystems/storage-recovery.md
index 3af96e74bd..d275d163ca 100644
--- a/docs/release-control/v6/internal/subsystems/storage-recovery.md
+++ b/docs/release-control/v6/internal/subsystems/storage-recovery.md
@@ -788,6 +788,11 @@ That same differentiation rule applies across cards too. `Posture` and
`Freshness` should not lead with the same stale/attention headline; the
freshness card should emphasize recent successful coverage such as fresh-in-24h
reach, while posture owns the attention-state headline.
+That same page-level ownership applies to the recovery time window. Recovery
+should use the shared summary-panel range control as the canonical time-range
+selector, the same way infrastructure and workloads do, instead of hiding a
+separate range selector inside the activity strip and making operators manage
+two competing range affordances for one page.
That same density rule should route through the shared summary primitives
instead of feature-local spacing overrides. Recovery may select the shared
default `SummaryPanel` / `SummaryMetricCard` density mode, and it should not
diff --git a/frontend-modern/src/components/Recovery/Recovery.tsx b/frontend-modern/src/components/Recovery/Recovery.tsx
index 3029774c2d..4191535238 100644
--- a/frontend-modern/src/components/Recovery/Recovery.tsx
+++ b/frontend-modern/src/components/Recovery/Recovery.tsx
@@ -409,6 +409,12 @@ const Recovery: Component = () => {
if (range === 365) return '365d';
return '30d';
});
+ const setSummaryRange = (range: RecoverySummaryRange) => {
+ const nextRange = range === '7d' ? 7 : range === '90d' ? 90 : range === '365d' ? 365 : 30;
+ setChartRangeDays(nextRange);
+ setSelectedDateKey(null);
+ setCurrentPage(1);
+ };
const hasActiveArtifactFilters = createMemo(
() =>
@@ -528,11 +534,6 @@ const Recovery: Component = () => {
selectedDateKey={selectedDateKey}
selectedDateLabel={selectedDateLabel}
selectedHistoryItemLabel={selectedHistoryItemLabel}
- setChartRangeDays={(range) => {
- setChartRangeDays(range);
- setSelectedDateKey(null);
- setCurrentPage(1);
- }}
timeline={timeline}
toggleSelectedDate={(key) => {
setWorkspaceView('events');
@@ -551,6 +552,7 @@ const Recovery: Component = () => {
seriesFailed={() => Boolean(recoverySeries.response.error)}
summary={overallRollupsSummary}
timeRange={summaryRange}
+ onTimeRangeChange={setSummaryRange}
/>
{workspaceControls()}
diff --git a/frontend-modern/src/components/Recovery/RecoveryActivitySection.tsx b/frontend-modern/src/components/Recovery/RecoveryActivitySection.tsx
index f3217fa0dd..9f3a8e13f6 100644
--- a/frontend-modern/src/components/Recovery/RecoveryActivitySection.tsx
+++ b/frontend-modern/src/components/Recovery/RecoveryActivitySection.tsx
@@ -3,7 +3,6 @@ import type { Accessor, Component, JSX } from 'solid-js';
import { Card } from '@/components/shared/Card';
import { hideTooltip, showTooltip } from '@/components/shared/Tooltip';
-import { segmentedButtonClass } from '@/utils/segmentedButton';
import {
getRecoveryBreadcrumbLinkClass,
} from '@/utils/recoveryActionPresentation';
@@ -21,7 +20,6 @@ import {
getRecoveryTimelineAxisLabelClass,
getRecoveryTimelineAxisTicks,
RECOVERY_TIMELINE_LEGEND_ITEM_CLASS,
- RECOVERY_TIMELINE_RANGE_GROUP_CLASS,
} from '@/utils/recoveryTimelineChartPresentation';
import { getRecoveryTimelineColumnButtonClass } from '@/utils/recoveryTimelinePresentation';
@@ -72,13 +70,10 @@ interface RecoveryActivitySectionProps {
selectedDateKey: Accessor<string | null>;
selectedDateLabel: Accessor<string>;
selectedHistoryItemLabel: Accessor<string | null>;
- setChartRangeDays: (value: 7 | 30 | 90 | 365) => void;
toggleSelectedDate: (key: string) => void;
timeline: Accessor<TimelineModel>;
}
-const rangeOptions: Array<7 | 30 | 90 | 365> = [7, 30, 90, 365];
-
function RecoveryActivitySectionContent(props: RecoveryActivitySectionProps): JSX.Element {
const timelineAxisTicks = () => getRecoveryTimelineAxisTicks(props.timeline().points.length);
@@ -223,22 +218,7 @@ function RecoveryActivitySectionContent(props: RecoveryActivitySectionProps): JS
</Show>
<div class="rounded-lg border border-border-subtle bg-surface-alt/25 px-2 py-1.5">
- <div
- class={`mb-1 flex flex-wrap items-center justify-between gap-2 ${RECOVERY_TIMELINE_RANGE_GROUP_CLASS}`}
- >
- <div class={RECOVERY_TIMELINE_RANGE_GROUP_CLASS}>
- <For each={rangeOptions}>
- {(range) => (
- <button
- type="button"
- onClick={() => props.setChartRangeDays(range)}
- class={`px-2 py-1 ${segmentedButtonClass(props.chartRangeDays() === range, false, 'accent')}`}
- >
- {range}d
- </button>
- )}
- </For>
- </div>
+ <div class="mb-1 flex flex-wrap items-center justify-end gap-1.5 text-[9px] text-muted">
<div class="flex flex-wrap items-center gap-1.5 text-[9px] text-muted">
<div class={RECOVERY_TIMELINE_LEGEND_ITEM_CLASS}>
<span class={`h-2.5 w-2.5 rounded ${getRecoveryArtifactModePresentation('snapshot').segmentClassName}`} />
diff --git a/frontend-modern/src/components/Recovery/__tests__/Recovery.test.tsx b/frontend-modern/src/components/Recovery/__tests__/Recovery.test.tsx
index 5d40b64382..1777e9a960 100644
--- a/frontend-modern/src/components/Recovery/__tests__/Recovery.test.tsx
+++ b/frontend-modern/src/components/Recovery/__tests__/Recovery.test.tsx
@@ -378,6 +378,13 @@ describe('Recovery', () => {
expect(within(historyControls).getByLabelText('Item type').className).not.toContain('min-w-[');
expect(within(historyControls).getByLabelText('Platform').className).not.toContain('min-w-[');
expect(within(historyControls).getByLabelText('Status').className).not.toContain('min-w-[');
+ const recoverySummaryPanel = screen.getByTestId('recovery-summary');
+ expect(within(recoverySummaryPanel).getByRole('button', { name: '7d' })).toBeInTheDocument();
+ expect(within(recoverySummaryPanel).getByRole('button', { name: '30d' })).toBeInTheDocument();
+ expect(within(recoverySummaryPanel).getByRole('button', { name: '90d' })).toBeInTheDocument();
+ expect(within(recoverySummaryPanel).getByRole('button', { name: '365d' })).toBeInTheDocument();
+ expect(within(historyControls).queryByRole('button', { name: '7d' })).not.toBeInTheDocument();
+ expect(screen.getAllByRole('button', { name: '7d' })).toHaveLength(1);
expect(within(historyTable).getByText('Item Type')).toBeInTheDocument();
expect(within(historyTable).getByText('Item')).toBeInTheDocument();
expect(within(historyTable).getByText('Platform')).toBeInTheDocument();
diff --git a/frontend-modern/src/components/Recovery/__tests__/RecoveryActivitySection.test.tsx b/frontend-modern/src/components/Recovery/__tests__/RecoveryActivitySection.test.tsx
index bb3fc237cc..4bd455a837 100644
--- a/frontend-modern/src/components/Recovery/__tests__/RecoveryActivitySection.test.tsx
+++ b/frontend-modern/src/components/Recovery/__tests__/RecoveryActivitySection.test.tsx
@@ -35,7 +35,6 @@ describe('RecoveryActivitySection', () => {
selectedDateKey={() => null}
selectedDateLabel={() => ''}
selectedHistoryItemLabel={() => null}
- setChartRangeDays={() => undefined}
timeline={timeline}
toggleSelectedDate={() => undefined}
/>