feat: real-time server CRUD sync and pve CLI auto-install
Some checks failed
Backend Tests / pytest (Python 3.12) (push) Has been cancelled

Backend:
- servers.py: instant connectivity check + VM cache sync after create/update;
  broadcast server_added/updated/deleted events via WebSocket
- websocket_manager: add broadcast_event() helper for global fire-and-forget events

Frontend:
- use-nodes: invalidate topology, VM list and resources after server create/update/delete
- use-realtime-sync: new hook with useGlobalRealtimeSync subscribing to server_*
  WS events and invalidating relevant React Query caches
- AppLayout: mount useGlobalRealtimeSync globally

Deploy:
- deploy.sh: auto-install pve CLI during main/quick deploy (idempotent, --auto mode)
This commit is contained in:
markmorado
2026-05-11 05:31:52 +02:00
parent 742ff27fb4
commit 453c18f192
6 changed files with 284 additions and 11 deletions

View File

@@ -36,6 +36,7 @@ import { useAuthStore } from '@/stores/auth-store';
import { useThemeStore } from '@/stores/theme-store';
import { useWorkspaceStore } from '@/stores/workspace-store';
import { useWorkspaces } from '@/hooks/use-workspaces';
import { useGlobalRealtimeSync } from '@/hooks/use-realtime-sync';
import { useTranslation } from 'react-i18next';
import { useQueryClient } from '@tanstack/react-query';
import NotificationsDropdown from '@/components/shared/NotificationsDropdown';
@@ -266,6 +267,11 @@ function TopBar() {
}
export default function AppLayout() {
// Глобальная подписка на real-time события WebSocket: server_added/updated/deleted,
// vm_status_update/created/deleted. Кэши React Query инвалидируются мгновенно,
// поэтому пользователю не нужно обновлять страницу.
useGlobalRealtimeSync();
return (
<div className="flex h-screen overflow-hidden">
{/* Desktop sidebar */}