Batch API endpoints, reduce frontend polling by ~75%, fix resource leaks

Backend: add batch endpoints for target states, metrics, and device
health to replace O(N) individual API calls per poll cycle.
Frontend: use batch endpoints in dashboard/targets/profiles tabs,
fix Chart.js instance leaks, debounce server event reloads, add
i18n active-tab guards, clean up ResizeObserver on pattern editor
close, cache uptime timer DOM refs, increase KC auto-refresh to 2s.

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
This commit is contained in:
2026-02-22 18:55:09 +03:00
parent d4a0f3a7f5
commit 9392741f08
8 changed files with 125 additions and 73 deletions

View File

@@ -407,6 +407,18 @@ class ProcessorManager:
"""Get detailed metrics for a target (any type)."""
return self._get_processor(target_id).get_metrics()
def get_all_target_states(self) -> Dict[str, dict]:
"""Get processing state for all targets (with device health merged)."""
return {tid: self.get_target_state(tid) for tid in self._processors}
def get_all_target_metrics(self) -> Dict[str, dict]:
"""Get metrics for all targets."""
return {tid: proc.get_metrics() for tid, proc in self._processors.items()}
def get_all_device_health_dicts(self) -> Dict[str, dict]:
"""Get health/connection state for all devices."""
return {did: self.get_device_health_dict(did) for did in self._devices}
def is_target_processing(self, target_id: str) -> bool:
"""Check if target is currently processing."""
return self._get_processor(target_id).is_running