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:
@@ -187,7 +187,7 @@ $nonce = SecurityHeadersMiddleware::getNonce();
|
||||
const expiresIn = document.getElementById('expiresIn').value;
|
||||
|
||||
if (!keyName) {
|
||||
showToast('Please enter a key name', 'error');
|
||||
lt.toast.error('Please enter a key name');
|
||||
return;
|
||||
}
|
||||
|
||||
@@ -212,15 +212,15 @@ $nonce = SecurityHeadersMiddleware::getNonce();
|
||||
document.getElementById('newKeyDisplay').style.display = 'block';
|
||||
document.getElementById('keyName').value = '';
|
||||
|
||||
showToast('API key generated successfully', 'success');
|
||||
lt.toast.success('API key generated successfully');
|
||||
|
||||
// Reload page after 5 seconds to show new key in table
|
||||
setTimeout(() => location.reload(), 5000);
|
||||
} else {
|
||||
showToast(data.error || 'Failed to generate API key', 'error');
|
||||
lt.toast.error(data.error || 'Failed to generate API key');
|
||||
}
|
||||
} catch (error) {
|
||||
showToast('Error generating API key: ' + error.message, 'error');
|
||||
lt.toast.error('Error generating API key: ' + error.message);
|
||||
}
|
||||
});
|
||||
|
||||
@@ -228,7 +228,7 @@ $nonce = SecurityHeadersMiddleware::getNonce();
|
||||
const keyInput = document.getElementById('newKeyValue');
|
||||
keyInput.select();
|
||||
document.execCommand('copy');
|
||||
showToast('API key copied to clipboard', 'success');
|
||||
lt.toast.success('API key copied to clipboard');
|
||||
}
|
||||
|
||||
async function revokeKey(keyId) {
|
||||
@@ -249,13 +249,13 @@ $nonce = SecurityHeadersMiddleware::getNonce();
|
||||
const data = await response.json();
|
||||
|
||||
if (data.success) {
|
||||
showToast('API key revoked successfully', 'success');
|
||||
lt.toast.success('API key revoked successfully');
|
||||
location.reload();
|
||||
} else {
|
||||
showToast(data.error || 'Failed to revoke API key', 'error');
|
||||
lt.toast.error(data.error || 'Failed to revoke API key');
|
||||
}
|
||||
} catch (error) {
|
||||
showToast('Error revoking API key: ' + error.message, 'error');
|
||||
lt.toast.error('Error revoking API key: ' + error.message);
|
||||
}
|
||||
}
|
||||
</script>
|
||||
|
||||
Reference in New Issue
Block a user