foreman_ansible
foreman_ansible copied to clipboard
Fixes #36469 - Fix Ansible Roles and Variables sub-tabs pagination
Since there is no easy way to do pagination with Graphql at the moment,
we are using first
and last
variables in the query.
to make the pagination work on tables where page * per_page > totalCount
,
we needed to add the following calculation for the last
variable
Clicking the "Next" icon on the Roles tab alters the displayed item count when moving between page.
Update: After adding more variables (16 total), I encountered the same issue in the Variables tab as in the Roles tab.
@nofaralfasi Hey, can you check again?
The Variables
tab works well.
However, on the Roles
tab, if I try to go to the last page, I get No roles assigned directly to the host
, instead of the list of the remaining roles.
Now, both tabs are working well. One interesting thing that I noticed is that when the number of displayed roles/variables is 5 or fewer, the issue with the disappearing sub-tabs is resolved.
@nofaralfasi I am having a real difficulty to solve those tests that are failing.. I invested quite some time on trying to fix the tests with no success, I think this implementation relies on updating the URL with pagination search params and that doesn't work well in the test itself, also the mocks are very hardcoded :/ @mariaaga would appreciate some help if you got some time, thanks
I have some tests failing also on master branch btw, @Ron-Lavi Can you open a separate pr for those tests?
for visibility, not sure I will have much time to continue work on this PR soon, in case you want to continue from here.. cc @nofaralfasi @stejskalleos @girijaasoni