New host page and paging

Problem:
With 3.16 the new host page is the default. I have noticed that changing the paging settings at the bottom doesn’t work properly. For instance:

  1. I go to the host pages, i.e. /new/hosts. It shows me first page, i.e. “1-20 of 294” hosts.
  2. I enter upgradable_rpms = kernel-core-4.18.0-553.109.1.el8_10.x86_64 into the search field and press the arrow. It now shows me first page 1-20 of 26 matching hosts.
  3. I switch the selector at the bottom from “1 - 20 of 26 items” to “50 per page”.
  4. That takes me to /new/hosts?search=&page=1&per_page=50 showing the first 50 hosts of all hosts, i.e. “1 - 50 of 294”.

Changing it using the top left selector (which doesn’t mention “items”) seems to work properly though.

Expected outcome:
Page selection regardless of which selector I use.

Foreman and Proxy versions:
katello-4.18.1-1.el9.noarch
foreman-3.16.2-1.el9.noarch

Distribution and version:
AlmaLinux 9.7

This looks like Bug #38858: Search is cleared when using bottom pagination on All Hosts page - Foreman which is fixed in 3.18. The workaround is to use the top pagination buttons instead of the bottom.

Thanks. That doesn’t look like a big diff. Do you think it can be backported? I am still on 3.16, waiting for 3.17.1 to upgrade to. 3.18 is still in RC. I am a creature of habit and usually use the bottom page controls…

I think it’s too late for 3.17.1, but 3.17.2 is possible. I opened a cherry-pick PR.