diff --git a/app/Livewire/Project/New/Select.php b/app/Livewire/Project/New/Select.php index cff886f98..34601f5dd 100644 --- a/app/Livewire/Project/New/Select.php +++ b/app/Livewire/Project/New/Select.php @@ -112,14 +112,17 @@ public function loadServices() $default_logo = 'images/default.webp'; $logo = data_get($service, 'logo', $default_logo); $local_logo_path = public_path($logo); + $serviceKey = (string) $key; return [ - 'name' => str($key)->headline(), + 'id' => $serviceKey, + 'name' => str($serviceKey)->headline(), + 'docsSlug' => str($serviceKey)->lower()->value(), 'logo' => asset($logo), 'logo_github_url' => file_exists($local_logo_path) ? 'https://raw.githubusercontent.com/coollabsio/coolify/refs/heads/main/public/'.$logo : asset($default_logo), - 'templateLastUpdated' => $templateLastUpdatedMap[(string) $key] ?? null, + 'templateLastUpdated' => $templateLastUpdatedMap[$serviceKey] ?? null, ] + (array) $service; })->all(); @@ -336,7 +339,10 @@ private function formatLastModified(string $path): ?string public function setType(string $type) { - $type = str($type)->lower()->slug()->value(); + if (! str($type)->startsWith('one-click-service-')) { + $type = str($type)->lower()->slug()->value(); + } + if ($this->loading) { return; } diff --git a/app/Livewire/Project/Shared/EnvironmentVariable/All.php b/app/Livewire/Project/Shared/EnvironmentVariable/All.php index 3a5145023..b45d9aba3 100644 --- a/app/Livewire/Project/Shared/EnvironmentVariable/All.php +++ b/app/Livewire/Project/Shared/EnvironmentVariable/All.php @@ -93,6 +93,10 @@ public function getEnvironmentVariablesPreviewProperty() private function getEnvironmentVariables(bool $isPreview, bool $withSearch = true): Collection { + if ($isPreview && ! $this->supportsPreviewEnvironmentVariables()) { + return collect(); + } + $query = $isPreview ? $this->resource->environment_variables_preview() : $this->resource->environment_variables(); @@ -119,12 +123,21 @@ private function searchTerm(): string return trim($this->search); } + private function supportsPreviewEnvironmentVariables(): bool + { + return $this->showPreview && $this->resource instanceof Application; + } + public function getHasEnvironmentVariablesProperty(): bool { - return $this->environmentVariables->isNotEmpty() || + $hasPreviewEnvironmentVariables = $this->supportsPreviewEnvironmentVariables() && ( $this->environmentVariablesPreview->isNotEmpty() || + $this->hardcodedEnvironmentVariablesPreview->isNotEmpty() + ); + + return $this->environmentVariables->isNotEmpty() || $this->hardcodedEnvironmentVariables->isNotEmpty() || - $this->hardcodedEnvironmentVariablesPreview->isNotEmpty(); + $hasPreviewEnvironmentVariables; } private function nullLockedValues($envs) @@ -158,6 +171,10 @@ public function getHardcodedEnvironmentVariablesPreviewProperty() protected function getHardcodedVariables(bool $isPreview) { + if ($isPreview && ! $this->supportsPreviewEnvironmentVariables()) { + return collect([]); + } + // Only for services and docker-compose applications if ($this->resource->type() !== 'service' && ($this->resourceClass !== 'App\Models\Application' || diff --git a/resources/views/livewire/project/new/select.blade.php b/resources/views/livewire/project/new/select.blade.php index debe3326f..600433dcd 100644 --- a/resources/views/livewire/project/new/select.blade.php +++ b/resources/views/livewire/project/new/select.blade.php @@ -154,7 +154,7 @@ class="text-xs text-neutral-500 dark:text-neutral-400">