-
Notifications
You must be signed in to change notification settings - Fork 297
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 #35901 - Allow searching for CCVs based on component CVs #10767
Fixes #35901 - Allow searching for CCVs based on component CVs #10767
Conversation
def self.completer_scope_options(search) | ||
if search.include?('content_views') | ||
# Don't autocomplete CCV names when searching for components | ||
{ :value_filter => { :composite => false } } | ||
else | ||
{} | ||
end | ||
end |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Autocomplete was including composite CV names in the suggested search. For example, if I was searching for content_views = xxx
and had typed content_views =
, the suggestions would include all of my content view names, including composite content views. But a composite content view cannot contain itself, so this made no sense. To prevent this I added this method, which modifies scoped_search's value filter. I had to modify it to pass in the search because otherwise it would filter out composite CVs when I searched for name =
, which we don't want.
app/models/katello/content_view.rb
Outdated
@@ -111,6 +111,27 @@ class ContentView < Katello::Model | |||
scoped_search :on => :composite, :complete_value => true | |||
scoped_search :on => :generated_for, :complete_value => true | |||
scoped_search :on => :default # just for ordering | |||
scoped_search :on => :name, :complete_value => true, | |||
:rename => :content_views, | |||
:operators => ['=', '!=', '~', '!~'], |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I filtered out the operators like <
that don't make much sense here, as well as ^
which just don't seem to work well for this use case
@@ -111,6 +111,27 @@ class ContentView < Katello::Model | |||
scoped_search :on => :composite, :complete_value => true | |||
scoped_search :on => :generated_for, :complete_value => true | |||
scoped_search :on => :default # just for ordering | |||
scoped_search :on => :name, :complete_value => true, | |||
:rename => :content_views, |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I considered naming this components
, but we've moved away from using the "component" terminology recently, and I don't want to reverse that.
def1eaf
to
d65fbc1
Compare
fixed rubocop & added unused method args |
[test katello] |
1 similar comment
[test katello] |
d65fbc1
to
12af004
Compare
12af004
to
46d1545
Compare
Updated to only suggest the |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Ack.. 👍🏼
Works as expected with = operator. Ignoring other operators for now and as discussed offline, those can be revisited if someone needs it and it's deemed worthwhile to add custom operator queries for those..
What are the changes introduced in this pull request?
Add a new field to Content View scoped_search. This will allow you to search for a composite content view that contains a particular content view.
For example:
will return composite content views that have My-Content_view as one of their components.
Considerations taken when implementing this change?
I'm still not sure about any performance implications; suggestions welcome
What are the testing steps for this pull request?
Create at least one composite CV but preferably hundreds lol
Search on the Content Views page
Make sure everything works as expected