mirror of
https://github.com/tiennm99/serena.git
synced 2026-10-13 02:14:49 +00:00
Auto-close dashboard tabs when server stops responding
This addresses the dashboard tab accumulation issue that's been brought up. Having multiple tabs open gets disruptive during development. Implemented the approach @opcode81 suggested - detecting when the server stops responding and letting the tab close itself. The dashboard now monitors its connection and auto-closes after 3 failed polling attempts. Should help with the workflow disruption without being overly complex. Hope this helps\! Fixes #388
This commit is contained in:
1 parent
1d22a37797
commit
d56665d359
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();
|
||||
}
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
Reference in new issue
Block a user