zack commited on
Commit
e99cd9a
Β·
1 Parent(s): d7597b3

πŸ”§ fix: update app.py with socketio configurations

Browse files

πŸš€ feat: enhance Proxmox component with new socket logic

πŸ—‘οΈ chore: remove old xterm files

frontend/src/components/Proxmox/xterm.css DELETED
@@ -1,218 +0,0 @@
1
- /**
2
- * Copyright (c) 2014 The xterm.js authors. All rights reserved.
3
- * Copyright (c) 2012-2013, Christopher Jeffrey (MIT License)
4
- * https://github.com/chjj/term.js
5
- * @license MIT
6
- *
7
- * Permission is hereby granted, free of charge, to any person obtaining a copy
8
- * of this software and associated documentation files (the "Software"), to deal
9
- * in the Software without restriction, including without limitation the rights
10
- * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
11
- * copies of the Software, and to permit persons to whom the Software is
12
- * furnished to do so, subject to the following conditions:
13
- *
14
- * The above copyright notice and this permission notice shall be included in
15
- * all copies or substantial portions of the Software.
16
- *
17
- * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
18
- * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
19
- * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
20
- * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
21
- * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
22
- * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
23
- * THE SOFTWARE.
24
- *
25
- * Originally forked from (with the author's permission):
26
- * Fabrice Bellard's javascript vt100 for jslinux:
27
- * http://bellard.org/jslinux/
28
- * Copyright (c) 2011 Fabrice Bellard
29
- * The original design remains. The terminal itself
30
- * has been extended to include xterm CSI codes, among
31
- * other features.
32
- */
33
-
34
- /**
35
- * Default styles for xterm.js
36
- */
37
-
38
- .xterm {
39
- cursor: text;
40
- position: relative;
41
- user-select: none;
42
- -ms-user-select: none;
43
- -webkit-user-select: none;
44
- }
45
-
46
- .xterm.focus,
47
- .xterm:focus {
48
- outline: none;
49
- }
50
-
51
- .xterm .xterm-helpers {
52
- position: absolute;
53
- top: 0;
54
- /**
55
- * The z-index of the helpers must be higher than the canvases in order for
56
- * IMEs to appear on top.
57
- */
58
- z-index: 5;
59
- }
60
-
61
- .xterm .xterm-helper-textarea {
62
- padding: 0;
63
- border: 0;
64
- margin: 0;
65
- /* Move textarea out of the screen to the far left, so that the cursor is not visible */
66
- position: absolute;
67
- opacity: 0;
68
- left: -9999em;
69
- top: 0;
70
- width: 0;
71
- height: 0;
72
- z-index: -5;
73
- /** Prevent wrapping so the IME appears against the textarea at the correct position */
74
- white-space: nowrap;
75
- overflow: hidden;
76
- resize: none;
77
- }
78
-
79
- .xterm .composition-view {
80
- /* TODO: Composition position got messed up somewhere */
81
- background: #000;
82
- color: #FFF;
83
- display: none;
84
- position: absolute;
85
- white-space: nowrap;
86
- z-index: 1;
87
- }
88
-
89
- .xterm .composition-view.active {
90
- display: block;
91
- }
92
-
93
- .xterm .xterm-viewport {
94
- /* On OS X this is required in order for the scroll bar to appear fully opaque */
95
- background-color: #000;
96
- overflow-y: scroll;
97
- cursor: default;
98
- position: absolute;
99
- right: 0;
100
- left: 0;
101
- top: 0;
102
- bottom: 0;
103
- }
104
-
105
- .xterm .xterm-screen {
106
- position: relative;
107
- }
108
-
109
- .xterm .xterm-screen canvas {
110
- position: absolute;
111
- left: 0;
112
- top: 0;
113
- }
114
-
115
- .xterm .xterm-scroll-area {
116
- visibility: hidden;
117
- }
118
-
119
- .xterm-char-measure-element {
120
- display: inline-block;
121
- visibility: hidden;
122
- position: absolute;
123
- top: 0;
124
- left: -9999em;
125
- line-height: normal;
126
- }
127
-
128
- .xterm.enable-mouse-events {
129
- /* When mouse events are enabled (eg. tmux), revert to the standard pointer cursor */
130
- cursor: default;
131
- }
132
-
133
- .xterm.xterm-cursor-pointer,
134
- .xterm .xterm-cursor-pointer {
135
- cursor: pointer;
136
- }
137
-
138
- .xterm.column-select.focus {
139
- /* Column selection mode */
140
- cursor: crosshair;
141
- }
142
-
143
- .xterm .xterm-accessibility:not(.debug),
144
- .xterm .xterm-message {
145
- position: absolute;
146
- left: 0;
147
- top: 0;
148
- bottom: 0;
149
- right: 0;
150
- z-index: 10;
151
- color: transparent;
152
- pointer-events: none;
153
- }
154
-
155
- .xterm .xterm-accessibility-tree:not(.debug) *::selection {
156
- color: transparent;
157
- }
158
-
159
- .xterm .xterm-accessibility-tree {
160
- user-select: text;
161
- white-space: pre;
162
- }
163
-
164
- .xterm .live-region {
165
- position: absolute;
166
- left: -9999px;
167
- width: 1px;
168
- height: 1px;
169
- overflow: hidden;
170
- }
171
-
172
- .xterm-dim {
173
- /* Dim should not apply to background, so the opacity of the foreground color is applied
174
- * explicitly in the generated class and reset to 1 here */
175
- opacity: 1 !important;
176
- }
177
-
178
- .xterm-underline-1 { text-decoration: underline; }
179
- .xterm-underline-2 { text-decoration: double underline; }
180
- .xterm-underline-3 { text-decoration: wavy underline; }
181
- .xterm-underline-4 { text-decoration: dotted underline; }
182
- .xterm-underline-5 { text-decoration: dashed underline; }
183
-
184
- .xterm-overline {
185
- text-decoration: overline;
186
- }
187
-
188
- .xterm-overline.xterm-underline-1 { text-decoration: overline underline; }
189
- .xterm-overline.xterm-underline-2 { text-decoration: overline double underline; }
190
- .xterm-overline.xterm-underline-3 { text-decoration: overline wavy underline; }
191
- .xterm-overline.xterm-underline-4 { text-decoration: overline dotted underline; }
192
- .xterm-overline.xterm-underline-5 { text-decoration: overline dashed underline; }
193
-
194
- .xterm-strikethrough {
195
- text-decoration: line-through;
196
- }
197
-
198
- .xterm-screen .xterm-decoration-container .xterm-decoration {
199
- z-index: 6;
200
- position: absolute;
201
- }
202
-
203
- .xterm-screen .xterm-decoration-container .xterm-decoration.xterm-decoration-top-layer {
204
- z-index: 7;
205
- }
206
-
207
- .xterm-decoration-overview-ruler {
208
- z-index: 8;
209
- position: absolute;
210
- top: 0;
211
- right: 0;
212
- pointer-events: none;
213
- }
214
-
215
- .xterm-decoration-top {
216
- z-index: 2;
217
- position: relative;
218
- }
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
frontend/src/components/Proxmox/xterm.js DELETED
@@ -1,30 +0,0 @@
1
- import React, { useEffect, useRef } from 'react';
2
- import { Terminal } from 'xterm';
3
- import './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;