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.
This commit is contained in:
Andras Bacsai
2026-06-01 10:21:30 +02:00
parent a8db2864f3
commit 24fc8db8db
2 changed files with 15 additions and 3 deletions
+2
View File
@@ -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();
@@ -28,8 +28,8 @@ it('keeps realtime terminal server logging behind the explicit debug flag', func
$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 @@ it('keeps Livewire alive in background tabs while a terminal is connected', func
->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 @@ it('uses simple fullscreen bottom margin based on mobile toolbar visibility', fu
->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'");
});