diff --git a/app/Livewire/GlobalSearch.php b/app/Livewire/GlobalSearch.php index 680ac7701..e1dd678ff 100644 --- a/app/Livewire/GlobalSearch.php +++ b/app/Livewire/GlobalSearch.php @@ -1147,6 +1147,9 @@ class GlobalSearch extends Component $this->selectedResourceType = $type; $this->isSelectingResource = true; + // Clear search query to show selection UI instead of creatable items + $this->searchQuery = ''; + // Reset selections $this->selectedServerId = null; $this->selectedDestinationUuid = null; @@ -1316,10 +1319,10 @@ class GlobalSearch extends Component $queryParams['database_image'] = 'postgres:16-alpine'; } - return redirect()->route('project.resource.create', [ + $this->redirect(route('project.resource.create', [ 'project_uuid' => $this->selectedProjectUuid, 'environment_uuid' => $this->selectedEnvironmentUuid, - ] + $queryParams); + ] + $queryParams)); } } diff --git a/resources/views/livewire/global-search.blade.php b/resources/views/livewire/global-search.blade.php index 06da31354..f8fa8ec7d 100644 --- a/resources/views/livewire/global-search.blade.php +++ b/resources/views/livewire/global-search.blade.php @@ -136,13 +136,17 @@ 'new postgresql', 'new postgres', 'new mysql', 'new mariadb', 'new redis', 'new keydb', 'new dragonfly', 'new mongodb', 'new mongo', 'new clickhouse' ]; - if (exactMatchCommands.includes(trimmed)) { const matchingItem = this.creatableItems.find(item => { const itemSearchText = `new ${item.name}`.toLowerCase(); const itemType = `new ${item.type}`.toLowerCase(); - return itemSearchText === trimmed || itemType === trimmed || - (item.type && trimmed.includes(item.type.replace(/-/g, ' '))); + const itemTypeWithSpaces = item.type ? `new ${item.type.replace(/-/g, ' ')}` : ''; + + // Check if trimmed matches exactly or if the item's quickcommand includes this command + return itemSearchText === trimmed || + itemType === trimmed || + itemTypeWithSpaces === trimmed || + (item.quickcommand && item.quickcommand.toLowerCase().includes(trimmed)); }); if (matchingItem) { @@ -250,8 +254,7 @@ class="fixed top-0 left-0 z-99 flex items-start justify-center w-screen h-screen pt-[10vh]">