feat(ui): add items per page persistence to DataTable
#5646
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
This pull request introduces a user preference feature that allows the number of items displayed per page in various data tables to be persisted on a per-table basis using localStorage. This ensures that when users revisit a table, their preferred items-per-page setting is retained. The implementation is integrated across both admin and user-facing tables, and comprehensive tests have been added to verify the new behavior.
useTablePreference, which providesgetItemsPerPageandsetItemsPerPagefunctions to store and retrieve the user's preferred items-per-page for each table using localStorage. This includes robust error handling for localStorage failures.DataTablecomponent to accept a new optionaltableNameprop. When provided, the component loads the initial items-per-page value from localStorage and persists any changes to it.table-nameprop to all relevant table components (e.g.,SessionList,DeviceList,UserList,FirewallRulesList, etc.), both in the admin and user interfaces, with unique names for each table. [DataTable.spec.ts, covering loading from localStorage, saving changes, and error handling.table-nameprop and minor changes in the rendered markup.