Merge pull request #415 from liebertar/fix/dashboard-auto-close-tabs

Auto-close dashboard tabs when server stops responding
This commit is contained in:
Dominik Jain authored and GitHub committed 2025-08-05 11:36:40 +02:00
commit 117285e0b1
1 file changed
+7
@@ -52,6 +52,7 @@ class Dashboard {
this.toolNames = [];
this.currentMaxIdx = -1;
this.pollInterval = null;
this.failureCount = 0;
this.$logContainer = $('#log-container');
this.$errorContainer = $('#error-container');
this.$loadButton = $('#load-logs');
@@ -161,6 +162,7 @@ class Dashboard {
start_idx: self.currentMaxIdx + 1
}),
success: function(response) {
self.failureCount = 0;
// Only append new messages if we have any
if (response.messages && response.messages.length > 0) {
let wasAtBottom = false;
@@ -190,6 +192,11 @@ class Dashboard {
},
error: function(xhr, status, error) {
console.error('Error polling for new logs:', error);
self.failureCount++;
if (self.failureCount >= 3) {
console.log('Server appears to be down, closing tab');
window.close();
}
}
});
}