fix: wireguard health_check error + logs page ALL service + rotate confirmation

- WireGuardManager.test_connectivity: make peer_ip optional so health_check
  can call it without args (was logging ERROR on every health poll)
- Logs page: add ALL option to service selector (uses search across all services)
- Logs page: show service tag on each log line when in ALL/search mode
- Logs page: require window.confirm before rotating logs to prevent accidental data loss

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
This commit is contained in:
2026-04-21 01:47:41 -04:00
parent 67ddc97795
commit 50f2200b45
2 changed files with 13 additions and 7 deletions
+5 -2
View File
@@ -507,8 +507,11 @@ class WireGuardManager(BaseServiceManager):
except Exception as e: except Exception as e:
return self.handle_error(e, 'get_status') return self.handle_error(e, 'get_status')
def test_connectivity(self, peer_ip: str) -> Dict[str, Any]: def test_connectivity(self, peer_ip: str = None) -> Dict[str, Any]:
"""Ping a peer IP and return results.""" """Ping a peer IP and return results. Called with no args from health_check."""
if not peer_ip:
status = self.get_status()
return {'reachable': status.get('running', False), 'status': status.get('status')}
try: try:
result = subprocess.run( result = subprocess.run(
['ping', '-c', '1', '-W', '2', peer_ip], ['ping', '-c', '1', '-W', '2', peer_ip],
+8 -5
View File
@@ -6,7 +6,7 @@ import {
} from 'lucide-react'; } from 'lucide-react';
import { monitoringAPI, logsAPI, containerAPI } from '../services/api'; import { monitoringAPI, logsAPI, containerAPI } from '../services/api';
const SERVICES = ['network', 'wireguard', 'routing', 'email', 'calendar', 'files', 'vault', 'container']; const SERVICES = ['ALL', 'network', 'wireguard', 'routing', 'email', 'calendar', 'files', 'vault', 'container'];
const LEVELS = ['ALL', 'DEBUG', 'INFO', 'WARNING', 'ERROR', 'CRITICAL']; const LEVELS = ['ALL', 'DEBUG', 'INFO', 'WARNING', 'ERROR', 'CRITICAL'];
const LEVEL_COLORS = { const LEVEL_COLORS = {
DEBUG: 'text-gray-400', DEBUG: 'text-gray-400',
@@ -51,10 +51,11 @@ function ServiceLogsTab() {
const fetch = useCallback(async () => { const fetch = useCallback(async () => {
setLoading(true); setLoading(true);
try { try {
if (searchMode && query) { const allServices = SERVICES.filter(s => s !== 'ALL');
if (service === 'ALL' || (searchMode && query)) {
const res = await logsAPI.searchLogs({ const res = await logsAPI.searchLogs({
query, query: query || '',
services: [service], services: service === 'ALL' ? allServices : [service],
level: level === 'ALL' ? undefined : level, level: level === 'ALL' ? undefined : level,
}); });
setLogs(res.data.results || []); setLogs(res.data.results || []);
@@ -273,7 +274,9 @@ function StatisticsTab() {
useEffect(() => { fetch(); }, []); useEffect(() => { fetch(); }, []);
const rotate = async (service) => { const rotate = async (service) => {
setRotating(service); const label = service || 'all services';
if (!window.confirm(`Rotate logs for ${label}? Current log file will be archived and a new one started.`)) return;
setRotating(service || 'all');
try { try {
await logsAPI.rotateLogs(service || null); await logsAPI.rotateLogs(service || null);
await fetch(); await fetch();