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.

make global search frontend heavy

Andras Bacsai2e6e07bcc310
diff --git a/app/Livewire/GlobalSearch.php b/app/Livewire/GlobalSearch.php
index 98571b87f4..e378bd2893 100644
--- a/app/Livewire/GlobalSearch.php
+++ b/app/Livewire/GlobalSearch.php
@@ -81,6 +81,7 @@ class GlobalSearch extends Component
{
$this->isModalOpen = true;
$this->loadSearchableItems();
+ $this->loadCreatableItems();
$this->dispatch('search-modal-opened');
}
@@ -973,6 +974,9 @@ class GlobalSearch extends Component
]);
}
+ // Merge with services
+ $items = $items->merge(collect($this->services));
+
$this->creatableItems = $items->toArray();
}
diff --git a/resources/views/livewire/global-search.blade.php b/resources/views/livewire/global-search.blade.php
index ad9a9f6ad1..95d2640a6f 100644
--- a/resources/views/livewire/global-search.blade.php
+++ b/resources/views/livewire/global-search.blade.php
@@ -3,18 +3,74 @@
selectedIndex: -1,
isSearching: false,
isLoadingInitialData: false,
+ allSearchableItems: [],
+ searchQuery: '',
+ creatableItems: [],
+ isCreateMode: false,
+
+ // Client-side search function
+ get searchResults() {
+ if (!this.searchQuery || this.searchQuery.length < 1) {
+ return [];
+ }
+
+ const query = this.searchQuery.toLowerCase().trim();
+
+ const results = this.allSearchableItems.filter(item => {
+ if (!item.search_text) return false;
+ return item.search_text.toLowerCase().includes(query);
+ }).slice(0, 20);
+
+ return results;
+ },
+
+ get filteredCreatableItems() {
+ if (!this.searchQuery || this.searchQuery.length < 1) {
+ return [];
+ }
+ const query = this.searchQuery.toLowerCase().trim();
+
+ if (query === 'new') {
+ return this.creatableItems;
+ }
+
+ return this.creatableItems.filter(item => {
+ const searchText = `${item.name} ${item.description} ${item.type} ${item.category}`.toLowerCase();
+ return searchText.includes(query);
+ });
+ },
+
+ get groupedCreatableItems() {
+ const grouped = {};
+ this.filteredCreatableItems.forEach(item => {
+ const category = item.category || 'Other';
+ if (!grouped[category]) {
+ grouped[category] = [];
+ }
+ grouped[category].push(item);
+ });
+ return grouped;
+ },
+
openModal() {
this.modalOpen = true;
this.selectedIndex = -1;
this.isLoadingInitialData = true;
- // Dispatch event to load initial data
- $wire.dispatch('loadInitialData');
+ this.searchQuery = '';
+ $wire.openSearchModal().then(() => {
+ this.allSearchableItems = $wire.allSearchableItems || [];
+ this.creatableItems = $wire.creatableItems || [];
+ this.isLoadingInitialData = false;
+ setTimeout(() => this.$refs.searchInput?.focus(), 50);
+ });
},
closeModal() {
this.modalOpen = false;
this.selectedIndex = -1;
this.isSearching = false;
this.isLoadingInitialData = false;
+ this.searchQuery = '';
+ this.allSearchableItems = [];
// Ensure scroll is restored
document.body.style.overflow = '';
@this.closeSearchModal();
@@ -42,43 +98,39 @@
this.selectedIndex = -1;
});
- // Listen for loading state changes
- $wire.on('loadInitialData', () => {
- this.isLoadingInitialData = true;
- $wire.openSearchModal().finally(() => {
- this.isLoadingInitialData = false;
- // Focus input after data is loaded
- setTimeout(() => this.$refs.searchInput?.focus(), 50);
- });
- });
-
- // Use Livewire lifecycle hooks for accurate loading state
- const componentId = $wire.__instance.id;
-
- Livewire.hook('message.sent', (message, component) => {
- // Only handle messages for this component instance
- if (component.id !== componentId) return;
+ this.$watch('searchQuery', (value) => {
+ this.selectedIndex = -1;
+ const trimmed = value.trim().toLowerCase();
- // Check if this is a searchQuery update
- if (message.updateQueue && message.updateQueue.some(update => update.payload.name === 'searchQuery')) {
- this.isSearching = true;
+ if (trimmed === '') {
+ if ($wire.isSelectingResource) {
+ $wire.cancelResourceSelection();
+ }
+ return;
}
- });
- Livewire.hook('message.processed', (message, component) => {
- // Only handle messages for this component instance
- if (component.id !== componentId) return;
+ const exactMatchCommands = [
+ 'new project', 'new server', 'new team', 'new storage', 'new s3',
+ 'new private key', 'new privatekey', 'new key',
+ 'new github app', 'new github', 'new source',
+ 'new public', 'new public git', 'new public repo', 'new public repository',
+ 'new private github', 'new private gh', 'new private deploy', 'new deploy key',
+ 'new dockerfile', 'new docker compose', 'new compose', 'new docker image', 'new image',
+ 'new postgresql', 'new postgres', 'new mysql', 'new mariadb',
+ 'new redis', 'new keydb', 'new dragonfly', 'new mongodb', 'new mongo', 'new clickhouse'
+ ];
- // Check if this was a searchQuery update
- if (message.updateQueue && message.updateQueue.some(update => update.payload.name === 'searchQuery')) {
- this.isSearching = false;
- }
- });
+ 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, ' ')));
+ });
- // Also clear loading state when search is emptied
- this.$watch('$wire.searchQuery', (value) => {
- if (!value || value.length === 0) {
- this.isSearching = false;
+ if (matchingItem) {
+ $wire.navigateToResource(matchingItem.type);
+ }
}
});
@@ -111,7 +163,7 @@
const escapeKeyHandler = (e) => {
if (e.key === 'Escape' && this.modalOpen) {
// If search query is empty, close the modal
- if (!$wire.searchQuery || $wire.searchQuery === '') {
+ if (!this.searchQuery || this.searchQuery === '') {
// Check if we're in a selection state using Alpine-accessible Livewire state
if ($wire.isSelectingResource) {
$wire.cancelResourceSelection();
@@ -122,7 +174,7 @@
}
} else {
// If search query has text, just clear it
- $wire.searchQuery = '';
+ this.searchQuery = '';
setTimeout(() => this.$refs.searchInput?.focus(), 100);
}
}
@@ -191,13 +243,21 @@
<!-- Search input (always visible) -->
<div class="relative">
<div class="absolute inset-y-0 left-4 flex items-center pointer-events-none">
- <svg class="w-5 h-5 text-neutral-400" xmlns="http://www.w3.org/2000/svg" fill="none"
+ <svg x-show="!isLoadingInitialData" class="w-5 h-5 text-neutral-400" xmlns="http://www.w3.org/2000/svg" fill="none"
viewBox="0 0 24 24" stroke="currentColor">
<path stroke-linecap="round" stroke-linejoin="round" stroke-width="2"
d="M21 21l-6-6m2-5a7 7 0 11-14 0 7 7 0 0114 0z" />
</svg>
+ <svg x-show="isLoadingInitialData" x-cloak class="animate-spin h-5 w-5 text-warning"
+ xmlns="http://www.w3.org/2000/svg" fill="none" viewBox="0 0 24 24">
+ <circle class="opacity-25" cx="12" cy="12" r="10" stroke="currentColor"
+ stroke-width="4"></circle>
+ <path class="opacity-75" fill="currentColor"
+ d="M4 12a8 8 0 018-8V0C5.373 0 0 5.373 0 12h4zm2 5.291A7.962 7.962 0 014 12H0c0 3.042 1.135 5.824 3 7.938l3-2.647z">
+ </path>
+ </svg>
</div>
- <input type="text" wire:model.live.debounce.200ms="searchQuery"
+ <input type="text" x-model="searchQuery"
placeholder="Search resources (type new for create things)..." x-ref="searchInput"
x-init="$watch('modalOpen', value => { if (value) setTimeout(() => $refs.searchInput.focus(), 100) })" :disabled="isLoadingInitialData"
class="w-full pl-12 pr-32 py-4 text-base bg-white dark:bg-coolgray-100 border-none rounded-lg shadow-xl ring-1 ring-neutral-200 dark:ring-coolgray-300 focus:ring-2 focus:ring-neutral-400 dark:focus:ring-coolgray-300 dark:text-white placeholder-neutral-400 dark:placeholder-neutral-500 disabled:opacity-50 disabled:cursor-not-allowed" />
@@ -212,547 +272,347 @@
</div>
</div>
- <!-- Initial Loading State when opening modal -->
- <div x-show="isLoadingInitialData && !$wire.searchQuery" x-cloak
- class="mt-2 bg-white dark:bg-coolgray-100 rounded-lg shadow-xl ring-1 ring-neutral-200 dark:ring-coolgray-300 overflow-hidden">
- <div class="flex items-center justify-center min-h-[200px] p-8">
- <div class="text-center">
- <svg class="animate-spin mx-auto h-8 w-8 text-neutral-400 mb-3"
- xmlns="http://www.w3.org/2000/svg" fill="none" viewBox="0 0 24 24">
- <circle class="opacity-25" cx="12" cy="12" r="10" stroke="currentColor"
- stroke-width="4"></circle>
- <path class="opacity-75" fill="currentColor"
- d="M4 12a8 8 0 018-8V0C5.373 0 0 5.373 0 12h4zm2 5.291A7.962 7.962 0 014 12H0c0 3.042 1.135 5.824 3 7.938l3-2.647z">
- </path>
- </svg>
- <p class="text-xs text-neutral-500 dark:text-neutral-500 mt-1">
- Please wait while we fetch your data
- </p>
- </div>
+ <!-- Debug: Show data loaded (temporary) -->
+ {{-- <div x-show="!isLoadingInitialData && searchQuery === '' && allSearchableItems.length > 0" x-cloak
+ class="mt-2 bg-white dark:bg-coolgray-100 rounded-lg shadow-xl ring-1 ring-neutral-200 dark:ring-coolgray-300 overflow-hidden p-6">
+ <div class="text-center">
+ <p class="text-sm font-semibold text-green-600 dark:text-green-400">
+ ✓ Data loaded successfully!
+ </p>
+ <p class="text-xs text-neutral-500 dark:text-neutral-400 mt-2">
+ <span x-text="allSearchableItems.length"></span> searchable items available
+ </p>
+ <p class="text-xs text-neutral-400 dark:text-neutral-500 mt-1">
+ Start typing to search...
+ </p>
</div>
- </div>
+ </div> --}}
<!-- Search results (with background) -->
- @if (strlen($searchQuery) >= 1)
- <div
- class="mt-2 bg-white dark:bg-coolgray-100 rounded-lg shadow-xl ring-1 ring-neutral-200 dark:ring-coolgray-300 overflow-hidden">
- <!-- Loading indicator with skeleton loaders -->
- <div x-show="isSearching" x-cloak class="min-h-[200px] flex flex-col p-4">
- <!-- Show skeleton loaders instead of just spinner -->
- <div class="animate-pulse">
- @for ($i = 0; $i < 3; $i++)
- <div
- class="px-4 py-3 {{ $i > 0 ? 'border-t border-neutral-100 dark:border-coolgray-200' : '' }}">
- <div class="flex items-center gap-3">
- <div class="w-10 h-10 bg-neutral-200 dark:bg-coolgray-300 rounded-lg"></div>
- <div class="flex-1">
- <div class="h-4 bg-neutral-200 dark:bg-coolgray-300 rounded w-32 mb-2">
- </div>
- <div class="h-3 bg-neutral-100 dark:bg-coolgray-400 rounded w-48"></div>
+ <div x-show="searchQuery.length >= 1" x-cloak
+ class="mt-2 bg-white dark:bg-coolgray-100 rounded-lg shadow-xl ring-1 ring-neutral-200 dark:ring-coolgray-300 overflow-hidden">
+ <!-- Results content -->
+ <div class="max-h-[60vh] overflow-y-auto scrollbar">
+ @if ($isSelectingResource)
+ <!-- Resource Selection Flow -->
+ <div class="p-6">
+ <!-- Server Selection -->
+ @if ($selectedServerId === null)
+ <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)"
+ 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">
+ <path stroke-linecap="round" stroke-linejoin="round"
+ stroke-width="2" d="M15 19l-7-7 7-7" />
+ </svg>
+ </button>
+ <div>
+ <h2 class="text-base font-semibold text-neutral-900 dark:text-white">
+ Select Server
+ </h2>
+ @if ($this->selectedResourceName)
+ <div class="text-xs text-neutral-500 dark:text-neutral-400">
+ for {{ $this->selectedResourceName }}
+ </div>
+ @endif
</div>
- <div class="w-4 h-4 bg-neutral-100 dark:bg-coolgray-400 rounded"></div>
</div>
- </div>
- @endfor
- </div>
- </div>
-
- <!-- Results content - show when not searching -->
- <div x-show="!isSearching" x-cloak class="max-h-[60vh] overflow-y-auto scrollbar">
- @if ($isSelectingResource)
- <!-- Resource Selection Flow -->
- <div class="p-6">
- <!-- Server Selection -->
- @if ($selectedServerId === null)
- <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)"
- 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">
- <path stroke-linecap="round" stroke-linejoin="round"
- stroke-width="2" d="M15 19l-7-7 7-7" />
- </svg>
- </button>
- <div>
- <h2
- class="text-base font-semibold text-neutral-900 dark:text-white">
- Select Server
- </h2>
- @if ($this->selectedResourceName)
- <div class="text-xs text-neutral-500 dark:text-neutral-400">
- for {{ $this->selectedResourceName }}
- </div>
- @endif
- </div>
+ @if ($loadingServers)
+ <div
+ class="flex items-center gap-3 p-3 bg-neutral-50 dark:bg-coolgray-200 rounded-lg">
+ <svg class="animate-spin h-5 w-5 text-yellow-500"
+ xmlns="http://www.w3.org/2000/svg" fill="none"
+ viewBox="0 0 24 24">
+ <circle class="opacity-25" cx="12" cy="12" r="10"
+ stroke="currentColor" stroke-width="4"></circle>
+ <path class="opacity-75" fill="currentColor"
+ d="M4 12a8 8 0 018-8V0C5.373 0 0 5.373 0 12h4zm2 5.291A7.962 7.962 0 014 12H0c0 3.042 1.135 5.824 3 7.938l3-2.647z">
+ </path>
+ </svg>
+ <span class="text-sm text-neutral-600 dark:text-neutral-400">Loading
+ servers...</span>
</div>
- @if ($loadingServers)
- <div
- class="flex items-center gap-3 p-3 bg-neutral-50 dark:bg-coolgray-200 rounded-lg">
- <svg class="animate-spin h-5 w-5 text-yellow-500"
- xmlns="http://www.w3.org/2000/svg" fill="none"
- viewBox="0 0 24 24">
- <circle class="opacity-25" cx="12" cy="12" r="10"
- stroke="currentColor" stroke-width="4"></circle>
- <path class="opacity-75" fill="currentColor"
- d="M4 12a8 8 0 018-8V0C5.373 0 0 5.373 0 12h4zm2 5.291A7.962 7.962 0 014 12H0c0 3.042 1.135 5.824 3 7.938l3-2.647z">
- </path>
- </svg>
- <span class="text-sm text-neutral-600 dark:text-neutral-400">Loading
- servers...</span>
- </div>
- @elseif (count($availableServers) > 0)
- @foreach ($availableServers as $index => $server)
- <button type="button"
- wire:click="selectServer({{ $server['id'] }}, true)"
- class="search-result-item w-full text-left block px-4 py-3 hover:bg-yellow-50 dark:hover:bg-yellow-900/20 transition-colors focus:outline-none focus:bg-yellow-100 dark:focus:bg-yellow-900/30">
- <div class="flex items-center justify-between gap-3">
- <div class="flex-1 min-w-0">
- <div
- class="font-medium text-neutral-900 dark:text-white">
- {{ $server['name'] }}
- </div>
- @if (!empty($server['description']))
- <div
- class="text-xs text-neutral-500 dark:text-neutral-400">
- {{ $server['description'] }}
- </div>
- @endif
- </div>
- <svg xmlns="http://www.w3.org/2000/svg"
- class="shrink-0 h-5 w-5 text-yellow-500 dark:text-yellow-400"
- fill="none" viewBox="0 0 24 24"
- stroke="currentColor">
- <path stroke-linecap="round" stroke-linejoin="round"
- stroke-width="2" d="M9 5l7 7-7 7" />
- </svg>
- </div>
- </button>
- @endforeach
- @else
- <div
- class="p-3 bg-red-50 dark:bg-red-900/20 rounded-lg border border-red-200 dark:border-red-800">
- <p class="text-sm text-red-800 dark:text-red-200">No servers
- available</p>
- </div>
- @endif
- </div>
- @endif
-
- <!-- Destination Selection -->
- @if ($selectedServerId !== null && $selectedDestinationUuid === null)
- <div class="mb-4" x-init="selectedIndex = -1">
- <div class="flex items-center gap-3 mb-3">
+ @elseif (count($availableServers) > 0)
+ @foreach ($availableServers as $index => $server)
<button type="button"
- @click="$wire.set('searchQuery', ''); setTimeout(() => $refs.searchInput.focus(), 100)"
- 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">
- <path stroke-linecap="round" stroke-linejoin="round"
- stroke-width="2" d="M15 19l-7-7 7-7" />
- </svg>
- </button>
- <div>
- <h2
- class="text-base font-semibold text-neutral-900 dark:text-white">
- Select Destination
- </h2>
- @if ($this->selectedResourceName)
- <div class="text-xs text-neutral-500 dark:text-neutral-400">
- for {{ $this->selectedResourceName }}
- </div>
- @endif
- </div>
- </div>
- @if ($loadingDestinations)
- <div
- class="flex items-center gap-3 p-3 bg-neutral-50 dark:bg-coolgray-200 rounded-lg">
- <svg class="animate-spin h-5 w-5 text-yellow-500"
- xmlns="http://www.w3.org/2000/svg" fill="none"
- viewBox="0 0 24 24">
- <circle class="opacity-25" cx="12" cy="12"
- r="10" stroke="currentColor" stroke-width="4"></circle>
- <path class="opacity-75" fill="currentColor"
- d="M4 12a8 8 0 018-8V0C5.373 0 0 5.373 0 12h4zm2 5.291A7.962 7.962 0 014 12H0c0 3.042 1.135 5.824 3 7.938l3-2.647z">
- </path>
- </svg>
- <span
- class="text-sm text-neutral-600 dark:text-neutral-400">Loading
- destinations...</span>
- </div>
- @elseif (count($availableDestinations) > 0)
- @foreach ($availableDestinations as $index => $destination)
- <button type="button"
- wire:click="selectDestination('{{ $destination['uuid'] }}', true)"
- class="search-result-item w-full text-left block px-4 py-3 hover:bg-yellow-50 dark:hover:bg-yellow-900/20 transition-colors focus:outline-none focus:bg-yellow-100 dark:focus:bg-yellow-900/30">
- <div class="flex items-center justify-between gap-3">
- <div class="flex-1 min-w-0">
- <div
- class="font-medium text-neutral-900 dark:text-white">
- {{ $destination['name'] }}
- </div>
+ wire:click="selectServer({{ $server['id'] }}, true)"
+ class="search-result-item w-full text-left block px-4 py-3 hover:bg-yellow-50 dark:hover:bg-yellow-900/20 transition-colors focus:outline-none focus:bg-yellow-100 dark:focus:bg-yellow-900/30">
+ <div class="flex items-center justify-between gap-3">
+ <div class="flex-1 min-w-0">
+ <div class="font-medium text-neutral-900 dark:text-white">
+ {{ $server['name'] }}
+ </div>
+ @if (!empty($server['description']))
<div
class="text-xs text-neutral-500 dark:text-neutral-400">
- Network: {{ $destination['network'] }}
+ {{ $server['description'] }}
</div>
- </div>
- <svg xmlns="http://www.w3.org/2000/svg"
- class="shrink-0 h-5 w-5 text-yellow-500 dark:text-yellow-400"
- fill="none" viewBox="0 0 24 24"
- stroke="currentColor">
- <path stroke-linecap="round" stroke-linejoin="round"
- stroke-width="2" d="M9 5l7 7-7 7" />
- </svg>
+ @endif
</div>
- </button>
- @endforeach
- @else
- <div
- class="p-3 bg-red-50 dark:bg-red-900/20 rounded-lg border border-red-200 dark:border-red-800">
- <p class="text-sm text-red-800 dark:text-red-200">No destinations
- available</p>
- </div>
- @endif
- </div>
- @endif
-
- <!-- Project Selection -->
- @if ($selectedDestinationUuid !== null && $selectedProjectUuid === null)
- <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)"
- 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">
- <path stroke-linecap="round" stroke-linejoin="round"
- stroke-width="2" d="M15 19l-7-7 7-7" />
- </svg>
+ <svg xmlns="http://www.w3.org/2000/svg"
+ class="shrink-0 h-5 w-5 text-yellow-500 dark:text-yellow-400"
+ fill="none" viewBox="0 0 24 24" stroke="currentColor">
+ <path stroke-linecap="round" stroke-linejoin="round"
+ stroke-width="2" d="M9 5l7 7-7 7" />
+ </svg>
+ </div>
</button>
- <div>
- <h2
- class="text-base font-semibold text-neutral-900 dark:text-white">
- Select Project
- </h2>
- @if ($this->selectedResourceName)
- <div class="text-xs text-neutral-500 dark:text-neutral-400">
- for {{ $this->selectedResourceName }}
- </div>
- @endif
- </div>
+ @endforeach
+ @else
+ <div
+ class="p-3 bg-red-50 dark:bg-red-900/20 rounded-lg border border-red-200 dark:border-red-800">
+ <p class="text-sm text-red-800 dark:text-red-200">No servers
+ available</p>
</div>
- @if ($loadingProjects)
- <div
- class="flex items-center gap-3 p-3 bg-neutral-50 dark:bg-coolgray-200 rounded-lg">
- <svg class="animate-spin h-5 w-5 text-yellow-500"
- xmlns="http://www.w3.org/2000/svg" fill="none"
- viewBox="0 0 24 24">
- <circle class="opacity-25" cx="12" cy="12"
- r="10" stroke="currentColor" stroke-width="4"></circle>
- <path class="opacity-75" fill="currentColor"
- d="M4 12a8 8 0 018-8V0C5.373 0 0 5.373 0 12h4zm2 5.291A7.962 7.962 0 014 12H0c0 3.042 1.135 5.824 3 7.938l3-2.647z">
- </path>
- </svg>
- <span
- class="text-sm text-neutral-600 dark:text-neutral-400">Loading
- projects...</span>
- </div>
- @elseif (count($availableProjects) > 0)
- @foreach ($availableProjects as $index => $project)
- <button type="button"
- wire:click="selectProject('{{ $project['uuid'] }}', true)"
- class="search-result-item w-full text-left block px-4 py-3 hover:bg-yellow-50 dark:hover:bg-yellow-900/20 transition-colors focus:outline-none focus:bg-yellow-100 dark:focus:bg-yellow-900/30">
- <div class="flex items-center justify-between gap-3">
- <div class="flex-1 min-w-0">
- <div
- class="font-medium text-neutral-900 dark:text-white">
- {{ $project['name'] }}
- </div>
- @if (!empty($project['description']))
- <div
- class="text-xs text-neutral-500 dark:text-neutral-400">
- {{ $project['description'] }}
- </div>
- @endif
- </div>
- <svg xmlns="http://www.w3.org/2000/svg"
- class="shrink-0 h-5 w-5 text-yellow-500 dark:text-yellow-400"
- fill="none" viewBox="0 0 24 24"
- stroke="currentColor">
- <path stroke-linecap="round" stroke-linejoin="round"
- stroke-width="2" d="M9 5l7 7-7 7" />
- </svg>
- </div>
- </button>
- @endforeach
- @else
- <div
- class="p-3 bg-red-50 dark:bg-red-900/20 rounded-lg border border-red-200 dark:border-red-800">
- <p class="text-sm text-red-800 dark:text-red-200">No projects
- available</p>
- </div>
- @endif
- </div>
- @endif
+ @endif
+ </div>
+ @endif
- <!-- Environment Selection -->
- @if ($selectedProjectUuid !== null && $selectedEnvironmentUuid === null)
- <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)"
- 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">
- <path stroke-linecap="round" stroke-linejoin="round"
- stroke-width="2" d="M15 19l-7-7 7-7" />
- </svg>
- </button>
- <div>
- <h2
- class="text-base font-semibold text-neutral-900 dark:text-white">
- Select Environment
- </h2>
- @if ($this->selectedResourceName)
- <div class="text-xs text-neutral-500 dark:text-neutral-400">
- for {{ $this->selectedResourceName }}
- </div>
- @endif
- </div>
+ <!-- Destination Selection -->
+ @if ($selectedServerId !== null && $selectedDestinationUuid === null)
+ <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)"
+ 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">
+ <path stroke-linecap="round" stroke-linejoin="round"
+ stroke-width="2" d="M15 19l-7-7 7-7" />
+ </svg>
+ </button>
+ <div>
+ <h2 class="text-base font-semibold text-neutral-900 dark:text-white">
+ Select Destination
+ </h2>
+ @if ($this->selectedResourceName)
+ <div class="text-xs text-neutral-500 dark:text-neutral-400">
+ for {{ $this->selectedResourceName }}
+ </div>
+ @endif
</div>
- @if ($loadingEnvironments)
- <div
- class="flex items-center gap-3 p-3 bg-neutral-50 dark:bg-coolgray-200 rounded-lg">
- <svg class="animate-spin h-5 w-5 text-yellow-500"
- xmlns="http://www.w3.org/2000/svg" fill="none"
- viewBox="0 0 24 24">
- <circle class="opacity-25" cx="12" cy="12"
- r="10" stroke="currentColor" stroke-width="4"></circle>
- <path class="opacity-75" fill="currentColor"
- d="M4 12a8 8 0 018-8V0C5.373 0 0 5.373 0 12h4zm2 5.291A7.962 7.962 0 014 12H0c0 3.042 1.135 5.824 3 7.938l3-2.647z">
- </path>
- </svg>
- <span
- class="text-sm text-neutral-600 dark:text-neutral-400">Loading
- environments...</span>
- </div>
- @elseif (count($availableEnvironments) > 0)
- @foreach ($availableEnvironments as $index => $environment)
- <button type="button"
- wire:click="selectEnvironment('{{ $environment['uuid'] }}', true)"
- class="search-result-item w-full text-left block px-4 py-3 hover:bg-yellow-50 dark:hover:bg-yellow-900/20 transition-colors focus:outline-none focus:bg-yellow-100 dark:focus:bg-yellow-900/30">
- <div class="flex items-center justify-between gap-3">
- <div class="flex-1 min-w-0">
- <div
- class="font-medium text-neutral-900 dark:text-white">
- {{ $environment['name'] }}
- </div>
- @if (!empty($environment['description']))
- <div
- class="text-xs text-neutral-500 dark:text-neutral-400">
- {{ $environment['description'] }}
- </div>
- @endif
- </div>
- <svg xmlns="http://www.w3.org/2000/svg"
- class="shrink-0 h-5 w-5 text-yellow-500 dark:text-yellow-400"
- fill="none" viewBox="0 0 24 24"
- stroke="currentColor">
- <path stroke-linecap="round" stroke-linejoin="round"
- stroke-width="2" d="M9 5l7 7-7 7" />
- </svg>
- </div>
- </button>
- @endforeach
- @else
- <div
- class="p-3 bg-red-50 dark:bg-red-900/20 rounded-lg border border-red-200 dark:border-red-800">
- <p class="text-sm text-red-800 dark:text-red-200">No environments
- available</p>
- </div>
- @endif
- </div>
- @endif
- </div>
- @elseif ($isCreateMode && count($this->filteredCreatableItems) > 0 && !$autoOpenResource)
- <!-- Create new resources section -->
- <div class="py-2">
- {{-- Show existing resources first if any match --}}
- @php
- $existingResources = collect($searchResults)->filter(fn($r) => !isset($r['is_creatable_suggestion']))->count();
- @endphp
- @if ($existingResources > 0)
- <!-- Existing Resources Section -->
- <div class="px-4 pt-3 pb-1">
- <h4
- class="text-xs font-semibold text-neutral-500 dark:text-neutral-400 uppercase tracking-wider">
- Existing Resources
- </h4>
</div>
- @foreach ($searchResults as $result)
- @if (!isset($result['is_creatable_suggestion']))
- <a href="{{ $result['link'] ?? '#' }}"
- class="search-result-item block px-4 py-3 hover:bg-neutral-50 dark:hover:bg-coolgray-200 transition-colors focus:outline-none focus:bg-yellow-50 dark:focus:bg-yellow-900/20 border-transparent hover:border-coollabs focus:border-yellow-500 dark:focus:border-yellow-400">
+ @if ($loadingDestinations)
+ <div
+ class="flex items-center gap-3 p-3 bg-neutral-50 dark:bg-coolgray-200 rounded-lg">
+ <svg class="animate-spin h-5 w-5 text-yellow-500"
+ xmlns="http://www.w3.org/2000/svg" fill="none"
+ viewBox="0 0 24 24">
+ <circle class="opacity-25" cx="12" cy="12" r="10"
+ stroke="currentColor" stroke-width="4"></circle>
+ <path class="opacity-75" fill="currentColor"
+ d="M4 12a8 8 0 018-8V0C5.373 0 0 5.373 0 12h4zm2 5.291A7.962 7.962 0 014 12H0c0 3.042 1.135 5.824 3 7.938l3-2.647z">
+ </path>
+ </svg>
+ <span class="text-sm text-neutral-600 dark:text-neutral-400">Loading
+ destinations...</span>
+ </div>
+ @elseif (count($availableDestinations) > 0)
+ @foreach ($availableDestinations as $index => $destination)
+ <button type="button"
+ wire:click="selectDestination('{{ $destination['uuid'] }}', true)"
+ class="search-result-item w-full text-left block px-4 py-3 hover:bg-yellow-50 dark:hover:bg-yellow-900/20 transition-colors focus:outline-none focus:bg-yellow-100 dark:focus:bg-yellow-900/30">
<div class="flex items-center justify-between gap-3">
<div class="flex-1 min-w-0">
- <div class="flex items-center gap-2 mb-1">
- <span
- class="font-medium text-neutral-900 dark:text-white truncate">
- {{ $result['name'] }}
- </span>
- <span
- class="px-2 py-0.5 text-xs rounded-full bg-neutral-100 dark:bg-coolgray-300 text-neutral-700 dark:text-neutral-300 shrink-0">
- @if ($result['type'] === 'application')
- Application
- @elseif ($result['type'] === 'service')
- Service
- @elseif ($result['type'] === 'database')
- {{ ucfirst($result['subtype'] ?? 'Database') }}
- @elseif ($result['type'] === 'server')
- Server
- @elseif ($result['type'] === 'project')
- Project
- @elseif ($result['type'] === 'environment')
- Environment
- @endif
- </span>
+ <div class="font-medium text-neutral-900 dark:text-white">
+ {{ $destination['name'] }}
+ </div>
+ <div
+ class="text-xs text-neutral-500 dark:text-neutral-400">
+ Network: {{ $destination['network'] }}
</div>
- @if (!empty($result['project']) && !empty($result['environment']))
- <div
- class="text-xs text-neutral-500 dark:text-neutral-400 mb-1">
- {{ $result['project'] }} /
- {{ $result['environment'] }}
- </div>
- @endif
- @if (!empty($result['description']))
- <div
- class="text-sm text-neutral-600 dark:text-neutral-400">
- {{ Str::limit($result['description'], 80) }}
- </div>
- @endif
</div>
<svg xmlns="http://www.w3.org/2000/svg"
- class="shrink-0 h-5 w-5 text-neutral-300 dark:text-neutral-600 self-center"
+ class="shrink-0 h-5 w-5 text-yellow-500 dark:text-yellow-400"
fill="none" viewBox="0 0 24 24" stroke="currentColor">
<path stroke-linecap="round" stroke-linejoin="round"
stroke-width="2" d="M9 5l7 7-7 7" />
</svg>
</div>
- </a>
- @endif
- @endforeach
- @endif
-
- @php
- $grouped = collect($this->filteredCreatableItems)->groupBy('category');
- @endphp
-
- @foreach ($grouped as $category => $items)
- <!-- Category Header -->
- <div class="px-4 pt-3 pb-1">
- <h4
- class="text-xs font-semibold text-neutral-500 dark:text-neutral-400 uppercase tracking-wider">
- {{ $category }}
- </h4>
- </div>
+ </button>
+ @endforeach
+ @else
+ <div
+ class="p-3 bg-red-50 dark:bg-red-900/20 rounded-lg border border-red-200 dark:border-red-800">
+ <p class="text-sm text-red-800 dark:text-red-200">No destinations
+ available</p>
+ </div>
+ @endif
+ </div>
+ @endif
- <!-- Category Items -->
- @foreach ($items as $item)
+ <!-- Project Selection -->
+ @if ($selectedDestinationUuid !== null && $selectedProjectUuid === null)
+ <div class="mb-4" x-init="selectedIndex = -1">
+ <div class="flex items-center gap-3 mb-3">
<button type="button"
- wire:click="navigateToResource('{{ $item['type'] }}')"
- class="search-result-item w-full text-left block px-4 py-3 hover:bg-yellow-50 dark:hover:bg-yellow-900/20 transition-colors focus:outline-none focus:bg-yellow-100 dark:focus:bg-yellow-900/30 border-transparent hover:border-yellow-500 focus:border-yellow-500">
- <div class="flex items-center justify-between gap-3">
- <div class="flex items-center gap-3 flex-1 min-w-0">
- <div
- class="flex-shrink-0 w-10 h-10 rounded-lg bg-yellow-100 dark:bg-yellow-900/40 flex items-center justify-center">
- <svg xmlns="http://www.w3.org/2000/svg"
- class="h-5 w-5 text-yellow-600 dark:text-yellow-400"
- fill="none" viewBox="0 0 24 24"
- stroke="currentColor">
- <path stroke-linecap="round" stroke-linejoin="round"
- stroke-width="2" d="M12 4v16m8-8H4" />
- </svg>
- </div>
+ @click="$wire.set('searchQuery', ''); setTimeout(() => $refs.searchInput.focus(), 100)"
+ 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">
+ <path stroke-linecap="round" stroke-linejoin="round"
+ stroke-width="2" d="M15 19l-7-7 7-7" />
+ </svg>
+ </button>
+ <div>
+ <h2 class="text-base font-semibold text-neutral-900 dark:text-white">
+ Select Project
+ </h2>
+ @if ($this->selectedResourceName)
+ <div class="text-xs text-neutral-500 dark:text-neutral-400">
+ for {{ $this->selectedResourceName }}
+ </div>
+ @endif
+ </div>
+ </div>
+ @if ($loadingProjects)
+ <div
+ class="flex items-center gap-3 p-3 bg-neutral-50 dark:bg-coolgray-200 rounded-lg">
+ <svg class="animate-spin h-5 w-5 text-yellow-500"
+ xmlns="http://www.w3.org/2000/svg" fill="none"
+ viewBox="0 0 24 24">
+ <circle class="opacity-25" cx="12" cy="12" r="10"
+ stroke="currentColor" stroke-width="4"></circle>
+ <path class="opacity-75" fill="currentColor"
+ d="M4 12a8 8 0 018-8V0C5.373 0 0 5.373 0 12h4zm2 5.291A7.962 7.962 0 014 12H0c0 3.042 1.135 5.824 3 7.938l3-2.647z">
+ </path>
+ </svg>
+ <span class="text-sm text-neutral-600 dark:text-neutral-400">Loading
+ projects...</span>
+ </div>
+ @elseif (count($availableProjects) > 0)
+ @foreach ($availableProjects as $index => $project)
+ <button type="button"
+ wire:click="selectProject('{{ $project['uuid'] }}', true)"
+ class="search-result-item w-full text-left block px-4 py-3 hover:bg-yellow-50 dark:hover:bg-yellow-900/20 transition-colors focus:outline-none focus:bg-yellow-100 dark:focus:bg-yellow-900/30">
+ <div class="flex items-center justify-between gap-3">
<div class="flex-1 min-w-0">
- <div class="flex items-center gap-2 mb-1">
+ <div class="font-medium text-neutral-900 dark:text-white">
+ {{ $project['name'] }}
+ </div>
+ @if (!empty($project['description']))
<div
- class="font-medium text-neutral-900 dark:text-white truncate">
- {{ $item['name'] }}
+ class="text-xs text-neutral-500 dark:text-neutral-400">
+ {{ $project['description'] }}
</div>
- @if (isset($item['quickcommand']))
- <span
- class="text-xs text-neutral-500 dark:text-neutral-400 shrink-0">{{ $item['quickcommand'] }}</span>
- @endif
- </div>
- <div
- class="text-sm text-neutral-600 dark:text-neutral-400 truncate">
- {{ $item['description'] }}
- </div>
+ @endif
</div>
+ <svg xmlns="http://www.w3.org/2000/svg"
+ class="shrink-0 h-5 w-5 text-yellow-500 dark:text-yellow-400"
+ fill="none" viewBox="0 0 24 24" stroke="currentColor">
+ <path stroke-linecap="round" stroke-linejoin="round"
+ stroke-width="2" d="M9 5l7 7-7 7" />
+ </svg>
</div>
- <svg xmlns="http://www.w3.org/2000/svg"
- class="shrink-0 h-5 w-5 text-yellow-500 dark:text-yellow-400 self-center"
- fill="none" viewBox="0 0 24 24" stroke="currentColor">
- <path stroke-linecap="round" stroke-linejoin="round"
- stroke-width="2" d="M9 5l7 7-7 7" />
- </svg>
- </div>
- </button>
- @endforeach
- @endforeach
- </div>
- @elseif (strlen($searchQuery) >= 1 && count($searchResults) > 0)
- <div class="py-2">
- @foreach ($searchResults as $index => $result)
- @if (isset($result['is_creatable_suggestion']) && $result['is_creatable_suggestion'])
- {{-- Creatable suggestion with yellow theme --}}
+ </button>
+ @endforeach
+ @else
+ <div
+ class="p-3 bg-red-50 dark:bg-red-900/20 rounded-lg border border-red-200 dark:border-red-800">
+ <p class="text-sm text-red-800 dark:text-red-200">No projects
+ available</p>
+ </div>
+ @endif
+ </div>
+ @endif
+
+ <!-- Environment Selection -->
+ @if ($selectedProjectUuid !== null && $selectedEnvironmentUuid === null)
+ <div class="mb-4" x-init="selectedIndex = -1">
+ <div class="flex items-center gap-3 mb-3">
<button type="button"
- wire:click="navigateToResource('{{ $result['type'] }}')"
- class="search-result-item w-full text-left block px-4 py-3 bg-yellow-50 dark:bg-yellow-900/10 hover:bg-yellow-100 dark:hover:bg-yellow-900/20 transition-colors focus:outline-none focus:bg-yellow-100 dark:focus:bg-yellow-900/30 border-l-4 border-yellow-500">
- <div class="flex items-center justify-between gap-3">
- <div class="flex items-center gap-3 flex-1 min-w-0">
- <div
- class="flex-shrink-0 w-10 h-10 rounded-lg bg-yellow-100 dark:bg-yellow-900/40 flex items-center justify-center">
- <svg xmlns="http://www.w3.org/2000/svg"
- class="h-5 w-5 text-yellow-600 dark:text-yellow-400"
- fill="none" viewBox="0 0 24 24"
- stroke="currentColor">
- <path stroke-linecap="round" stroke-linejoin="round"
- stroke-width="2" d="M12 4v16m8-8H4" />
- </svg>
- </div>
+ @click="$wire.set('searchQuery', ''); setTimeout(() => $refs.searchInput.focus(), 100)"
+ 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">
+ <path stroke-linecap="round" stroke-linejoin="round"
+ stroke-width="2" d="M15 19l-7-7 7-7" />
+ </svg>
+ </button>
+ <div>
+ <h2 class="text-base font-semibold text-neutral-900 dark:text-white">
+ Select Environment
+ </h2>
+ @if ($this->selectedResourceName)
+ <div class="text-xs text-neutral-500 dark:text-neutral-400">
+ for {{ $this->selectedResourceName }}
+ </div>
+ @endif
+ </div>
+ </div>
+ @if ($loadingEnvironments)
+ <div
+ class="flex items-center gap-3 p-3 bg-neutral-50 dark:bg-coolgray-200 rounded-lg">
+ <svg class="animate-spin h-5 w-5 text-yellow-500"
+ xmlns="http://www.w3.org/2000/svg" fill="none"
+ viewBox="0 0 24 24">
+ <circle class="opacity-25" cx="12" cy="12" r="10"
+ stroke="currentColor" stroke-width="4"></circle>
+ <path class="opacity-75" fill="currentColor"
+ d="M4 12a8 8 0 018-8V0C5.373 0 0 5.373 0 12h4zm2 5.291A7.962 7.962 0 014 12H0c0 3.042 1.135 5.824 3 7.938l3-2.647z">
+ </path>
+ </svg>
+ <span class="text-sm text-neutral-600 dark:text-neutral-400">Loading
+ environments...</span>
+ </div>
+ @elseif (count($availableEnvironments) > 0)
+ @foreach ($availableEnvironments as $index => $environment)
+ <button type="button"
+ wire:click="selectEnvironment('{{ $environment['uuid'] }}', true)"
+ class="search-result-item w-full text-left block px-4 py-3 hover:bg-yellow-50 dark:hover:bg-yellow-900/20 transition-colors focus:outline-none focus:bg-yellow-100 dark:focus:bg-yellow-900/30">
+ <div class="flex items-center justify-between gap-3">
<div class="flex-1 min-w-0">
- <div class="flex items-center gap-2 mb-1">
- <span
- class="font-medium text-neutral-900 dark:text-white truncate">
- {{ $result['name'] }}
- </span>
- <span
- class="px-2 py-0.5 text-xs rounded-full bg-yellow-100 dark:bg-yellow-900/40 text-yellow-700 dark:text-yellow-300 shrink-0">
- Create New
- </span>
- @if (isset($result['quickcommand']))
- <span
- class="text-xs text-neutral-500 dark:text-neutral-400 shrink-0">{{ $result['quickcommand'] }}</span>
- @endif
- </div>
- <div
- class="text-sm text-neutral-600 dark:text-neutral-400 truncate">
- {{ $result['description'] }}
+ <div class="font-medium text-neutral-900 dark:text-white">
+ {{ $environment['name'] }}
</div>
+ @if (!empty($environment['description']))
+ <div
+ class="text-xs text-neutral-500 dark:text-neutral-400">
+ {{ $environment['description'] }}
+ </div>
+ @endif
</div>
+ <svg xmlns="http://www.w3.org/2000/svg"
+ class="shrink-0 h-5 w-5 text-yellow-500 dark:text-yellow-400"
+ fill="none" viewBox="0 0 24 24" stroke="currentColor">
+ <path stroke-linecap="round" stroke-linejoin="round"
+ stroke-width="2" d="M9 5l7 7-7 7" />
+ </svg>
</div>
- <svg xmlns="http://www.w3.org/2000/svg"
- class="shrink-0 h-5 w-5 text-yellow-500 dark:text-yellow-400 self-center"
- fill="none" viewBox="0 0 24 24" stroke="currentColor">
- <path stroke-linecap="round" stroke-linejoin="round"
- stroke-width="2" d="M9 5l7 7-7 7" />
- </svg>
- </div>
- </button>
+ </button>
+ @endforeach
@else
- {{-- Regular search result --}}
+ <div
+ class="p-3 bg-red-50 dark:bg-red-900/20 rounded-lg border border-red-200 dark:border-red-800">
+ <p class="text-sm text-red-800 dark:text-red-200">No environments
+ available</p>
+ </div>
+ @endif
+ </div>
+ @endif
+ </div>
+ @elseif ($isCreateMode && count($this->filteredCreatableItems) > 0 && !$autoOpenResource)
+ <!-- Create new resources section -->
+ <div class="py-2">
+ {{-- Show existing resources first if any match --}}
+ @php
+ $existingResources = collect($searchResults)
+ ->filter(fn($r) => !isset($r['is_creatable_suggestion']))
+ ->count();
+ @endphp
+ @if ($existingResources > 0)
+ <!-- Existing Resources Section -->
+ <div class="px-4 pt-3 pb-1">
+ <h4
+ class="text-xs font-semibold text-neutral-500 dark:text-neutral-400 uppercase tracking-wider">
+ Existing Resources
+ </h4>
+ </div>
+ @foreach ($searchResults as $result)
+ @if (!isset($result['is_creatable_suggestion']))
<a href="{{ $result['link'] ?? '#' }}"
class="search-result-item block px-4 py-3 hover:bg-neutral-50 dark:hover:bg-coolgray-200 transition-colors focus:outline-none focus:bg-yellow-50 dark:focus:bg-yellow-900/20 border-transparent hover:border-coollabs focus:border-yellow-500 dark:focus:border-yellow-400">
<div class="flex items-center justify-between gap-3">
@@ -803,25 +663,195 @@
</a>
@endif
@endforeach
- </div>
- @elseif (strlen($searchQuery) >= 2 && count($searchResults) === 0 && !$autoOpenResource)
- <div class="flex items-center justify-center py-12 px-4">
- <div class="text-center">
- <p class="mt-4 text-sm font-medium text-neutral-900 dark:text-white">
- No results found
- </p>
- <p class="mt-1 text-sm text-neutral-500 dark:text-neutral-400">
- Try different keywords or check the spelling
- </p>
- <p class="mt-2 text-xs text-neutral-400 dark:text-neutral-500">
- 💡 Tip: Search for service names like "wordpress", "postgres", or "redis"
- </p>
+ @endif
+
+ @php
+ $grouped = collect($this->filteredCreatableItems)->groupBy('category');
+ @endphp
+
+ @foreach ($grouped as $category => $items)
+ <!-- Category Header -->
+ <div class="px-4 pt-3 pb-1">
+ <h4
+ class="text-xs font-semibold text-neutral-500 dark:text-neutral-400 uppercase tracking-wider">
+ {{ $category }}
+ </h4>
</div>
+
+ <!-- Category Items -->
+ @foreach ($items as $item)
+ <button type="button" wire:click="navigateToResource('{{ $item['type'] }}')"
+ class="search-result-item w-full text-left block px-4 py-3 hover:bg-yellow-50 dark:hover:bg-yellow-900/20 transition-colors focus:outline-none focus:bg-yellow-100 dark:focus:bg-yellow-900/30 border-transparent hover:border-yellow-500 focus:border-yellow-500">
+ <div class="flex items-center justify-between gap-3">
+ <div class="flex items-center gap-3 flex-1 min-w-0">
+ <div
+ class="flex-shrink-0 w-10 h-10 rounded-lg bg-yellow-100 dark:bg-yellow-900/40 flex items-center justify-center">
+ <svg xmlns="http://www.w3.org/2000/svg"
+ class="h-5 w-5 text-yellow-600 dark:text-yellow-400"
+ fill="none" viewBox="0 0 24 24" stroke="currentColor">
+ <path stroke-linecap="round" stroke-linejoin="round"
+ stroke-width="2" d="M12 4v16m8-8H4" />
+ </svg>
+ </div>
+ <div class="flex-1 min-w-0">
+ <div class="flex items-center gap-2 mb-1">
+ <div
+ class="font-medium text-neutral-900 dark:text-white truncate">
+ {{ $item['name'] }}
+ </div>
+ @if (isset($item['quickcommand']))
+ <span
+ class="text-xs text-neutral-500 dark:text-neutral-400 shrink-0">{{ $item['quickcommand'] }}</span>
+ @endif
+ </div>
+ <div
+ class="text-sm text-neutral-600 dark:text-neutral-400 truncate">
+ {{ $item['description'] }}
+ </div>
+ </div>
+ </div>
+ <svg xmlns="http://www.w3.org/2000/svg"
+ class="shrink-0 h-5 w-5 text-yellow-500 dark:text-yellow-400 self-center"
+ fill="none" viewBox="0 0 24 24" stroke="currentColor">
+ <path stroke-linecap="round" stroke-linejoin="round"
+ stroke-width="2" d="M9 5l7 7-7 7" />
+ </svg>
+ </div>
+ </button>
+ @endforeach
+ @endforeach
+ </div>
+ @endif
+
+ <template
+ x-if="searchQuery.length >= 1 && searchResults.length > 0 && !$wire.isSelectingResource">
+ <div class="py-2">
+ <template x-if="filteredCreatableItems.length > 0">
+ <div class="px-4 pt-3 pb-1">
+ <h4
+ class="text-xs font-semibold text-neutral-500 dark:text-neutral-400 uppercase tracking-wider">
+ Existing Resources
+ </h4>
+ </div>
+ </template>
+ <template x-for="(result, index) in searchResults" :key="index">
+ <a :href="result.link || '#'"
+ class="search-result-item block px-4 py-3 hover:bg-neutral-50 dark:hover:bg-coolgray-200 transition-colors focus:outline-none focus:bg-yellow-50 dark:focus:bg-yellow-900/20 border-transparent hover:border-coollabs focus:border-yellow-500 dark:focus:border-yellow-400">
+ <div class="flex items-center justify-between gap-3">
+ <div class="flex-1 min-w-0">
+ <div class="flex items-center gap-2 mb-1">
+ <span class="font-medium text-neutral-900 dark:text-white truncate"
+ x-text="result.name">
+ </span>
+ <span
+ class="px-2 py-0.5 text-xs rounded-full bg-neutral-100 dark:bg-coolgray-300 text-neutral-700 dark:text-neutral-300 shrink-0">
+ <span x-show="result.type === 'application'">Application</span>
+ <span x-show="result.type === 'service'">Service</span>
+ <span x-show="result.type === 'database'"
+ x-text="result.subtype ? result.subtype.charAt(0).toUpperCase() + result.subtype.slice(1) : 'Database'"></span>
+ <span x-show="result.type === 'server'">Server</span>
+ <span x-show="result.type === 'project'">Project</span>
+ <span x-show="result.type === 'environment'">Environment</span>
+ </span>
+ </div>
+ <template x-if="result.project && result.environment">
+ <div class="text-xs text-neutral-500 dark:text-neutral-400 mb-1">
+ <span x-text="result.project"></span> / <span
+ x-text="result.environment"></span>
+ </div>
+ </template>
+ <template x-if="result.description">
+ <div class="text-sm text-neutral-600 dark:text-neutral-400"
+ x-text="result.description.length > 80 ? result.description.substring(0, 80) + '...' : result.description">
+ </div>
+ </template>
+ </div>
+ <svg xmlns="http://www.w3.org/2000/svg"
+ class="shrink-0 h-5 w-5 text-neutral-300 dark:text-neutral-600 self-center"
+ fill="none" viewBox="0 0 24 24" stroke="currentColor">
+ <path stroke-linecap="round" stroke-linejoin="round" stroke-width="2"
+ d="M9 5l7 7-7 7" />
+ </svg>
+ </div>
+ </a>
+ </template>
+ </div>
+ </template>
+
+ <template x-if="filteredCreatableItems.length > 0 && !$wire.isSelectingResource">
+ <div class="py-2">
+ <template x-for="[categoryName, items] in Object.entries(groupedCreatableItems)"
+ :key="categoryName">
+ <div>
+ <div class="px-4 pt-3 pb-1">
+ <h4 class="text-xs font-semibold text-neutral-500 dark:text-neutral-400 uppercase tracking-wider"
+ x-text="categoryName">
+ </h4>
+ </div>
+
+ <template x-for="item in items" :key="item.type">
+ <button type="button" @click="$wire.navigateToResource(item.type)"
+ class="search-result-item w-full text-left block px-4 py-3 hover:bg-yellow-50 dark:hover:bg-yellow-900/20 transition-colors focus:outline-none focus:bg-yellow-100 dark:focus:bg-yellow-900/30 border-transparent hover:border-yellow-500 focus:border-yellow-500">
+ <div class="flex items-center justify-between gap-3">
+ <div class="flex items-center gap-3 flex-1 min-w-0">
+ <div
+ class="flex-shrink-0 w-10 h-10 rounded-lg bg-yellow-100 dark:bg-yellow-900/40 flex items-center justify-center">
+ <svg xmlns="http://www.w3.org/2000/svg"
+ class="h-5 w-5 text-yellow-600 dark:text-yellow-400"
+ fill="none" viewBox="0 0 24 24"
+ stroke="currentColor">
+ <path stroke-linecap="round" stroke-linejoin="round"
+ stroke-width="2" d="M12 4v16m8-8H4" />
+ </svg>
+ </div>
+ <div class="flex-1 min-w-0">
+ <div class="flex items-center gap-2 mb-1">
+ <div class="font-medium text-neutral-900 dark:text-white truncate"
+ x-text="item.name">
+ </div>
+ <span
+ class="text-xs text-neutral-500 dark:text-neutral-400 shrink-0"
+ x-text="item.quickcommand"
+ x-show="item.quickcommand">
+ </span>
+ </div>
+ <div class="text-sm text-neutral-600 dark:text-neutral-400 truncate"
+ x-text="item.description">
+ </div>
+ </div>
+ </div>
+ <svg xmlns="http://www.w3.org/2000/svg"
+ class="shrink-0 h-5 w-5 text-yellow-500 dark:text-yellow-400 self-center"
+ fill="none" viewBox="0 0 24 24" stroke="currentColor">
+ <path stroke-linecap="round" stroke-linejoin="round"
+ stroke-width="2" d="M9 5l7 7-7 7" />
+ </svg>
+ </div>
+ </button>
+ </template>
+ </div>
+ </template>
+ </div>
+ </template>
+
+ <template
+ x-if="searchQuery.length >= 2 && searchResults.length === 0 && filteredCreatableItems.length === 0 && !$wire.isSelectingResource && !$wire.autoOpenResource">
+ <div class="flex items-center justify-center py-12 px-4">
+ <div class="text-center">
+ <p class="mt-4 text-sm font-medium text-neutral-900 dark:text-white">
+ No results found
+ </p>
+ <p class="mt-1 text-sm text-neutral-500 dark:text-neutral-400">
+ Try different keywords or check the spelling
+ </p>
+ <p class="mt-2 text-xs text-neutral-400 dark:text-neutral-500">
+ 💡 Tip: Search for service names like "wordpress", "postgres", or "redis"
+ </p>
</div>
- @endif
- </div>
+ </div>
+ </template>
</div>
- @endif
+ </div>
</div>
</div>
</template>