From bd22c0e4703bf0b570f3a728ef4222d82bb25e60 Mon Sep 17 00:00:00 2001 From: Andras Bacsai <5845193+andrasbacsai@users.noreply.github.com> Date: Sun, 28 Dec 2025 13:53:26 +0100 Subject: [PATCH] fix: back navigation in global search resource selection MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Add smart goBack() method that skips auto-selected steps and returns to the last step where user had a real choice. This prevents navigation loops when previous steps only have a single option and auto-select. Fixes #7739 🤖 Generated with [Claude Code](https://claude.com/claude-code) Co-Authored-By: Claude Haiku 4.5 --- app/Livewire/GlobalSearch.php | 36 +++++++++++++++++++ .../views/livewire/global-search.blade.php | 8 ++--- 2 files changed, 40 insertions(+), 4 deletions(-) diff --git a/app/Livewire/GlobalSearch.php b/app/Livewire/GlobalSearch.php index 5d3348692..e4108668b 100644 --- a/app/Livewire/GlobalSearch.php +++ b/app/Livewire/GlobalSearch.php @@ -1336,6 +1336,42 @@ public function cancelResourceSelection() $this->autoOpenResource = null; } + public function goBack() + { + // From Environment Selection → go back to Project (if multiple) or further + if ($this->selectedProjectUuid !== null) { + $this->selectedProjectUuid = null; + $this->selectedEnvironmentUuid = null; + if (count($this->availableProjects) > 1) { + return; // Stop here - user can choose a project + } + } + + // From Project Selection → go back to Destination (if multiple) or further + if ($this->selectedDestinationUuid !== null) { + $this->selectedDestinationUuid = null; + $this->selectedProjectUuid = null; + $this->selectedEnvironmentUuid = null; + if (count($this->availableDestinations) > 1) { + return; // Stop here - user can choose a destination + } + } + + // From Destination Selection → go back to Server (if multiple) or cancel + if ($this->selectedServerId !== null) { + $this->selectedServerId = null; + $this->selectedDestinationUuid = null; + $this->selectedProjectUuid = null; + $this->selectedEnvironmentUuid = null; + if (count($this->availableServers) > 1) { + return; // Stop here - user can choose a server + } + } + + // All previous steps were auto-selected, cancel entirely + $this->cancelResourceSelection(); + } + public function getFilteredCreatableItemsProperty() { $query = strtolower(trim($this->searchQuery)); diff --git a/resources/views/livewire/global-search.blade.php b/resources/views/livewire/global-search.blade.php index 8c073ecab..27b8d2821 100644 --- a/resources/views/livewire/global-search.blade.php +++ b/resources/views/livewire/global-search.blade.php @@ -323,7 +323,7 @@ class="mt-2 bg-white dark:bg-coolgray-100 rounded-lg shadow-xl ring-1 ring-neutr