Class: Anomonitor::AnomaliesController

Inherits:
ApplicationController show all
Defined in:
app/controllers/anomonitor/anomalies_controller.rb

Instance Method Summary collapse

Instance Method Details

#indexObject



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

#reopenObject



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

#resolveObject



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_webhookObject



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

#showObject



19
20
# File 'app/controllers/anomonitor/anomalies_controller.rb', line 19

def show
end