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