feat: Remote Nodes Wiring & SSH Adapters

This commit is contained in:
SaelixCode
2026-03-18 12:55:30 -04:00
parent 457c9976bc
commit 8c51198468
19 changed files with 742 additions and 429 deletions
+1 -1
View File
@@ -118,10 +118,10 @@ export default function BashExecModal({ isOpen, onClose, containerId, containerN
wsRef.current = ws;
ws.onopen = () => {
// Kick off the exec session
ws.send(JSON.stringify({
action: 'execContainer',
containerId: containerId,
nodeId: localStorage.getItem('sencho-active-node') || undefined
}));
setIsConnected(true);
+5 -1
View File
@@ -193,7 +193,11 @@ export default function EditorLayout() {
const wsProtocol = window.location.protocol === 'https:' ? 'wss:' : 'ws:';
const ws = new WebSocket(`${wsProtocol}//${window.location.host}`);
wsMap[container.Id] = ws;
ws.onopen = () => ws.send(JSON.stringify({ action: 'streamStats', containerId: container.Id }));
ws.onopen = () => ws.send(JSON.stringify({
action: 'streamStats',
containerId: container.Id,
nodeId: localStorage.getItem('sencho-active-node') || undefined
}));
ws.onmessage = (event) => {
try {
const data = JSON.parse(event.data);
@@ -73,7 +73,8 @@ export function GlobalObservabilityView() {
useEffect(() => {
if (devMode) {
// SSE mode
const eventSource = new EventSource('/api/logs/global/stream');
const activeNodeId = localStorage.getItem('sencho-active-node') || '';
const eventSource = new EventSource(`/api/logs/global/stream?nodeId=${activeNodeId}`);
eventSource.onmessage = (event) => {
try {
+2 -1
View File
@@ -27,7 +27,8 @@ export function LogViewer({ containerId, containerName, isOpen, onClose }: LogVi
setLogs([]);
setIsConnected(false);
const eventSource = new EventSource(`/api/containers/${containerId}/logs`);
const activeNodeId = localStorage.getItem('sencho-active-node') || '';
const eventSource = new EventSource(`/api/containers/${containerId}/logs?nodeId=${activeNodeId}`);
eventSource.onopen = () => setIsConnected(true);
+2 -1
View File
@@ -125,11 +125,12 @@ export default function TerminalComponent({ stackName }: TerminalComponentProps)
const wsProtocol = window.location.protocol === 'https:' ? 'wss:' : 'ws:';
const cleanStackName = stackName?.replace(/\.(yml|yaml)$/, '');
const activeNodeId = localStorage.getItem('sencho-active-node') || '';
// If a stackName is provided, connect to the dedicated logs WebSocket
// Otherwise, fall back to the generic terminal WebSocket
const wsUrl = cleanStackName
? `${wsProtocol}//${window.location.host}/api/stacks/${cleanStackName}/logs`
? `${wsProtocol}//${window.location.host}/api/stacks/${cleanStackName}/logs${activeNodeId ? `?nodeId=${activeNodeId}` : ''}`
: `${wsProtocol}//${window.location.host}`;
const ws = new WebSocket(wsUrl);