Revision 3f8e6c33
Added by Imri Zvik almost 9 years ago
app/models/concerns/hostext/search.rb | ||
---|---|---|
scoped_search :in => :interfaces, :on => :mac, :complete_value => true, :rename => :has_mac
|
||
|
||
scoped_search :in => :puppetclasses, :on => :name, :complete_value => true, :rename => :class, :only_explicit => true, :operators => ['= ', '~ '], :ext_method => :search_by_puppetclass
|
||
scoped_search :in => :fact_values, :on => :value, :in_key=> :fact_names, :on_key=> :name, :rename => :facts, :complete_value => true, :only_explicit => true
|
||
scoped_search :in => :fact_values, :on => :value, :in_key=> :fact_names, :on_key=> :name, :rename => :facts, :complete_value => true, :only_explicit => true, :ext_method => :search_cast_facts
|
||
scoped_search :in => :search_parameters, :on => :value, :on_key=> :name, :complete_value => true, :rename => :params, :ext_method => :search_by_params, :only_explicit => true
|
||
|
||
if SETTINGS[:locations_enabled]
|
||
... | ... | |
{:conditions => opts, :include => :hostgroup}
|
||
end
|
||
|
||
def search_cast_facts(key, operator, value)
|
||
{
|
||
:conditions => "fact_names.name = '#{key.split('.')[1]}' AND #{cast_facts(key,operator,value)}",
|
||
:include => :fact_names,
|
||
}
|
||
end
|
||
|
||
private
|
||
|
||
def param_conditions(p)
|
Also available in: Unified diff
Fixes #11150 - Allow searching of facts as types other than string