Spaces:
Configuration error
Configuration error
zack
commited on
Commit
·
5b305a3
1
Parent(s):
da79dee
🔥 chore(frontend): permanently remove xterm.js component
Browse files- frontend/components/xterm.js +0 -30
frontend/components/xterm.js
DELETED
@@ -1,30 +0,0 @@
|
|
1 |
-
import React, { useEffect, useRef } from 'react';
|
2 |
-
import { Terminal } from 'xterm';
|
3 |
-
import 'xterm/css/xterm.css';
|
4 |
-
|
5 |
-
const TerminalComponent = ({ socket }) => {
|
6 |
-
const terminalRef = useRef(null);
|
7 |
-
useEffect(() => {
|
8 |
-
const terminal = new Terminal();
|
9 |
-
terminal.open(terminalRef.current);
|
10 |
-
|
11 |
-
const ws = new WebSocket('ws://localhost:8080');
|
12 |
-
ws.onopen = () => {
|
13 |
-
console.log('Connected to WebSocket');
|
14 |
-
ws.send('fetchVmData'); // Request VM data on connection
|
15 |
-
};
|
16 |
-
ws.onmessage = (event) => {
|
17 |
-
const data = JSON.parse(event.data);
|
18 |
-
terminal.write(JSON.stringify(data, null, 2)); // Display VM data in terminal
|
19 |
-
};
|
20 |
-
|
21 |
-
return () => {
|
22 |
-
ws.close();
|
23 |
-
socket.off('data');
|
24 |
-
};
|
25 |
-
}, []);
|
26 |
-
|
27 |
-
return <div ref={terminalRef} />;
|
28 |
-
};
|
29 |
-
|
30 |
-
export default TerminalComponent;
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|