Fixes #38024 - Add ordering by virtual columns
This is an alternative for https://github.com/theforeman/foreman/pull/10368, tries to make ordering by columns, which are not part of actual table, possible.
This PR enables it for roles model, making possible to click on locked column in roles index page and see the ordering, as well as doing so via API.
Added an entry for developer_docs saying how to use it within plugins.
Thanks, @adamruzicka, for the idea!
@MariaAga, what do you think?
P.S. The only issue I see is that we'd need to update https://github.com/theforeman/foreman-tasks/blob/master/app/controllers/foreman_tasks/api/tasks_controller.rb#L195 to be compatible. Could be done as part of removal deprecated stuff.
It seems to work as expected in ui and api, the code makes sense but I think we need a Ruby person to verify it, @adamruzicka ?
I've updated the logic a bit: since most of the UI controllers use resource_base_search_and_page/resource_base_with_search, I updated this method, so the new wrap_for_virt_column_select method is not necessary, but rather an optional helper. Although, looking at the changes in https://github.com/theforeman/foreman_openscap/pull/587, I don't think this wrapper will be used...
WDYT? Should we expose the wrapper or rather force usage of already defined loaders if ordering by virt columns desired?
@adamruzicka, @MariaAga, reviving this one: do we still want that?
Note: it also fixes broken ordering by locked on roles page.
/packit build
Could you rebase please?
Could you please squash the commits?
Thanks, @adamruzicka, rebased / squashed. Although I'd like to see green tests just in case, but I don't think there will be related failures anyway :shrug:
:green_apple:
Thank you @ofedoren !