foreman_ansible icon indicating copy to clipboard operation
foreman_ansible copied to clipboard

Fixes #36469 - Fix Ansible Roles and Variables sub-tabs pagination

Open Ron-Lavi opened this issue 1 year ago • 7 comments

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

Ron-Lavi avatar Jan 01 '24 09:01 Ron-Lavi

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 avatar Jan 01 '24 15:01 nofaralfasi

@nofaralfasi Hey, can you check again?

Ron-Lavi avatar Jan 02 '24 11:01 Ron-Lavi

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.

nofaralfasi avatar Jan 02 '24 11:01 nofaralfasi

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 avatar Jan 02 '24 12:01 nofaralfasi

@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

Ron-Lavi avatar Jan 03 '24 10:01 Ron-Lavi

I have some tests failing also on master branch btw, @Ron-Lavi Can you open a separate pr for those tests?

MariaAga avatar Jan 03 '24 16:01 MariaAga

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

Ron-Lavi avatar Jan 10 '24 15:01 Ron-Lavi