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