feat: add better auto refresh
This commit is contained in:
@@ -98,17 +98,18 @@
|
|||||||
function updateTimestamp() {
|
function updateTimestamp() {
|
||||||
document.getElementById('last-updated').textContent = new Date().toLocaleString();
|
document.getElementById('last-updated').textContent = new Date().toLocaleString();
|
||||||
}
|
}
|
||||||
|
|
||||||
// Update timestamp every 30 seconds
|
// Auto refresh functionality for all pages except logs
|
||||||
setInterval(updateTimestamp, 30000);
|
if (window.location.pathname !== '/dashboard/logs') {
|
||||||
updateTimestamp();
|
// Update timestamp and refresh page every 10 seconds
|
||||||
|
|
||||||
// Auto refresh page every 5 minutes for dashboard
|
|
||||||
if (window.location.pathname === '/dashboard') {
|
|
||||||
setInterval(() => {
|
setInterval(() => {
|
||||||
|
updateTimestamp();
|
||||||
window.location.reload();
|
window.location.reload();
|
||||||
}, 300000);
|
}, 10000);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// Initial timestamp update
|
||||||
|
updateTimestamp();
|
||||||
</script>
|
</script>
|
||||||
|
|
||||||
{% block scripts %}{% endblock %}
|
{% block scripts %}{% endblock %}
|
||||||
|
@@ -150,8 +150,11 @@
|
|||||||
function updateCurrentTime() {
|
function updateCurrentTime() {
|
||||||
document.getElementById('current-time').textContent = new Date().toLocaleString();
|
document.getElementById('current-time').textContent = new Date().toLocaleString();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// Initial update
|
||||||
updateCurrentTime();
|
updateCurrentTime();
|
||||||
setInterval(updateCurrentTime, 1000);
|
|
||||||
|
// Note: Page auto-refreshes every 10 seconds via base.html
|
||||||
|
// The current time will be updated on each refresh
|
||||||
</script>
|
</script>
|
||||||
{% endblock %}
|
{% endblock %}
|
@@ -209,9 +209,7 @@
|
|||||||
|
|
||||||
{% block scripts %}
|
{% block scripts %}
|
||||||
<script>
|
<script>
|
||||||
// Auto-refresh every 60 seconds
|
// Note: Page auto-refreshes every 10 seconds via base.html
|
||||||
setInterval(() => {
|
// No additional refresh logic needed here
|
||||||
window.location.reload();
|
|
||||||
}, 60000);
|
|
||||||
</script>
|
</script>
|
||||||
{% endblock %}
|
{% endblock %}
|
Reference in New Issue
Block a user