From d25edb85515d5927abe38e2963985226a7ea9dcf Mon Sep 17 00:00:00 2001 From: peaklabs-dev <122374094+peaklabs-dev@users.noreply.github.com> Date: Tue, 8 Sep 2026 19:43:05 +0200 Subject: [PATCH] fix(terminal): distinguish application containers across servers --- .../Project/Shared/ExecuteContainerCommand.php | 11 ++++++++--- .../shared/execute-container-command.blade.php | 2 +- 2 files changed, 9 insertions(+), 4 deletions(-) diff --git a/app/Livewire/Project/Shared/ExecuteContainerCommand.php b/app/Livewire/Project/Shared/ExecuteContainerCommand.php index aa2607102..e8202b854 100644 --- a/app/Livewire/Project/Shared/ExecuteContainerCommand.php +++ b/app/Livewire/Project/Shared/ExecuteContainerCommand.php @@ -151,13 +151,18 @@ public function loadContainers(): void }); if ($this->containers->count() === 1) { - $this->selected_container = data_get($this->containers->first(), 'container.Names'); + $this->selected_container = $this->containerTarget($this->containers->first()); $this->connectToContainer(); } $this->containersLoaded = true; } + private function containerTarget(array $container): string + { + return data_get($container, 'server.uuid').':'.data_get($container, 'container.Names'); + } + public function updatedSelectedContainer() { if ($this->selected_container !== 'default') { @@ -202,12 +207,12 @@ public function connectToContainer() try { $this->authorize('canAccessTerminal'); // Validate container name format - if (! ValidationPatterns::isValidContainerName($this->selected_container)) { + if (! ValidationPatterns::isValidContainerName(str($this->selected_container)->after(':')->value())) { throw new \InvalidArgumentException('Invalid container name format'); } // Verify container exists in our allowed list - $container = collect($this->containers)->firstWhere('container.Names', $this->selected_container); + $container = $this->containers->first(fn ($candidate) => $this->containerTarget($candidate) === $this->selected_container); if (is_null($container)) { throw new \RuntimeException('Container not found.'); } diff --git a/resources/views/livewire/project/shared/execute-container-command.blade.php b/resources/views/livewire/project/shared/execute-container-command.blade.php index dabd523f9..ef179a4ec 100644 --- a/resources/views/livewire/project/shared/execute-container-command.blade.php +++ b/resources/views/livewire/project/shared/execute-container-command.blade.php @@ -34,7 +34,7 @@ $consoleThemeNames = collect($consoleThemes)->pluck('name', 'key'); $consoleThemeAccents = collect($consoleThemes)->pluck('accent', 'key'); $containerOptions = $containers->map(fn ($container) => [ - 'value' => data_get($container, 'container.Names'), + 'value' => data_get($container, 'server.uuid').':'.data_get($container, 'container.Names'), 'label' => data_get($container, 'container.Names').' ยท '.data_get($container, 'server.name'), ])->values(); @endphp