From 24fc8db8dbfe77c436b848944c8b34305aaf121e Mon Sep 17 00:00:00 2001 From: Andras Bacsai <5845193+andrasbacsai@users.noreply.github.com> Date: Mon, 1 Jun 2026 10:21:30 +0200 Subject: [PATCH] fix(terminal): exit fullscreen when PTY exits Reset fullscreen and mobile toolbar state on PTY exit so the terminal UI returns to its normal layout. Update packaging coverage for the PTY exit behavior and mobile fullscreen height. --- resources/js/terminal.js | 2 ++ tests/Feature/RealtimeTerminalPackagingTest.php | 16 +++++++++++++--- 2 files changed, 15 insertions(+), 3 deletions(-) diff --git a/resources/js/terminal.js b/resources/js/terminal.js index eedc1faa9..9dc571e26 100644 --- a/resources/js/terminal.js +++ b/resources/js/terminal.js @@ -527,6 +527,8 @@ export function initializeTerminalComponent() { // Notify parent component that terminal connection failed this.$wire.dispatch('terminalDisconnected'); } else if (event.data === 'pty-exited') { + this.fullscreen = false; + this.mobileToolbarCollapsed = false; this.terminalActive = false; this.resetTerminalSessionCountdown(); this.term.reset(); diff --git a/tests/Feature/RealtimeTerminalPackagingTest.php b/tests/Feature/RealtimeTerminalPackagingTest.php index eed95e342..48072065d 100644 --- a/tests/Feature/RealtimeTerminalPackagingTest.php +++ b/tests/Feature/RealtimeTerminalPackagingTest.php @@ -28,8 +28,8 @@ $terminalServer = file_get_contents(base_path('docker/coolify-realtime/terminal-server.js')); expect($terminalServer) - ->toContain("const terminalDebugEnabled = ['1', 'true', 'yes'].includes(") - ->toContain('process.env.TERMINAL_DEBUG') + ->toContain('const debugOverride = String(process.env.TERMINAL_DEBUG') + ->toContain("['1', 'true', 'yes', 'on'].includes(debugOverride)") ->toContain('if (!terminalDebugEnabled) {') ->not->toContain("console.log('Coolify realtime terminal server listening on port 6002. Let the hacking begin!');"); }); @@ -90,6 +90,16 @@ ->toContain('wire:poll.keep-alive.30s="keepTerminalPageAlive"'); }); +it('exits fullscreen when the terminal process exits', function () { + $terminalClient = file_get_contents(resource_path('js/terminal.js')); + + expect($terminalClient) + ->toContain("event.data === 'pty-exited'") + ->toContain('this.fullscreen = false; + this.mobileToolbarCollapsed = false; + this.terminalActive = false;'); +}); + it('replays the last command on reconnect so the PTY respawns automatically', function () { $terminalClient = file_get_contents(base_path('resources/js/terminal.js')); @@ -178,7 +188,7 @@ ->not->toContain('terminalFullscreenHeight') ->not->toContain('window.visualViewport?.height') ->and($terminalView) - ->toContain("mobileToolbarCollapsed ? 'h-[calc(100dvh-3.5rem)] mb-14 px-2 py-1 bg-black' : 'h-[calc(100dvh-11rem)] mb-[11rem] px-2 py-1 bg-black'") + ->toContain("mobileToolbarCollapsed ? 'h-[calc(100dvh-3.5rem)] mb-14 px-2 py-1 bg-black' : 'h-[calc(100dvh-6rem)] mb-[6rem] px-2 py-1 bg-black'") ->toContain("fullscreen ? 'absolute inset-x-0 bottom-0 z-[9999] px-2 pb-2'"); });