mirror of
https://github.com/MacRimi/ProxMenux.git
synced 2025-12-14 08:06:22 +00:00
Update AppImage
This commit is contained in:
@@ -50,6 +50,9 @@ export function ScriptTerminalModal({
|
||||
const checkConnectionInterval = useRef<NodeJS.Timeout | null>(null)
|
||||
const isMobile = useIsMobile()
|
||||
|
||||
const [isWaitingNextInteraction, setIsWaitingNextInteraction] = useState(false)
|
||||
const waitingTimeoutRef = useRef<NodeJS.Timeout | null>(null)
|
||||
|
||||
const [modalHeight, setModalHeight] = useState(80)
|
||||
const [isResizing, setIsResizing] = useState(false)
|
||||
const startYRef = useRef(0)
|
||||
@@ -62,6 +65,7 @@ export function ScriptTerminalModal({
|
||||
setInteractionInput("")
|
||||
setCurrentInteraction(null)
|
||||
setIsConnected(false)
|
||||
setIsWaitingNextInteraction(false)
|
||||
|
||||
checkConnectionInterval.current = setInterval(() => {
|
||||
if (wsRef.current) {
|
||||
@@ -74,6 +78,9 @@ export function ScriptTerminalModal({
|
||||
if (checkConnectionInterval.current) {
|
||||
clearInterval(checkConnectionInterval.current)
|
||||
}
|
||||
if (waitingTimeoutRef.current) {
|
||||
clearTimeout(waitingTimeoutRef.current)
|
||||
}
|
||||
}
|
||||
}, [open])
|
||||
|
||||
@@ -135,6 +142,10 @@ export function ScriptTerminalModal({
|
||||
}
|
||||
|
||||
const handleWebInteraction = (interaction: WebInteraction) => {
|
||||
setIsWaitingNextInteraction(false)
|
||||
if (waitingTimeoutRef.current) {
|
||||
clearTimeout(waitingTimeoutRef.current)
|
||||
}
|
||||
setCurrentInteraction(interaction)
|
||||
}
|
||||
|
||||
@@ -162,6 +173,10 @@ export function ScriptTerminalModal({
|
||||
|
||||
setCurrentInteraction(null)
|
||||
setInteractionInput("")
|
||||
|
||||
waitingTimeoutRef.current = setTimeout(() => {
|
||||
setIsWaitingNextInteraction(true)
|
||||
}, 300)
|
||||
}
|
||||
|
||||
const handleCloseModal = () => {
|
||||
@@ -201,7 +216,7 @@ export function ScriptTerminalModal({
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div className="flex-1 overflow-hidden">
|
||||
<div className="flex-1 overflow-hidden relative">
|
||||
<TerminalPanel
|
||||
websocketUrl={wsUrl}
|
||||
initMessage={{
|
||||
@@ -212,6 +227,15 @@ export function ScriptTerminalModal({
|
||||
onWebSocketCreated={handleWebSocketCreated}
|
||||
isScriptModal={true}
|
||||
/>
|
||||
|
||||
{isWaitingNextInteraction && !currentInteraction && (
|
||||
<div className="absolute inset-0 flex items-center justify-center bg-black/50 backdrop-blur-sm">
|
||||
<div className="flex flex-col items-center gap-3">
|
||||
<Loader2 className="h-8 w-8 animate-spin text-blue-500" />
|
||||
<p className="text-sm text-muted-foreground">Processing...</p>
|
||||
</div>
|
||||
</div>
|
||||
)}
|
||||
</div>
|
||||
|
||||
{!isMobile && (
|
||||
|
||||
@@ -136,14 +136,14 @@ const proxmoxCommands = [
|
||||
{ cmd: "clear", desc: "Clear terminal screen" },
|
||||
]
|
||||
|
||||
export const TerminalPanel: React.FC<TerminalPanelProps> = ({
|
||||
export function TerminalPanel({
|
||||
websocketUrl,
|
||||
onClose,
|
||||
initMessage,
|
||||
onWebInteraction,
|
||||
onWebSocketCreated,
|
||||
isScriptModal = false,
|
||||
}) => {
|
||||
}: TerminalPanelProps) {
|
||||
const [terminals, setTerminals] = useState<TerminalInstance[]>([])
|
||||
const [activeTerminalId, setActiveTerminalId] = useState<string>("")
|
||||
const [layout, setLayout] = useState<"single" | "grid">("grid")
|
||||
@@ -704,7 +704,13 @@ export const TerminalPanel: React.FC<TerminalPanelProps> = ({
|
||||
containerRefs.current["main"] = el
|
||||
}}
|
||||
className={`overflow-hidden flex flex-col ${isMobile ? "flex-1 h-[60vh]" : "overflow-hidden"} w-full max-w-full`}
|
||||
style={!isMobile || isTablet ? { height: `${terminalHeight}px`, flexShrink: 0 } : undefined}
|
||||
style={
|
||||
isScriptModal
|
||||
? { height: "100%", flexShrink: 0 }
|
||||
: !isMobile || isTablet
|
||||
? { height: `${terminalHeight}px`, flexShrink: 0 }
|
||||
: undefined
|
||||
}
|
||||
>
|
||||
{isMobile ? (
|
||||
<Tabs value={activeTerminalId} onValueChange={setActiveTerminalId} className="h-full flex flex-col">
|
||||
@@ -754,7 +760,7 @@ export const TerminalPanel: React.FC<TerminalPanelProps> = ({
|
||||
onClick={() => setActiveTerminalId(terminal.id)}
|
||||
className={`text-xs font-medium ${
|
||||
activeTerminalId === terminal.id ? "text-blue-400" : "text-zinc-500"
|
||||
}`}
|
||||
} ${isScriptModal ? "hidden" : ""}`}
|
||||
>
|
||||
{terminal.title}
|
||||
</button>
|
||||
|
||||
Reference in New Issue
Block a user