mirror of
https://github.com/Dokploy/dokploy
synced 2025-06-26 18:27:59 +00:00
refactor: update ref
This commit is contained in:
@@ -21,13 +21,21 @@ export const DockerLogsId: React.FC<Props> = ({
|
|||||||
const wsRef = useRef<WebSocket | null>(null); // Ref to hold WebSocket instance
|
const wsRef = useRef<WebSocket | null>(null); // Ref to hold WebSocket instance
|
||||||
|
|
||||||
useEffect(() => {
|
useEffect(() => {
|
||||||
if (containerId === "select-a-containe") {
|
// if (containerId === "select-a-container") {
|
||||||
return;
|
// return;
|
||||||
}
|
// }
|
||||||
const container = document.getElementById(id);
|
const container = document.getElementById(id);
|
||||||
if (container) {
|
if (container) {
|
||||||
container.innerHTML = "";
|
container.innerHTML = "";
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if (wsRef.current) {
|
||||||
|
console.log(wsRef.current);
|
||||||
|
if (wsRef.current.readyState === WebSocket.OPEN) {
|
||||||
|
wsRef.current.close();
|
||||||
|
}
|
||||||
|
wsRef.current = null;
|
||||||
|
}
|
||||||
const termi = new Terminal({
|
const termi = new Terminal({
|
||||||
cursorBlink: true,
|
cursorBlink: true,
|
||||||
cols: 80,
|
cols: 80,
|
||||||
|
|||||||
@@ -33,6 +33,8 @@ export const setupDockerContainerLogsWebSocketServer = (
|
|||||||
const tail = url.searchParams.get("tail");
|
const tail = url.searchParams.get("tail");
|
||||||
const serverId = url.searchParams.get("serverId");
|
const serverId = url.searchParams.get("serverId");
|
||||||
const { user, session } = await validateWebSocketRequest(req);
|
const { user, session } = await validateWebSocketRequest(req);
|
||||||
|
console.log(wssTerm.clients);
|
||||||
|
console.log(wssTerm.clients.size);
|
||||||
|
|
||||||
if (!containerId) {
|
if (!containerId) {
|
||||||
ws.close(4000, "containerId no provided");
|
ws.close(4000, "containerId no provided");
|
||||||
|
|||||||
Reference in New Issue
Block a user