Class: Anomonitor::MutesController
- Inherits:
-
ApplicationController
- Object
- ActionController::Base
- ApplicationController
- Anomonitor::MutesController
- Defined in:
- app/controllers/anomonitor/mutes_controller.rb
Instance Method Summary collapse
Instance Method Details
#create ⇒ Object
9 10 11 12 13 14 15 16 17 18 19 20 21 22 |
# File 'app/controllers/anomonitor/mutes_controller.rb', line 9 def create seconds = parse_duration(params[:duration].presence || "24h") Mute.create!( metric: params[:metric].presence, rule: params[:rule].presence, source: params[:source].presence, tenant: params[:tenant].presence, muted_until: Time.current + seconds, reason: params[:reason].presence ) redirect_to mutes_path, notice: "Mute created until #{seconds / 3600.0}h from now." rescue StandardError => e redirect_to mutes_path, alert: e. end |
#destroy ⇒ Object
24 25 26 27 |
# File 'app/controllers/anomonitor/mutes_controller.rb', line 24 def destroy Mute.find(params[:id]).destroy! redirect_to mutes_path, notice: "Mute removed." end |
#index ⇒ Object
5 6 7 |
# File 'app/controllers/anomonitor/mutes_controller.rb', line 5 def index @mutes = Mute.recent.limit(100) end |