<% content_for :title, "Analytics Dashboard - Baffle Hub" %>

Analytics Dashboard

Overview of WAF events, rules, and network activity

Auto-refreshing
Time Period:
<%= link_to "1H", analytics_path(period: :hour), class: time_period_class(:hour), data: { action: "click->dashboard#periodChanged", period: "hour" } %> <%= link_to "24H", analytics_path(period: :day), class: time_period_class(:day), data: { action: "click->dashboard#periodChanged", period: "day" } %> <%= link_to "1W", analytics_path(period: :week), class: time_period_class(:week), data: { action: "click->dashboard#periodChanged", period: "week" } %> <%= link_to "1M", analytics_path(period: :month), class: time_period_class(:month), data: { action: "click->dashboard#periodChanged", period: "month" } %>
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
Job Queue
<%= number_with_delimiter(@job_statistics[:pending_jobs]) %>
<%= @job_statistics[:health_status].humanize %> ยท <%= @job_statistics[:recent_enqueued] %> recent

Events Timeline (Last 24 Hours)

Times shown in your local timezone
<% @chart_data[:timeline].each do |data| %>
--:--
<%= data[:total] %>
<% end %>

Event Actions

<% if @chart_data[:actions].any? %>
<% @chart_data[:actions].each do |action| %>
<%= action[:action] %>
<%= number_with_delimiter(action[:count]) %> (<%= action[:percentage] %>%)
<% end %>
<% else %>

No events in the selected time period

<% end %>

Top Countries

<% if @top_countries.any? %>
<% @top_countries.first(5).each do |country, count| %>
<%= country %> <%= number_with_delimiter(count) %>
<% end %>
<% else %>

No country data available

<% end %>

Network Intelligence

<%= link_to "Detailed Network Analytics โ†’", analytics_networks_path, class: "text-sm text-blue-600 hover:text-blue-800 font-medium" %>
๐Ÿข Datacenter <%= number_with_delimiter(@network_intelligence[:datacenter_ranges]) %>
๐Ÿ”’ VPN <%= number_with_delimiter(@network_intelligence[:vpn_ranges]) %>
๐Ÿ›ก๏ธ Proxy <%= number_with_delimiter(@network_intelligence[:proxy_ranges]) %>

Recent Activity

<% @recent_events.first(3).each do |event| %>
<%= event.ip_address %>
<%= time_ago_in_words(event.timestamp) %> ago
<% end %>

Job Queue Details

<% if @job_statistics[:queue_breakdown].any? %> <% @job_statistics[:queue_breakdown].each do |queue, count| %>
<%= queue.to_s.humanize %>
<%= number_with_delimiter(count) %>
<% end %> <% else %>

No job queue data available

<% end %>

Top Blocked IPs

<%= link_to "View All Events", events_path, class: "text-sm text-blue-600 hover:text-blue-800" %>
<% if @top_blocked_ips.any? %>
<% @top_blocked_ips.each do |ip, count| %>
<%= ip %>
<%= number_with_delimiter(count) %> blocks
<% end %>
<% else %>

No blocked events in the selected time period

<% end %>

Quick Actions

<%= link_to new_rule_path, class: "flex items-center justify-center px-4 py-3 bg-blue-600 text-white rounded-md hover:bg-blue-700 transition-colors" do %> Create Rule <% end %> <%= link_to new_network_range_path, class: "flex items-center justify-center px-4 py-3 bg-green-600 text-white rounded-md hover:bg-green-700 transition-colors" do %> Add Network Range <% end %> <%= link_to events_path, class: "flex items-center justify-center px-4 py-3 bg-purple-600 text-white rounded-md hover:bg-purple-700 transition-colors" do %> View Events <% end %> <%= link_to rules_path, class: "flex items-center justify-center px-4 py-3 bg-orange-600 text-white rounded-md hover:bg-orange-700 transition-colors" do %> Manage Rules <% end %>