feat(FN-3454): add typed mesh snapshot API consumed by nodes view

Implements a typed mesh snapshot API in `@fusion/core` (`CentralCore.getMeshSnapshot`, `MeshSnapshot` type) and wires it through the dashboard nodes view via a new `useMeshState` hook, substantially simplifying `MeshTopology.tsx` by replacing internal state management with the centralized snapshot.

Fusion-Task-Id: FN-3454
This commit is contained in:
Fusion
2026-05-10 16:49:08 -07:00
committed by gsxdsm
parent 17ef50f820
commit 32e76c8cc0
19 changed files with 741 additions and 447 deletions

View File

@@ -4,6 +4,7 @@ import "./NodesView.css";
import { useNodes } from "../hooks/useNodes";
import { useProjects } from "../hooks/useProjects";
import { useNodeSettingsSync, computeSyncState } from "../hooks/useNodeSettingsSync";
import { useMeshState } from "../hooks/useMeshState";
import type { ManagedDockerNodeInfo, NodeInfo, NodeUpdateInput } from "../api";
import { NodeCard } from "./NodeCard";
import { MeshTopology } from "./MeshTopology";
@@ -34,6 +35,7 @@ export function NodesView({ addToast, onClose }: NodesViewProps) {
discoverRemoteProjects,
} = useNodes();
const { projects, refresh: refreshProjects } = useProjects();
const { meshState, loading: meshLoading, error: meshError } = useMeshState();
const { syncStatusMap, pushSettings, pullSettings, syncAuth, trackNode, getAuthSyncState, getAuthProviders } = useNodeSettingsSync();
const {
dockerNodes,
@@ -196,14 +198,13 @@ export function NodesView({ addToast, onClose }: NodesViewProps) {
</div>
</div>
{error && <div className="nodes-view-error">{error}</div>}
{(error || meshError) && <div className="nodes-view-error">{error ?? meshError}</div>}
{/* Mesh Topology Visualization */}
{!loading && nodes.length > 0 && (
{!meshLoading && meshState && meshState.nodes.length > 0 && (
<section className="nodes-view-topology" aria-label="Mesh Topology">
<h3 className="nodes-view-section-title">Mesh Topology</h3>
<MeshTopology nodes={nodes} />
<MeshTopology nodes={meshState.nodes} />
</section>
)}