fix(xo-web): changing items per page should select page 1

Fixes #7350
This commit is contained in:
Julien Fontanet 2024-02-07 16:02:49 +01:00
parent 83a94eefd6
commit 287378f9c6
3 changed files with 12 additions and 0 deletions

View File

@ -13,6 +13,7 @@
- [Import/VMWare] Fix `(Failure \"Expected string, got 'I(0)'\")` (PR [#7361](https://github.com/vatesfr/xen-orchestra/issues/7361))
- [Plugin/load-balancer] Fixing `TypeError: Cannot read properties of undefined (reading 'high')` happening when trying to optimize a host with performance plan [#7359](https://github.com/vatesfr/xen-orchestra/issues/7359) (PR [#7362](https://github.com/vatesfr/xen-orchestra/pull/7362))
- Changing the number of displayed items per page should send back to the first page [#7350](https://github.com/vatesfr/xen-orchestra/issues/7350)
### Packages to release
@ -32,5 +33,6 @@
- xo-server patch
- xo-server-load-balancer patch
- xo-web patch
<!--packages-end-->

View File

@ -752,6 +752,11 @@ class SortedTable extends Component {
const { location, stateUrlParam } = this.props
this.setState({ itemsPerPage })
cookies.set(`${location.pathname}-${stateUrlParam}`, itemsPerPage)
// changing the number of items per page should send back to the first page
//
// see https://github.com/vatesfr/xen-orchestra/issues/7350
this._setPage(1)
}
render() {

View File

@ -555,6 +555,11 @@ export default class Home extends Component {
_setNItemsPerPage(nItems) {
this.setState({ homeItemsPerPage: nItems })
cookies.set('homeItemsPerPage', nItems)
// changing the number of items per page should send back to the first page
//
// see https://github.com/vatesfr/xen-orchestra/issues/7350
this._onPageSelection(1)
}
_getPage() {