Project

General

Profile

« Previous | Next » 

Revision 3ab02530

Added by Kavita Gaikwad over 7 years ago

Fixes #12547 - Added validators to interger fields

With this commit, instead of postgresql exception it will
show proper validation message for interger fields.

View differences:

app/models/concerns/hostext/search.rb
scoped_search :on => :enabled, :complete_value => {:true => true, :false => false}, :rename => :'status.enabled'
scoped_search :on => :managed, :complete_value => {:true => true, :false => false}
scoped_search :on => :owner_type, :complete_value => true, :only_explicit => true
scoped_search :on => :owner_id, :complete_enabled => false, :only_explicit => true
scoped_search :on => :owner_id, :complete_enabled => false, :only_explicit => true, :validator => ScopedSearch::Validators::INTEGER
scoped_search :relation => :configuration_status_object, :on => :status, :offset => 0, :word_size => ConfigReport::BIT_NUM*4, :rename => :'status.interesting', :complete_value => {:true => true, :false => false}
scoped_search_status "applied", :relation => :configuration_status_object, :on => :status, :rename => :'status.applied'
......
scoped_search :relation => :hostgroup, :on => :name, :complete_enabled => false, :rename => :hostgroup_name, :only_explicit => true
scoped_search :relation => :hostgroup, :on => :title, :complete_value => true, :rename => :hostgroup_fullname
scoped_search :relation => :hostgroup, :on => :title, :complete_value => true, :rename => :hostgroup_title
scoped_search :relation => :hostgroup, :on => :id, :complete_enabled => false, :rename => :hostgroup_id, :only_explicit => true
scoped_search :relation => :hostgroup, :on => :id, :complete_enabled => false, :rename => :hostgroup_id, :only_explicit => true, :validator => ScopedSearch::Validators::INTEGER
scoped_search :relation => :hostgroup, :on => :title, :complete_value => true, :rename => :parent_hostgroup, :only_explicit => true, :ext_method => :search_by_hostgroup_and_descendants
scoped_search :relation => :domain, :on => :name, :complete_value => true, :rename => :domain
scoped_search :relation => :domain, :on => :id, :complete_enabled => false, :rename => :domain_id, :only_explicit => true
scoped_search :relation => :domain, :on => :id, :complete_enabled => false, :rename => :domain_id, :only_explicit => true, :validator => ScopedSearch::Validators::INTEGER
scoped_search :relation => :realm, :on => :name, :complete_value => true, :rename => :realm
scoped_search :relation => :realm, :on => :id, :complete_enabled => false, :rename => :realm_id, :only_explicit => true
scoped_search :relation => :realm, :on => :id, :complete_enabled => false, :rename => :realm_id, :only_explicit => true, :validator => ScopedSearch::Validators::INTEGER
scoped_search :relation => :environment, :on => :name, :complete_value => true, :rename => :environment
scoped_search :relation => :architecture, :on => :name, :complete_value => true, :rename => :architecture
scoped_search :relation => :puppet_proxy, :on => :name, :complete_value => true, :rename => :puppetmaster, :only_explicit => true
scoped_search :on => :puppet_proxy_id, :complete_value => false, :only_explicit => true
scoped_search :on => :puppet_proxy_id, :complete_value => false, :only_explicit => true, :validator => ScopedSearch::Validators::INTEGER
scoped_search :relation => :puppet_ca_proxy, :on => :name, :complete_value => true, :rename => :puppet_ca, :only_explicit => true
scoped_search :relation => :puppet_proxy, :on => :name, :complete_value => true, :rename => :smart_proxy, :ext_method => :search_by_proxy, :only_explicit => true
scoped_search :relation => :compute_resource, :on => :name, :complete_value => true, :rename => :compute_resource
scoped_search :relation => :compute_resource, :on => :id, :complete_enabled => false, :rename => :compute_resource_id, :only_explicit => true
scoped_search :relation => :compute_resource, :on => :id, :complete_enabled => false, :rename => :compute_resource_id, :only_explicit => true, :validator => ScopedSearch::Validators::INTEGER
scoped_search :relation => :image, :on => :name, :complete_value => true, :rename => :image
scoped_search :relation => :operatingsystem, :on => :name, :complete_value => true, :rename => :os
......
scoped_search :relation => :operatingsystem, :on => :title, :complete_value => true, :rename => :os_title
scoped_search :relation => :operatingsystem, :on => :major, :complete_value => true, :rename => :os_major
scoped_search :relation => :operatingsystem, :on => :minor, :complete_value => true, :rename => :os_minor
scoped_search :relation => :operatingsystem, :on => :id, :complete_enabled => false,:rename => :os_id, :only_explicit => true
scoped_search :relation => :operatingsystem, :on => :id, :complete_enabled => false,:rename => :os_id, :only_explicit => true, :validator => ScopedSearch::Validators::INTEGER
scoped_search :relation => :primary_interface, :on => :ip, :complete_value => true
scoped_search :relation => :interfaces, :on => :ip, :complete_value => true, :rename => :has_ip
......
if SETTINGS[:locations_enabled]
scoped_search :relation => :location, :on => :title, :rename => :location, :complete_value => true
scoped_search :on => :location_id, :complete_enabled => false, :only_explicit => true
scoped_search :on => :location_id, :complete_enabled => false, :only_explicit => true, :validator => ScopedSearch::Validators::INTEGER
end
if SETTINGS[:organizations_enabled]
scoped_search :relation => :organization, :on => :title, :rename => :organization, :complete_value => true, :only_explicit => true
scoped_search :on => :organization_id, :complete_enabled => false, :only_explicit => true
scoped_search :on => :organization_id, :complete_enabled => false, :only_explicit => true, :validator => ScopedSearch::Validators::INTEGER
end
scoped_search :relation => :config_groups, :on => :name, :complete_value => true, :rename => :config_group, :only_explicit => true, :operators => ['= ', '~ '], :ext_method => :search_by_config_group
......
scoped_search :relation => :operatingsystem, :on => :title, :complete_value => true, :rename => :os_title
scoped_search :relation => :operatingsystem, :on => :major, :complete_value => true, :rename => :os_major
scoped_search :relation => :operatingsystem, :on => :minor, :complete_value => true, :rename => :os_minor
scoped_search :relation => :operatingsystem, :on => :id, :complete_value => false,:rename => :os_id, :complete_enabled => false
scoped_search :relation => :operatingsystem, :on => :id, :complete_value => false,:rename => :os_id, :complete_enabled => false, :validator => ScopedSearch::Validators::INTEGER
end
if SETTINGS[:login]

Also available in: Unified diff