allow searching for Smart Proxies by capabilities and settings
today one can search for Smart Proxies by specifying features (https://github.com/theforeman/foreman/blob/2e400f66c41b6883d6ab1e4ca1de71b84618890a/app/models/smart_proxy.rb#L31), but given features can have capabilities and settings, it would be cool to be able to search by those too.
My usecase is to find all smart proxies that have the "Pulpcore" feature which has the "mirror" setting set to true.
The following trivial patch "works", but makes the search really cumbersome, as capabilities are a serialized field, and settings a JSON.
diff --git app/models/smart_proxy.rb app/models/smart_proxy.rb index 4c61faf01..aeae2a335 100644 --- app/models/smart_proxy.rb +++ app/models/smart_proxy.rb @@ -29,6 +29,8 @@ class SmartProxy < ApplicationRecord scoped_search :on => :name, :complete_value => :true scoped_search :on => :url, :complete_value => :true scoped_search :relation => :features, :on => :name, :rename => :feature, :complete_value => :true + scoped_search :relation => :smart_proxy_features, :on => :capabilities, :complete_value => :false + scoped_search :relation => :smart_proxy_features, :on => :settings, :complete_value => :false # with proc support, default_scope can no longer be chained # include all default scoping here
With this patch, my search needs to look like:
settings ~ "mirror":true, which I don't think is a nice user experience.