<%= turbo_stream.replace "dashboard-stats" do %>
Total Events
<%= number_with_delimiter(@total_events) %>
Last <%= @time_period.to_s.humanize %>
Active Rules
<%= number_with_delimiter(@total_rules) %>
Enabled <% if @system_health[:disabled_rules] > 0 %> ยท <%= @system_health[:disabled_rules] %> disabled <% end %>
Active Network Ranges
<%= number_with_delimiter(@network_ranges_with_events) %>
of <%= number_with_delimiter(@total_network_ranges) %> total
System Health
Normal
All systems operational
<% end %> <%= turbo_stream.replace "recent-activity" do %>

Recent Activity

<% @recent_events.first(3).each do |event| %>
<% dot_color = case event.waf_action when 'allow' then 'bg-green-500' when 'deny' then 'bg-red-500' when 'redirect' then 'bg-blue-500' when 'challenge' then 'bg-yellow-500' when 'log' then 'bg-gray-500' else 'bg-gray-500' end %>
<%= event.ip_address %>
<%= time_ago_in_words(event.timestamp) %> ago
<% end %>
<% end %>