Class: Anomonitor::AnomaliesController
- Inherits:
-
ApplicationController
- Object
- ActionController::Base
- ApplicationController
- Anomonitor::AnomaliesController
- Defined in:
- app/controllers/anomonitor/anomalies_controller.rb
Instance Method Summary collapse
Instance Method Details
#index ⇒ Object
7 8 9 10 11 12 13 14 15 16 17 |
# File 'app/controllers/anomonitor/anomalies_controller.rb', line 7 def index @status_filter = params[:status].presence || "open" scope = Anomaly.recent scope = case @status_filter when "resolved" then scope.resolved when "all" then scope else scope.open end @anomalies = scope.limit(100) end |
#reopen ⇒ Object
27 28 29 30 |
# File 'app/controllers/anomonitor/anomalies_controller.rb', line 27 def reopen @anomaly.reopen! redirect_to anomaly_path(@anomaly), notice: "Alerts allowed again for this fingerprint." end |
#resolve ⇒ Object
22 23 24 25 |
# File 'app/controllers/anomonitor/anomalies_controller.rb', line 22 def resolve @anomaly.resolve!(by: "manual", notify: true) redirect_to anomaly_path(@anomaly), notice: "Anomaly resolved (silenced until drift clears)." end |
#retry_webhook ⇒ Object
32 33 34 35 36 |
# File 'app/controllers/anomonitor/anomalies_controller.rb', line 32 def retry_webhook ok = @anomaly.retry_webhook! redirect_to anomaly_path(@anomaly), notice: (ok ? "Webhook delivered." : "Webhook delivery failed again.") end |
#show ⇒ Object
19 20 |
# File 'app/controllers/anomonitor/anomalies_controller.rb', line 19 def show end |