diff --git a/src/common.tsx b/src/common.tsx index b13b31f..31f73e4 100644 --- a/src/common.tsx +++ b/src/common.tsx @@ -17,7 +17,6 @@ import MenuItem from '@mui/material/MenuItem'; import MenuList from '@mui/material/MenuList'; import { Permission } from "./actions"; import TerminalComponent from "./terminal"; -import ReactDOM from "react-dom/client"; export const apiAuthenticatedContext: Context<[boolean, Dispatch]> = createContext([false, (value: boolean) => {}] as [boolean, Dispatch]) @@ -264,28 +263,13 @@ export function ActionItem(p: { action: ActionInfo, identifierSubstring?: string function onFormChange(args: IChangeEvent) { setFormData(args.formData) } - function openTerminalWindow(websocketUrl: string) { - const terminalWindow = window.open('', '', 'width=800,height=600'); - if (terminalWindow) { - terminalWindow.document.write('
'); - terminalWindow.document.title = "Terminal"; - - var terminal_root = terminalWindow.document.getElementById('terminal-root')! - const root = ReactDOM.createRoot( - terminalWindow.document.getElementById('root') as HTMLElement - ); - root.render( - - - - ); - } + function createTerminalWindow(websocket: string){ + window.open(`/terminal.html?ws=${encodeURIComponent(websocket)}`, 'Terminal', 'width=800,height=600'); } - return (<> - + { setForm(false); setFormData({}); }} open={form}