From fab4f59336515e6b0669a4f255ef9a7e2bcbfb9d Mon Sep 17 00:00:00 2001 From: ACoolName Date: Sun, 2 Jun 2024 12:43:07 +0300 Subject: [PATCH] test --- src/common.tsx | 13 ++++++++++++- 1 file changed, 12 insertions(+), 1 deletion(-) diff --git a/src/common.tsx b/src/common.tsx index a3f6772..10a3d8b 100644 --- a/src/common.tsx +++ b/src/common.tsx @@ -17,6 +17,8 @@ import MenuItem from '@mui/material/MenuItem'; import MenuList from '@mui/material/MenuList'; import { Permission } from "./actions"; import TerminalComponent from "./terminal"; +import ReactDOM, { render } from "react-dom"; +import { createRoot } from "react-dom/client"; export const apiAuthenticatedContext: Context<[boolean, Dispatch]> = createContext([false, (value: boolean) => {}] as [boolean, Dispatch]) @@ -263,9 +265,18 @@ 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"; + createRoot(terminalWindow.document.getElementById('terminal-root')!).render(); + } + } + return (<> - + { setForm(false); setFormData({}); }} open={form}