Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fixes #37980 - Remove roles locked sort #10368

Open
wants to merge 1 commit into
base: develop
Choose a base branch
from

Conversation

MariaAga
Copy link
Member

@MariaAga MariaAga commented Nov 5, 2024

In roles,
sorting by locked gives "unknown attribute 'locked' for Class." or, before foreman 3.5 - "Invalid search query: the field 'locked' in the order statement is not valid field for search"

@adamruzicka
Copy link
Contributor

Wouldn't it be better to fix it instead of removing it, if possible?

@MariaAga
Copy link
Member Author

MariaAga commented Nov 5, 2024

In theory yes, but Im not sure its possible since it isnt a real field and the search works with:

scoped_search :on => :locked, :ext_method => :search_by_locked, 
...
  def self.search_by_locked(key, operator, value)
    role_condition = "origin IS NOT NULL AND builtin <> #{BUILTIN_DEFAULT_ROLE}"
    if value == 'false'
      role_condition = "NOT (#{role_condition})"
    end
    {:conditions => role_condition}
  end

And I couldnt find anywhere that sorts by something with "ext_method" and works, the other places just dont sort by it, or when theyre broken nothing happens. In roles if you try to sort by locked the page crashes.
Also if no one notices (broken at least since 3.3) I'm not sure its used.

Copy link
Member

@ofedoren ofedoren left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

theyre broken nothing happens

We have the same "unsortable" fields in openscap plugin:
Screenshot_20241112_180338

I don't know if they ever worked though.

Wouldn't it be better to fix it instead of removing it, if possible?

It fully depends on scoped_search library now. I've tried to come up with something, but due to lack of experience with the library it looked too complicated :/ As of now the library expects a field to be a real column to be able to sort/order.

As of now I see 3 possible fixes:

  • Remove unsupported orderings (Maria's PR)
  • Make scoped_search take any field for ordering (something like ext_method, but to use it for order)
  • Finally migrate to React pages, where we could do client based sorting

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants