mirror of
https://github.com/Studio-Saelix/sencho.git
synced 2026-08-29 03:36:55 +00:00
feat: Remote Nodes Wiring & SSH Adapters
This commit is contained in:
@@ -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);
|
||||
|
||||
|
||||
@@ -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 {
|
||||
|
||||
@@ -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);
|
||||
|
||||
|
||||
@@ -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);
|
||||
|
||||
Reference in New Issue
Block a user