Class: DiscoveryRulesController
- Inherits:
-
ApplicationController
- Object
- ApplicationController
- DiscoveryRulesController
- Includes:
- Foreman::Controller::Parameters::DiscoveryRule
- Defined in:
- app/controllers/discovery_rules_controller.rb
Instance Method Summary collapse
- #clone ⇒ Object
- #create ⇒ Object
- #destroy ⇒ Object
- #disable ⇒ Object
- #edit ⇒ Object
- #enable ⇒ Object
- #index ⇒ Object
- #model_of_controller ⇒ Object
- #new ⇒ Object
- #update ⇒ Object
Instance Method Details
#clone ⇒ Object
22 23 24 25 |
# File 'app/controllers/discovery_rules_controller.rb', line 22 def clone @discovery_rule = @discovery_rule.deep_clone except: [:name, :priority], include: [:organizations, :locations] @discovery_rule.priority = DiscoveryRule.suggest_priority end |
#create ⇒ Object
27 28 29 30 31 32 33 34 |
# File 'app/controllers/discovery_rules_controller.rb', line 27 def create @discovery_rule = DiscoveryRule.new(discovery_rule_params) if @discovery_rule.save process_success else process_error end end |
#destroy ⇒ Object
47 48 49 50 51 52 53 |
# File 'app/controllers/discovery_rules_controller.rb', line 47 def destroy if @discovery_rule.destroy process_success else process_error end end |
#disable ⇒ Object
59 60 61 |
# File 'app/controllers/discovery_rules_controller.rb', line 59 def disable set_enabled false end |
#edit ⇒ Object
36 37 |
# File 'app/controllers/discovery_rules_controller.rb', line 36 def edit end |
#enable ⇒ Object
55 56 57 |
# File 'app/controllers/discovery_rules_controller.rb', line 55 def enable set_enabled true end |
#index ⇒ Object
13 14 15 16 |
# File 'app/controllers/discovery_rules_controller.rb', line 13 def index base = resource_base.search_for(params[:search], :order => (params[:order])) @discovery_rules = base.paginate(:page => params[:page], :per_page => params[:per_page]).includes(:hostgroup) end |
#model_of_controller ⇒ Object
9 10 11 |
# File 'app/controllers/discovery_rules_controller.rb', line 9 def model_of_controller DiscoveryRule end |
#new ⇒ Object
18 19 20 |
# File 'app/controllers/discovery_rules_controller.rb', line 18 def new @discovery_rule = DiscoveryRule.new(:priority => DiscoveryRule.suggest_priority) end |
#update ⇒ Object
39 40 41 42 43 44 45 |
# File 'app/controllers/discovery_rules_controller.rb', line 39 def update if @discovery_rule.update(discovery_rule_params) process_success else process_error end end |