Skip to content

An open-source, self-hostable PaaS alternative to Vercel, Heroku & Netlify that lets you easily deploy static sites, databases, full-stack applications and 360+ one-click services on your own servers.

fix: back navigation in global search resource selection

Andras Bacsaibd22c0e4703b
diff --git a/app/Livewire/GlobalSearch.php b/app/Livewire/GlobalSearch.php
index 5d33486927..e4108668b6 100644
--- a/app/Livewire/GlobalSearch.php
+++ b/app/Livewire/GlobalSearch.php
@@ -1336,6 +1336,42 @@ class GlobalSearch extends Component
$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 8c073ecab5..27b8d28212 100644
--- a/resources/views/livewire/global-search.blade.php
+++ b/resources/views/livewire/global-search.blade.php
@@ -323,7 +323,7 @@
<div class="mb-4" x-init="selectedIndex = -1">
<div class="flex items-center gap-3 mb-3">
<button type="button"
- @click="$wire.set('searchQuery', ''); setTimeout(() => $refs.searchInput.focus(), 100)"
+ @click="$wire.goBack()"
class="text-neutral-600 dark:text-neutral-400 hover:text-neutral-900 dark:hover:text-white">
<svg xmlns="http://www.w3.org/2000/svg" class="h-6 w-6" fill="none"
viewBox="0 0 24 24" stroke="currentColor">
@@ -398,7 +398,7 @@
<div class="mb-4" x-init="selectedIndex = -1">
<div class="flex items-center gap-3 mb-3">
<button type="button"
- @click="$wire.set('searchQuery', ''); setTimeout(() => $refs.searchInput.focus(), 100)"
+ @click="$wire.goBack()"
class="text-neutral-600 dark:text-neutral-400 hover:text-neutral-900 dark:hover:text-white">
<svg xmlns="http://www.w3.org/2000/svg" class="h-6 w-6" fill="none"
viewBox="0 0 24 24" stroke="currentColor">
@@ -467,7 +467,7 @@
<div class="mb-4" x-init="selectedIndex = -1">
<div class="flex items-center gap-3 mb-3">
<button type="button"
- @click="$wire.set('searchQuery', ''); setTimeout(() => $refs.searchInput.focus(), 100)"
+ @click="$wire.goBack()"
class="text-neutral-600 dark:text-neutral-400 hover:text-neutral-900 dark:hover:text-white">
<svg xmlns="http://www.w3.org/2000/svg" class="h-6 w-6" fill="none"
viewBox="0 0 24 24" stroke="currentColor">
@@ -542,7 +542,7 @@
<div class="mb-4" x-init="selectedIndex = -1">
<div class="flex items-center gap-3 mb-3">
<button type="button"
- @click="$wire.set('searchQuery', ''); setTimeout(() => $refs.searchInput.focus(), 100)"
+ @click="$wire.goBack()"
class="text-neutral-600 dark:text-neutral-400 hover:text-neutral-900 dark:hover:text-white">
<svg xmlns="http://www.w3.org/2000/svg" class="h-6 w-6" fill="none"
viewBox="0 0 24 24" stroke="currentColor">