Let the user choose how many table rows a page shows
Problem Description
The Containers and Volumes tables show 10 rows a page, hardcoded, with no control to change it. A machine running a couple of compose projects easily has thirty or more containers, which means turning four pages to see them all — and because the bulk actions only apply to the current page, a selection cannot span pages either.
Proposed Solution
Put a page-size selector in the paging footer, next to the paging controls that are already there.
The sizes to offer already exist: ROWS_PER_PAGE in store/prefs.js declares
[10, 25, 50, 100, 250, 500, 1000], and SortableTable already reads that
preference when a caller does not pin rows-per-page. Nothing in the app ever
sets it, so the preference has never been reachable. Wiring the selector to it
gives every table that follows the preference the same control, and Containers and
Volumes can stop hardcoding 10.
Details worth stating:
- The footer stays visible when a single page holds every row, so the selector is still reachable after picking a large size.
- The selector stays hidden for a table whose caller pins
rows-per-page(image scan results) and for one small enough that the smallest size shows everything. - The choice is remembered, so it does not have to be made again on every launch.
Additional Information
Related: #10958 raises the default page size to 1000 for all tables. The two changes are compatible — that one picks a better default, this one lets the user pick at all — but they touch the same lines in Containers.vue and Volumes.vue, so whichever lands second needs a rebase. Happy to fold this into that PR instead if that is preferred.
A pull request follows.
Source: rancher-sandbox/rancher-desktop