Add lt.autoRefresh, fix showToast in admin, clean up inline styles
- Replace all 8 showToast() calls in ApiKeysView.php with lt.toast.* — all toast calls in the codebase now use lt.toast directly - Add .duplicate-list, .duplicate-meta, .duplicate-hint CSS classes to dashboard.css; replace inline styles in duplicate detection JS with them - Add dashboardAutoRefresh() using lt.autoRefresh — reloads page every 5 minutes, skipping if a modal is open or user is typing in an input - Add REFRESH button to dashboard header that triggers lt.autoRefresh.now() for immediate manual refresh with timer restart Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
This commit is contained in:
@@ -1819,6 +1819,30 @@ function hideLoadingOverlay(element) {
|
||||
}
|
||||
}
|
||||
|
||||
// ========================================
|
||||
// AUTO-REFRESH (lt.autoRefresh integration)
|
||||
// ========================================
|
||||
|
||||
/**
|
||||
* Reload the dashboard, but skip if a modal is open or user is typing.
|
||||
* Registered with lt.autoRefresh so it runs every 5 minutes automatically.
|
||||
*/
|
||||
function dashboardAutoRefresh() {
|
||||
// Don't interrupt the user if a modal is open
|
||||
if (document.querySelector('.lt-modal-overlay[aria-hidden="false"]')) return;
|
||||
// Don't interrupt if focus is in a text input
|
||||
const tag = document.activeElement?.tagName;
|
||||
if (tag === 'INPUT' || tag === 'TEXTAREA' || tag === 'SELECT') return;
|
||||
window.location.reload();
|
||||
}
|
||||
|
||||
document.addEventListener('DOMContentLoaded', function() {
|
||||
// Only run auto-refresh on the dashboard, not on ticket pages
|
||||
if (!window.location.pathname.includes('/ticket/')) {
|
||||
lt.autoRefresh.start(dashboardAutoRefresh, 5 * 60 * 1000);
|
||||
}
|
||||
});
|
||||
|
||||
// ========================================
|
||||
// RELATIVE TIMESTAMPS
|
||||
// ========================================
|
||||
|
||||
Reference in New Issue
Block a user