test
This commit is contained in:
parent
aed23759ce
commit
cff965872e
@ -17,7 +17,6 @@ import MenuItem from '@mui/material/MenuItem';
|
|||||||
import MenuList from '@mui/material/MenuList';
|
import MenuList from '@mui/material/MenuList';
|
||||||
import { Permission } from "./actions";
|
import { Permission } from "./actions";
|
||||||
import TerminalComponent from "./terminal";
|
import TerminalComponent from "./terminal";
|
||||||
import ReactDOM from "react-dom/client";
|
|
||||||
|
|
||||||
export const apiAuthenticatedContext: Context<[boolean, Dispatch<boolean>]> = createContext([false, (value: boolean) => {}] as [boolean, Dispatch<boolean>])
|
export const apiAuthenticatedContext: Context<[boolean, Dispatch<boolean>]> = createContext([false, (value: boolean) => {}] as [boolean, Dispatch<boolean>])
|
||||||
|
|
||||||
@ -264,28 +263,13 @@ export function ActionItem(p: { action: ActionInfo, identifierSubstring?: string
|
|||||||
function onFormChange(args: IChangeEvent<any, RJSFSchema, any>) {
|
function onFormChange(args: IChangeEvent<any, RJSFSchema, any>) {
|
||||||
setFormData(args.formData)
|
setFormData(args.formData)
|
||||||
}
|
}
|
||||||
function openTerminalWindow(websocketUrl: string) {
|
|
||||||
const terminalWindow = window.open('', '', 'width=800,height=600');
|
|
||||||
if (terminalWindow) {
|
|
||||||
terminalWindow.document.write('<div id="root"/>');
|
|
||||||
terminalWindow.document.title = "Terminal";
|
|
||||||
|
|
||||||
var terminal_root = terminalWindow.document.getElementById('terminal-root')!
|
function createTerminalWindow(websocket: string){
|
||||||
const root = ReactDOM.createRoot(
|
window.open(`/terminal.html?ws=${encodeURIComponent(websocket)}`, 'Terminal', 'width=800,height=600');
|
||||||
terminalWindow.document.getElementById('root') as HTMLElement
|
|
||||||
);
|
|
||||||
root.render(
|
|
||||||
<React.StrictMode>
|
|
||||||
<TerminalComponent websocket={websocketUrl} />
|
|
||||||
</React.StrictMode>
|
|
||||||
);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
return (<>
|
return (<>
|
||||||
<Button variant={p.variant} disabled={!isUserAllowed(user, p.action)} onClick={() => { if (p.onClick) { p.onClick() } p.action.response_action == 'Terminal'?openTerminalWindow(`ws${API_URL.slice("http".length)}${url}`):setForm(true) }} sx={p.sx}>{p.action.name}</Button >
|
<Button variant={p.variant} disabled={!isUserAllowed(user, p.action)} onClick={() => { if (p.onClick) { p.onClick() } p.action.response_action == 'Terminal'?createTerminalWindow(`ws${API_URL.slice("http".length)}${url}`):setForm(true) }} sx={p.sx}>{p.action.name}</Button >
|
||||||
<Modal
|
<Modal
|
||||||
onClose={() => { setForm(false); setFormData({}); }}
|
onClose={() => { setForm(false); setFormData({}); }}
|
||||||
open={form}
|
open={form}
|
||||||
|
Loading…
x
Reference in New Issue
Block a user