feat(dashboard): add click-outside dismissal for autocomplete dropdown
Closes bd-3ny. Added mousedown listener that dismisses the dropdown when clicking outside both the dropdown and textarea. Uses early return to avoid registering listeners when dropdown is already closed.
This commit is contained in:
@@ -24,6 +24,39 @@ class SessionControlMixin:
|
||||
session_file.unlink(missing_ok=True)
|
||||
self._send_json(200, {"ok": True})
|
||||
|
||||
def _dismiss_dead_sessions(self):
|
||||
"""Delete all dead session files (clear all from dashboard).
|
||||
|
||||
Note: is_dead is computed dynamically, not stored on disk, so we must
|
||||
recompute it here using the same logic as _collect_sessions.
|
||||
"""
|
||||
# Get liveness data (same as _collect_sessions)
|
||||
active_zellij_sessions = self._get_active_zellij_sessions()
|
||||
active_transcript_files = self._get_active_transcript_files()
|
||||
|
||||
dismissed_count = 0
|
||||
for f in SESSIONS_DIR.glob("*.json"):
|
||||
try:
|
||||
data = json.loads(f.read_text())
|
||||
if not isinstance(data, dict):
|
||||
continue
|
||||
# Recompute is_dead (it's not persisted to disk)
|
||||
is_dead = self._is_session_dead(
|
||||
data, active_zellij_sessions, active_transcript_files
|
||||
)
|
||||
if is_dead:
|
||||
safe_id = f.stem
|
||||
# Track dismissed Codex sessions
|
||||
while len(_dismissed_codex_ids) >= _DISMISSED_MAX:
|
||||
oldest_key = next(iter(_dismissed_codex_ids))
|
||||
del _dismissed_codex_ids[oldest_key]
|
||||
_dismissed_codex_ids[safe_id] = True
|
||||
f.unlink(missing_ok=True)
|
||||
dismissed_count += 1
|
||||
except (json.JSONDecodeError, OSError):
|
||||
continue
|
||||
self._send_json(200, {"ok": True, "dismissed": dismissed_count})
|
||||
|
||||
def _respond_to_session(self, session_id):
|
||||
"""Inject a response into the session's Zellij pane."""
|
||||
safe_id = os.path.basename(session_id)
|
||||
|
||||
Reference in New Issue
Block a user