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.

ui: able to select environment on new resource

Andras Bacsai2552cb2208d9
diff --git a/app/Http/Livewire/Project/New/Select.php b/app/Http/Livewire/Project/New/Select.php
index 4a40c6b35d..8f1271c35d 100644
--- a/app/Http/Livewire/Project/New/Select.php
+++ b/app/Http/Livewire/Project/New/Select.php
@@ -2,12 +2,11 @@
namespace App\Http\Livewire\Project\New;
+use App\Models\Project;
use App\Models\Server;
use Countable;
use Illuminate\Support\Collection;
use Illuminate\Support\Facades\Cache;
-use Illuminate\Support\Facades\File;
-use Illuminate\Support\Facades\Http;
use Livewire\Component;
class Select extends Component
@@ -24,7 +23,8 @@ class Select extends Component
public Collection|array $services = [];
public bool $loadingServices = true;
public bool $loading = false;
-
+ public $environments = [];
+ public ?string $selectedEnvironment = null;
public ?string $existingPostgresqlUrl = null;
protected $queryString = [
@@ -37,8 +37,18 @@ class Select extends Component
if (isDev()) {
$this->existingPostgresqlUrl = 'postgres://coolify:password@coolify-db:5432';
}
+ $projectUuid = data_get($this->parameters, 'project_uuid');
+ $this->environments = Project::whereUuid($projectUuid)->first()->environments;
+ $this->selectedEnvironment = data_get($this->parameters, 'environment_name');
}
+ public function updatedSelectedEnvironment()
+ {
+ return redirect()->route('project.resources.new', [
+ 'project_uuid' => $this->parameters['project_uuid'],
+ 'environment_name' => $this->selectedEnvironment,
+ ]);
+ }
// public function addExistingPostgresql()
// {
// try {
diff --git a/resources/views/livewire/project/new/select.blade.php b/resources/views/livewire/project/new/select.blade.php
index 4e96cdf765..a7693de0d3 100644
--- a/resources/views/livewire/project/new/select.blade.php
+++ b/resources/views/livewire/project/new/select.blade.php
@@ -1,5 +1,14 @@
<div x-data x-init="$wire.loadThings">
- <h1>New Resource</h1>
+ <div class="flex gap-2 ">
+ <h1>New Resource</h1>
+ <div class="w-96">
+ <x-forms.select wire:model="selectedEnvironment">
+ @foreach ($environments as $environment)
+ <option value="{{ $environment->name }}">Environment: {{ $environment->name }}</option>
+ @endforeach
+ </x-forms.select>
+ </div>
+ </div>
<div class="pb-4 ">Deploy resources, like Applications, Databases, Services...</div>
<div class="flex flex-col gap-2 pt-10">
@if ($current_step === 'type')