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): remove protected items pagination

rcourtmanb8b766b1ac86
diff --git a/docs/release-control/v6/internal/subsystems/storage-recovery.md b/docs/release-control/v6/internal/subsystems/storage-recovery.md
index 946a7dd944..8e20973c25 100644
--- a/docs/release-control/v6/internal/subsystems/storage-recovery.md
+++ b/docs/release-control/v6/internal/subsystems/storage-recovery.md
@@ -829,6 +829,11 @@ already used elsewhere in Pulse. Protected items should surface posture through
row-level status cues, outcome pills, and filters rather than inserting extra
`Needs Attention` / `Healthy Coverage` section rows that add height and turn
the primary table into a recovery-only grouped report.
+That same protected-items table should also avoid recovery-local pagination
+chrome. The workspace already holds the filtered rollups client-side, so it
+should read as one continuous monitoring table with a simple protected-item
+count instead of introducing `Prev` / `Next` buttons and page counters that do
+not match the canonical Pulse scan pattern.
That same table-shell contract must avoid duplicate framing once the view tabs
already establish the active workspace. `RecoveryProtectedInventorySection.tsx`
should keep page/count/sort orientation inside a slim table-shell status row
diff --git a/frontend-modern/src/components/Recovery/RecoveryProtectedInventorySection.tsx b/frontend-modern/src/components/Recovery/RecoveryProtectedInventorySection.tsx
index 2c3d1df381..9b6b09e5fa 100644
--- a/frontend-modern/src/components/Recovery/RecoveryProtectedInventorySection.tsx
+++ b/frontend-modern/src/components/Recovery/RecoveryProtectedInventorySection.tsx
@@ -87,13 +87,10 @@ interface RecoveryProtectedInventorySectionProps {
}
const availableOutcomes = ['all', 'success', 'warning', 'failed', 'running'] as const;
-const PROTECTED_ITEMS_PAGE_SIZE = 24;
-
export const RecoveryProtectedInventorySection: Component<
RecoveryProtectedInventorySectionProps
> = (props) => {
const [protectedFiltersOpen, setProtectedFiltersOpen] = createSignal(false);
- const [protectedPage, setProtectedPage] = createSignal(1);
const [protectedSortCol, setProtectedSortCol] = createSignal<ProtectedSortCol>('outcome');
const [protectedSortDir, setProtectedSortDir] = createSignal<SortDir>('desc');
@@ -183,23 +180,6 @@ export const RecoveryProtectedInventorySection: Component<
return items;
});
- const protectedTotalPages = createMemo(() =>
- Math.max(1, Math.ceil(sortedRollups().length / PROTECTED_ITEMS_PAGE_SIZE)),
- );
-
- const visibleRollups = createMemo<ProtectionRollup[]>(() => {
- const start = (protectedPage() - 1) * PROTECTED_ITEMS_PAGE_SIZE;
- return sortedRollups().slice(start, start + PROTECTED_ITEMS_PAGE_SIZE);
- });
-
- const pageStart = createMemo(() =>
- sortedRollups().length === 0 ? 0 : (protectedPage() - 1) * PROTECTED_ITEMS_PAGE_SIZE + 1,
- );
-
- const pageEnd = createMemo(() =>
- Math.min(protectedPage() * PROTECTED_ITEMS_PAGE_SIZE, sortedRollups().length),
- );
-
createEffect(() => {
props.queryFilter();
props.platformFilter();
@@ -208,14 +188,6 @@ export const RecoveryProtectedInventorySection: Component<
props.protectedStaleOnly();
protectedSortCol();
protectedSortDir();
- setProtectedPage(1);
- });
-
- createEffect(() => {
- const totalPages = protectedTotalPages();
- if (protectedPage() > totalPages) {
- setProtectedPage(totalPages);
- }
});
const resetProtectedFilters = () => {
@@ -318,7 +290,7 @@ export const RecoveryProtectedInventorySection: Component<
groupClass="gap-1.5 px-1.5 py-0.5"
selectClass="py-1 text-xs"
>
- <For each={availableOutcomes}>
+ <For each={availableOutcomes}>
{(outcome) => (
<option value={outcome}>
{outcome === 'all' ? 'Any status' : titleCaseDelimitedLabel(outcome)}
@@ -412,7 +384,7 @@ export const RecoveryProtectedInventorySection: Component<
</TableRow>
</TableHeader>
<TableBody>
- <For each={visibleRollups()}>
+ <For each={sortedRollups()}>
{(rollup) => {
const resourceIndex = props.resourcesById();
const label = getRecoveryRollupItemLabel(rollup, resourceIndex);
@@ -551,34 +523,9 @@ export const RecoveryProtectedInventorySection: Component<
when={sortedRollups().length > 0}
fallback={<span>Showing 0 of 0 protected items</span>}
>
- <span>
- Showing {pageStart()} - {pageEnd()} of {sortedRollups().length} protected items
- </span>
+ <span>Showing {sortedRollups().length} protected items</span>
</Show>
</div>
- <div class="flex items-center gap-2">
- <button
- type="button"
- disabled={protectedPage() <= 1}
- onClick={() => setProtectedPage(Math.max(1, protectedPage() - 1))}
- class="rounded-md border border-border bg-surface px-2 py-1 text-xs font-medium text-base-content disabled:opacity-50"
- >
- Prev
- </button>
- <span>
- Page {protectedPage()} / {protectedTotalPages()}
- </span>
- <button
- type="button"
- disabled={protectedPage() >= protectedTotalPages()}
- onClick={() =>
- setProtectedPage(Math.min(protectedTotalPages(), protectedPage() + 1))
- }
- class="rounded-md border border-border bg-surface px-2 py-1 text-xs font-medium text-base-content disabled:opacity-50"
- >
- Next
- </button>
- </div>
</div>
</Show>
</Card>
diff --git a/frontend-modern/src/components/Recovery/__tests__/Recovery.test.tsx b/frontend-modern/src/components/Recovery/__tests__/Recovery.test.tsx
index abe1c09bd7..a5ea5438a5 100644
--- a/frontend-modern/src/components/Recovery/__tests__/Recovery.test.tsx
+++ b/frontend-modern/src/components/Recovery/__tests__/Recovery.test.tsx
@@ -233,8 +233,9 @@ describe('Recovery', () => {
).not.toContain('rounded-md');
expect(screen.queryByText('Protected inventory')).not.toBeInTheDocument();
expect(screen.queryByText('Needs Attention')).not.toBeInTheDocument();
- expect(screen.getAllByText(/Page 1 \/ 1/i).length).toBeGreaterThan(0);
expect(screen.getByText(/^2 protected items$/i)).toBeInTheDocument();
+ expect(screen.queryByRole('button', { name: 'Prev' })).not.toBeInTheDocument();
+ expect(screen.queryByRole('button', { name: 'Next' })).not.toBeInTheDocument();
expect(screen.getByRole('tab', { name: /recovery events/i })).toHaveAttribute(
'aria-selected',
'false',
@@ -953,15 +954,9 @@ describe('Recovery', () => {
render(() => <Recovery />);
- expect(await screen.findByText('Showing 1 - 24 of 26 protected items')).toBeInTheDocument();
- expect(screen.getAllByText('Page 1 / 2').length).toBeGreaterThan(0);
-
- fireEvent.click(screen.getByRole('button', { name: 'Next' }));
-
- await waitFor(() => {
- expect(screen.getByText('Showing 25 - 26 of 26 protected items')).toBeInTheDocument();
- expect(screen.getAllByText('Page 2 / 2').length).toBeGreaterThan(0);
- });
+ expect(await screen.findByText('Showing 26 protected items')).toBeInTheDocument();
+ expect(screen.queryByRole('button', { name: 'Next' })).not.toBeInTheDocument();
+ expect(screen.queryByRole('button', { name: 'Prev' })).not.toBeInTheDocument();
});
it('persists and restores the protected stale-only filter through the canonical recovery URL', async () => {