Class: MyNagios::ChecksController
- Inherits:
-
ApplicationController
- Object
- ActionController::Base
- ApplicationController
- MyNagios::ChecksController
- Defined in:
- app/controllers/my_nagios/checks_controller.rb
Instance Method Summary collapse
- #create ⇒ Object
- #edit ⇒ Object
- #group_action ⇒ Object
- #new ⇒ Object
- #run_now ⇒ Object
- #toggle ⇒ Object
- #update ⇒ Object
Instance Method Details
#create ⇒ Object
12 13 14 15 |
# File 'app/controllers/my_nagios/checks_controller.rb', line 12 def create @check = Check.create(params_check) redirect_to root_path end |
#edit ⇒ Object
17 18 |
# File 'app/controllers/my_nagios/checks_controller.rb', line 17 def edit end |
#group_action ⇒ Object
41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 |
# File 'app/controllers/my_nagios/checks_controller.rb', line 41 def group_action check_ids = params["group_action_check_ids"].split(',') redirect_to root_path and return if check_ids.blank? case params['check_group_action'].downcase when 'disable' Check.where(id: check_ids).update_all(enabled: false) when 'enable' Check.where(id: check_ids).update_all(enabled: true) when 'snooze for' Check.where(id: check_ids).update_all(snooze_for: (Time.now + params['snooze_time_select'].to_i.minutes)) end redirect_to root_path end |
#new ⇒ Object
8 9 10 |
# File 'app/controllers/my_nagios/checks_controller.rb', line 8 def new @check = Check.new end |
#run_now ⇒ Object
25 26 27 28 29 30 31 |
# File 'app/controllers/my_nagios/checks_controller.rb', line 25 def run_now @check.run! respond_to do |format| format.js { render layout: false } end end |
#toggle ⇒ Object
33 34 35 36 37 38 39 |
# File 'app/controllers/my_nagios/checks_controller.rb', line 33 def toggle @check.toggle! :enabled respond_to do |format| format.js { render layout: false } end end |
#update ⇒ Object
20 21 22 23 |
# File 'app/controllers/my_nagios/checks_controller.rb', line 20 def update @check.update(params_check) redirect_to root_path end |