Updates
This commit is contained in:
@@ -25,7 +25,7 @@
|
||||
<div class="ml-5 w-0 flex-1">
|
||||
<dl>
|
||||
<dt class="text-sm font-medium text-gray-500 truncate">Total Rules</dt>
|
||||
<dd class="text-lg font-medium text-gray-900"><%= number_with_delimiter(@rules.count) %></dd>
|
||||
<dd class="text-lg font-medium text-gray-900"><%= number_with_delimiter(Rule.count) %></dd>
|
||||
</dl>
|
||||
</div>
|
||||
</div>
|
||||
@@ -42,26 +42,8 @@
|
||||
</div>
|
||||
<div class="ml-5 w-0 flex-1">
|
||||
<dl>
|
||||
<dt class="text-sm font-medium text-gray-500 truncate">Active Rules</dt>
|
||||
<dd class="text-lg font-medium text-gray-900"><%= number_with_delimiter(@rules.active.count) %></dd>
|
||||
</dl>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div class="bg-white overflow-hidden shadow rounded-lg">
|
||||
<div class="p-5">
|
||||
<div class="flex items-center">
|
||||
<div class="flex-shrink-0">
|
||||
<svg class="h-6 w-6 text-red-400" fill="none" viewBox="0 0 24 24" stroke="currentColor">
|
||||
<path stroke-linecap="round" stroke-linejoin="round" stroke-width="2" d="M6 18L18 6M6 6l12 12" />
|
||||
</svg>
|
||||
</div>
|
||||
<div class="ml-5 w-0 flex-1">
|
||||
<dl>
|
||||
<dt class="text-sm font-medium text-gray-500 truncate">Block Rules</dt>
|
||||
<dd class="text-lg font-medium text-gray-900"><%= number_with_delimiter(@rules.where(action: 'deny').count) %></dd>
|
||||
<dt class="text-sm font-medium text-gray-500 truncate">Active Block Rules</dt>
|
||||
<dd class="text-lg font-medium text-gray-900"><%= number_with_delimiter(Rule.deny.active.count) %></dd>
|
||||
</dl>
|
||||
</div>
|
||||
</div>
|
||||
@@ -73,13 +55,31 @@
|
||||
<div class="flex items-center">
|
||||
<div class="flex-shrink-0">
|
||||
<svg class="h-6 w-6 text-yellow-400" fill="none" viewBox="0 0 24 24" stroke="currentColor">
|
||||
<path stroke-linecap="round" stroke-linejoin="round" stroke-width="2" d="M18.364 18.364A9 9 0 005.636 5.636m12.728 12.728L5.636 5.636m12.728 12.728L18.364 5.636M5.636 18.364l12.728-12.728" />
|
||||
</svg>
|
||||
</div>
|
||||
<div class="ml-5 w-0 flex-1">
|
||||
<dl>
|
||||
<dt class="text-sm font-medium text-gray-500 truncate">Disabled Rules</dt>
|
||||
<dd class="text-lg font-medium text-gray-900"><%= number_with_delimiter(Rule.where(enabled: false).count) %></dd>
|
||||
</dl>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div class="bg-white overflow-hidden shadow rounded-lg">
|
||||
<div class="p-5">
|
||||
<div class="flex items-center">
|
||||
<div class="flex-shrink-0">
|
||||
<svg class="h-6 w-6 text-red-400" fill="none" viewBox="0 0 24 24" stroke="currentColor">
|
||||
<path stroke-linecap="round" stroke-linejoin="round" stroke-width="2" d="M12 8v4l3 3m6-3a9 9 0 11-18 0 9 9 0 0118 0z" />
|
||||
</svg>
|
||||
</div>
|
||||
<div class="ml-5 w-0 flex-1">
|
||||
<dl>
|
||||
<dt class="text-sm font-medium text-gray-500 truncate">Expired Rules</dt>
|
||||
<dd class="text-lg font-medium text-gray-900"><%= number_with_delimiter(@rules.expired.count) %></dd>
|
||||
<dd class="text-lg font-medium text-gray-900"><%= number_with_delimiter(Rule.expired.count) %></dd>
|
||||
</dl>
|
||||
</div>
|
||||
</div>
|
||||
@@ -114,7 +114,7 @@
|
||||
<th class="px-6 py-3 text-left text-xs font-medium text-gray-500 uppercase tracking-wider">Rule</th>
|
||||
<th class="px-6 py-3 text-left text-xs font-medium text-gray-500 uppercase tracking-wider">Type</th>
|
||||
<th class="px-6 py-3 text-left text-xs font-medium text-gray-500 uppercase tracking-wider">Action</th>
|
||||
<th class="px-6 py-3 text-left text-xs font-medium text-gray-500 uppercase tracking-wider">Target</th>
|
||||
<th class="px-6 py-3 text-center text-xs font-medium text-gray-500 uppercase tracking-wider">Events</th>
|
||||
<th class="px-6 py-3 text-left text-xs font-medium text-gray-500 uppercase tracking-wider">Status</th>
|
||||
<th class="px-6 py-3 text-left text-xs font-medium text-gray-500 uppercase tracking-wider">Created</th>
|
||||
<th class="px-6 py-3 text-right text-xs font-medium text-gray-500 uppercase tracking-wider">Actions</th>
|
||||
@@ -123,54 +123,77 @@
|
||||
<tbody class="bg-white divide-y divide-gray-200">
|
||||
<% @rules.each do |rule| %>
|
||||
<tr class="hover:bg-gray-50">
|
||||
<td class="px-6 py-4 whitespace-nowrap">
|
||||
<div class="flex items-center">
|
||||
<td class="px-6 py-4">
|
||||
<div class="space-y-1">
|
||||
<!-- Rule name -->
|
||||
<div>
|
||||
<div class="text-sm font-medium text-gray-900">
|
||||
<%= link_to "Rule ##{rule.id}", rule_path(rule), class: "text-blue-600 hover:text-blue-900" %>
|
||||
</div>
|
||||
<div class="text-sm text-gray-500">
|
||||
<%= rule.source.humanize %>
|
||||
<% if rule.network_range? && rule.network_range %>
|
||||
• <%= link_to rule.network_range.cidr, network_range_path(rule.network_range), class: "text-blue-600 hover:text-blue-900" %>
|
||||
<% end %>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<!-- Policy (if created by a policy) -->
|
||||
<% if rule.waf_policy.present? %>
|
||||
<div>
|
||||
<div class="text-xs text-gray-500">Policy</div>
|
||||
<div class="text-sm">
|
||||
<%= link_to rule.waf_policy.name, waf_policy_path(rule.waf_policy), class: "text-blue-600 hover:text-blue-900" %>
|
||||
</div>
|
||||
</div>
|
||||
<% end %>
|
||||
|
||||
<!-- IP network -->
|
||||
<% if rule.network_range? && rule.network_range %>
|
||||
<div>
|
||||
<div class="text-xs text-gray-500">IP network</div>
|
||||
<div class="text-sm text-gray-900">
|
||||
<%= link_to rule.network_range.cidr, network_range_path(rule.network_range), class: "text-blue-600 hover:text-blue-900" %>
|
||||
<% if rule.network_range.company.present? %>
|
||||
<div class="text-xs text-gray-500"><%= rule.network_range.company %></div>
|
||||
<% end %>
|
||||
</div>
|
||||
</div>
|
||||
<% elsif rule.conditions.present? && rule.conditions&.dig('cidr').present? %>
|
||||
<div>
|
||||
<div class="text-xs text-gray-500">IP network</div>
|
||||
<div class="text-sm text-gray-900">
|
||||
<%= rule.conditions['cidr'] %>
|
||||
</div>
|
||||
</div>
|
||||
<% end %>
|
||||
</div>
|
||||
</td>
|
||||
<td class="px-6 py-4 whitespace-nowrap">
|
||||
<span class="inline-flex items-center px-2.5 py-0.5 rounded-full text-xs font-medium <%=
|
||||
case rule.rule_type
|
||||
case rule.waf_rule_type
|
||||
when 'network' then 'bg-blue-100 text-blue-800'
|
||||
when 'rate_limit' then 'bg-yellow-100 text-yellow-800'
|
||||
when 'path_pattern' then 'bg-purple-100 text-purple-800'
|
||||
else 'bg-gray-100 text-gray-800'
|
||||
end %>">
|
||||
<%= rule.rule_type.humanize %>
|
||||
<%= rule.waf_rule_type.humanize %>
|
||||
</span>
|
||||
</td>
|
||||
<td class="px-6 py-4 whitespace-nowrap">
|
||||
<span class="inline-flex items-center px-2.5 py-0.5 rounded-full text-xs font-medium <%=
|
||||
case rule.action
|
||||
case rule.waf_action
|
||||
when 'allow' then 'bg-green-100 text-green-800'
|
||||
when 'deny' then 'bg-red-100 text-red-800'
|
||||
when 'rate_limit' then 'bg-yellow-100 text-yellow-800'
|
||||
when 'redirect' then 'bg-indigo-100 text-indigo-800'
|
||||
when 'log' then 'bg-gray-100 text-gray-800'
|
||||
when 'challenge' then 'bg-orange-100 text-orange-800'
|
||||
else 'bg-gray-100 text-gray-800'
|
||||
end %>">
|
||||
<%= rule.action.upcase %>
|
||||
<%= rule.waf_action.upcase %>
|
||||
</span>
|
||||
</td>
|
||||
<td class="px-6 py-4 whitespace-nowrap text-sm text-gray-900">
|
||||
<% if rule.network_range? && rule.network_range %>
|
||||
<%= rule.network_range.cidr %>
|
||||
<% if rule.network_range.company.present? %>
|
||||
<div class="text-xs text-gray-500"><%= rule.network_range.company %></div>
|
||||
<% end %>
|
||||
<% elsif rule.conditions.present? %>
|
||||
<div class="max-w-xs truncate">
|
||||
<%= JSON.parse(rule.conditions || "{}").map { |k, v| "#{k}: #{v}" }.join(", ") rescue "Invalid JSON" %>
|
||||
<td class="px-6 py-4 whitespace-nowrap text-center">
|
||||
<% event_count = rule.events.count %>
|
||||
<% if event_count > 0 %>
|
||||
<%= link_to number_with_delimiter(event_count), events_path(rule_id: rule.id), class: "text-blue-600 hover:text-blue-900 font-medium" %>
|
||||
<div class="text-xs text-gray-500">
|
||||
<span class="text-red-600"><%= rule.events.where(waf_action: :deny).count %> blocked</span>
|
||||
</div>
|
||||
<% else %>
|
||||
<span class="text-gray-400">-</span>
|
||||
|
||||
Reference in New Issue
Block a user