feat: add network analysis link to firewall logs and enhance statistics filtering for improved user navigation and interaction

This commit is contained in:
2025-12-03 17:48:04 -05:00
parent b6c79ac26d
commit 048693481f
2 changed files with 81 additions and 1 deletions

View File

@@ -347,6 +347,28 @@
padding-top: 0.5rem;
border-top: 1px solid rgba(var(--color-neutral), 0.3);
}
/* Network Analysis Link */
.firewall-network-link {
display: inline-flex;
align-items: center;
gap: 0.375rem;
padding: 0.25rem 0.5rem;
font-size: 0.7rem;
font-weight: 500;
border-radius: 0.375rem;
background-color: rgba(var(--color-primary), 0.1);
color: rgba(var(--color-primary), 1);
border: 1px solid rgba(var(--color-primary), 0.3);
text-decoration: none;
transition: all 0.15s ease;
white-space: nowrap;
}
.firewall-network-link:hover {
background-color: rgba(var(--color-primary), 0.2);
border-color: rgba(var(--color-primary), 0.5);
color: rgba(var(--color-primary), 1);
}
</style>
<div class="space-y-6">
@@ -1067,6 +1089,9 @@
<span x-show="sortField === 'destination_port'" x-text="sortDirection === 'asc' ? '▲' : '▼'" class="text-[10px]"></span>
</button>
</th>
<th class="text-left py-3 px-4 font-semibold text-sm">
Actions
</th>
</tr>
</thead>
<tbody>
@@ -1438,6 +1463,18 @@
</template>
</div>
</td>
<!-- Actions -->
<td class="py-3 px-4 text-sm">
<template x-if="log.source && log.source !== '-'">
<a :href="'{{ route('proxmox.server.statistics', ['server' => $server->id]) }}?network_search=' + encodeURIComponent(log.source) + '#network-analysis-card'"
class="firewall-network-link"
title="View connection in Network Analysis">
<x-ri-line-chart-line style="width: 14px; height: 14px;" />
<span>Network</span>
</a>
</template>
</td>
</tr>
</template>
</tbody>

View File

@@ -3834,10 +3834,32 @@
};
window.tableFilterSort = function(tableId) {
// Check for network_search query parameter for the connections table
var initialSearch = '';
if (tableId === 'network-connections-table') {
var urlParams = new URLSearchParams(window.location.search);
var networkSearch = urlParams.get('network_search');
if (networkSearch) {
initialSearch = networkSearch;
// Clean up URL by removing the query parameter (optional)
// window.history.replaceState({}, document.title, window.location.pathname + window.location.hash);
}
}
var component = {
search: '',
search: initialSearch,
sortColumn: null,
sortDirection: 'asc',
init: function() {
// If there's an initial search, trigger the filter after a short delay
// to ensure the table is fully rendered
if (this.search) {
var self = this;
setTimeout(function() {
self.filterTable();
}, 100);
}
},
filterTable: function() {
var table = document.getElementById(tableId);
if (!table) {
@@ -4809,6 +4831,27 @@
console.log('Network Analysis loaded successfully on page load, refresh flag cleared for server ' + serverId);
}
}, 2000);
// Handle cross-reference from firewall logs
// If URL has network_search parameter and #network-analysis-card hash, scroll to it
var urlParams = new URLSearchParams(window.location.search);
var networkSearch = urlParams.get('network_search');
if (networkSearch && window.location.hash === '#network-analysis-card') {
// Wait a bit for page to fully render, then scroll to Network Analysis
setTimeout(function() {
var networkCard = document.getElementById('network-analysis-card');
if (networkCard) {
networkCard.scrollIntoView({ behavior: 'smooth', block: 'start' });
// Flash highlight the card briefly to draw attention
networkCard.style.transition = 'box-shadow 0.3s ease';
networkCard.style.boxShadow = '0 0 0 3px rgba(var(--color-primary), 0.5)';
setTimeout(function() {
networkCard.style.boxShadow = '';
}, 2000);
}
}, 500);
}
});
// Listen for 502 retry events from Core Router API