mirror of
https://github.com/Studio-Saelix/sencho.git
synced 2026-08-19 14:56:27 +00:00
feat(topology): overhaul network topology with dagre layout, enriched nodes, and click-to-logs (#447)
Replace N+1 Docker API calls (inspectNetwork per network) with a container-centric approach that fetches all networks and containers in 2 parallel calls, then maps relationships in memory. Add dagre auto-layout algorithm for hierarchical DAG visualization, replacing the static two-row layout that caused edge spaghetti at scale. Add "Show system networks" toggle, enrich container nodes with running state indicators, stack badges, and base image names. Clicking a running container opens its log viewer directly from the topology graph.
This commit is contained in:
@@ -51,6 +51,8 @@ import ScheduledOperationsView from './ScheduledOperationsView';
|
||||
import AutoUpdatePoliciesView from './AutoUpdatePoliciesView';
|
||||
import { SENCHO_NAVIGATE_EVENT } from './NodeManager';
|
||||
import type { SenchoNavigateDetail } from './NodeManager';
|
||||
import { SENCHO_OPEN_LOGS_EVENT } from '@/lib/events';
|
||||
import type { SenchoOpenLogsDetail } from '@/lib/events';
|
||||
import { useNodes } from '@/context/NodeContext';
|
||||
import type { Node } from '@/context/NodeContext';
|
||||
import { useAuth } from '@/context/AuthContext';
|
||||
@@ -1270,6 +1272,18 @@ export default function EditorLayout() {
|
||||
setLogContainer(null);
|
||||
};
|
||||
|
||||
// Listen for topology click-to-logs events (ref avoids stale closure)
|
||||
const openLogViewerRef = useRef(openLogViewer);
|
||||
openLogViewerRef.current = openLogViewer;
|
||||
useEffect(() => {
|
||||
const handler = (e: Event) => {
|
||||
const { containerId, containerName } = (e as CustomEvent<SenchoOpenLogsDetail>).detail;
|
||||
openLogViewerRef.current(containerId, containerName);
|
||||
};
|
||||
window.addEventListener(SENCHO_OPEN_LOGS_EVENT, handler);
|
||||
return () => window.removeEventListener(SENCHO_OPEN_LOGS_EVENT, handler);
|
||||
}, []);
|
||||
|
||||
// Safe container list with fallback
|
||||
const safeContainers = containers || [];
|
||||
// Safe content strings with fallback
|
||||
|
||||
Reference in New Issue
Block a user