<% content_for :title, "#{@source_name} Network Ranges" %>

<%= @source_name %> Network Ranges

Network ranges imported from <%= @source_name %> official sources

<%= link_to "Back to Sources", bot_network_ranges_path, class: "px-4 py-2 text-sm font-medium text-gray-700 bg-gray-200 rounded hover:bg-gray-300 transition-colors" %> <%= form_with url: bot_network_range_path(params[:source]), method: :delete, class: "inline" do |f| %> <%= f.submit "Delete All Ranges", class: "px-4 py-2 text-sm font-medium text-white bg-red-600 rounded hover:bg-red-700 transition-colors", confirm: "Are you sure you want to delete all #{@source_name} network ranges? This action cannot be undone." %> <% end %>
<% if @import_stats.any? %>

Import Statistics

<% @import_stats.each do |source, count| %>
<%= count %>
<%= source.gsub('bot_import_', '').titleize %>
<% end %>
<% end %>

Network Ranges

Showing <%= @network_ranges.offset_value + 1 %> to <%= [@network_ranges.offset_value + @network_ranges.current_page_count, @network_ranges.total_count].min %> of <%= @network_ranges.total_count %> ranges
<% @network_ranges.each do |range| %> <% end %>
Network Source Company Country Created Details
<%= link_to range.network, network_range_path(range), class: "text-blue-600 hover:text-blue-800" %> <%= range.source.gsub('bot_import_', '').titleize %> <%= range.company || 'Unknown' %> <%= range.country || 'Unknown' %> <%= range.created_at.strftime('%Y-%m-%d %H:%M') %> <% if range.additional_data.present? %> <% data = JSON.parse(range.additional_data) rescue {} %>
<% if data['crawler_type'] %> <%= data['crawler_type'].titleize %> <% end %> <% if data['crawler_purpose'] %> Purpose <% end %> <% if data['aws_service'] %> <%= data['aws_service'] %> <% end %> <% if data['aws_region'] %> <%= data['aws_region'] %> <% end %> <% if data['ip_version'] %> IPv<%= data['ip_version'] %> <% end %>
<% end %>
<% if @network_ranges.total_pages > 1 %>
Page <%= @network_ranges.current_page %> of <%= @network_ranges.total_pages %>
<% if @network_ranges.prev_page %> <%= link_to "Previous", bot_network_range_path(params[:source], page: @network_ranges.prev_page), class: "px-3 py-1 text-sm font-medium text-gray-700 bg-white border border-gray-300 rounded hover:bg-gray-50" %> <% end %> <%# Show page numbers %> <% (1..@network_ranges.total_pages).select { |p| p == 1 || p == @network_ranges.total_pages || (p - @network_ranges.current_page).abs <= 2 }.each do |page| %> <% if page == @network_ranges.current_page %> <%= page %> <% else %> <%= link_to page, bot_network_range_path(params[:source], page: page), class: "px-3 py-1 text-sm font-medium text-gray-700 bg-white border border-gray-300 rounded hover:bg-gray-50" %> <% end %> <% end %> <% if @network_ranges.next_page %> <%= link_to "Next", bot_network_range_path(params[:source], page: @network_ranges.next_page), class: "px-3 py-1 text-sm font-medium text-gray-700 bg-white border border-gray-300 rounded hover:bg-gray-50" %> <% end %>
<% end %>
<% if @network_ranges.empty? %>

No network ranges found

No <%= @source_name %> network ranges have been imported yet.

<%= link_to "Import #{@source_name} Ranges", bot_network_ranges_path, class: "inline-flex items-center px-4 py-2 border border-transparent text-sm font-medium rounded-md shadow-sm text-white bg-blue-600 hover:bg-blue-700 focus:outline-none focus:ring-2 focus:ring-offset-2 focus:ring-blue-500" %>
<% end %>