mirror of
https://github.com/swissmakers/fail2ban-ui.git
synced 2026-04-11 13:47:05 +02:00
Add close-cross on all toast-ban-event and unban events to quicker close them
This commit is contained in:
@@ -75,9 +75,21 @@ function showBanEventToast(event) {
|
||||
+ ' ' + escapeHtml(server) + ' • ' + escapeHtml(country)
|
||||
+ ' </div>'
|
||||
+ ' </div>'
|
||||
+ ' <button class="flex-shrink-0 ml-2 mt-0.5 text-gray-400 hover:text-white focus:outline-none" aria-label="Close">'
|
||||
+ ' <i class="fas fa-times text-sm"></i>'
|
||||
+ ' </button>'
|
||||
+ '</div>';
|
||||
|
||||
// Add click handler to scroll to ban events table
|
||||
|
||||
// Close button handler
|
||||
var closeBtn = toast.querySelector('button');
|
||||
closeBtn.addEventListener('click', function(e) {
|
||||
e.stopPropagation();
|
||||
clearTimeout(autoRemoveTimer);
|
||||
toast.classList.remove('show');
|
||||
setTimeout(function() { toast.remove(); }, 300);
|
||||
});
|
||||
|
||||
// Click on toast body scrolls to ban events table
|
||||
toast.addEventListener('click', function() {
|
||||
var logSection = document.getElementById('logOverviewSection');
|
||||
if (logSection) {
|
||||
@@ -92,7 +104,7 @@ function showBanEventToast(event) {
|
||||
toast.classList.add('show');
|
||||
});
|
||||
|
||||
setTimeout(function() {
|
||||
var autoRemoveTimer = setTimeout(function() {
|
||||
toast.classList.remove('show');
|
||||
setTimeout(function() {
|
||||
toast.remove();
|
||||
|
||||
Reference in New Issue
Block a user