From 340dd92e8a1aa4f5218e5a99aca2b210a757ad2c Mon Sep 17 00:00:00 2001 From: ACoolName Date: Mon, 27 May 2024 19:45:29 +0300 Subject: [PATCH] fixed terminal --- src/actions.tsx | 18 +++++++++--------- src/common.tsx | 14 ++++++++++++-- 2 files changed, 21 insertions(+), 11 deletions(-) diff --git a/src/actions.tsx b/src/actions.tsx index 493b4c3..ef73bbe 100644 --- a/src/actions.tsx +++ b/src/actions.tsx @@ -444,6 +444,15 @@ export const SERVER_ACTIONS: ActionInfo[] = [ permissions: Permission.Start, response_action: "Ignore" }, + { + name: "Terminal", + args: { + }, + requestType: "post", + endpoint: "/servers/{server_id}/attach", + permissions: Permission.RunCommand, + response_action: "Terminal" + }, { name: "Stop", args: { @@ -572,15 +581,6 @@ export const SERVER_ACTIONS: ActionInfo[] = [ definitions: definitions, }, }, - { - name: "Interactive", - args: { - }, - requestType: "post", - endpoint: "/servers/{server_id}/attach", - permissions: Permission.RunCommand, - response_action: "Terminal" - }, ] export const CREATE_SERVER_ACTION: ActionInfo = { diff --git a/src/common.tsx b/src/common.tsx index f6657b1..4fc280b 100644 --- a/src/common.tsx +++ b/src/common.tsx @@ -16,7 +16,6 @@ import Popper from '@mui/material/Popper'; import MenuItem from '@mui/material/MenuItem'; import MenuList from '@mui/material/MenuList'; import { Permission } from "./actions"; -import { Terminal } from "xterm"; import TerminalComponent from "./terminal"; export const apiAuthenticatedContext: Context<[boolean, Dispatch]> = createContext([false, (value: boolean) => {}] as [boolean, Dispatch]) @@ -32,6 +31,17 @@ export const formModalStyle = { p: 4, borderRadius: 3, } +export const terminalModalStyle = { + position: 'absolute' as 'absolute', + top: '50%', + left: '50%', + transform: 'translate(-50%, -50%)', + width: '70%', + bgcolor: 'background.paper', + p: 4, + borderRadius: 3, + padding: 10, +} export const getDesignTokens = (mode: PaletteMode) => ({ palette: { @@ -278,7 +288,7 @@ export function ActionItem(p: { action: ActionInfo, identifierSubstring?: string onClose={() => { setTerminal(null); }} open={terminal != null} > - +