From 2552cb2208d9eeffb4e8598188e2a26dbf7ca1ea Mon Sep 17 00:00:00 2001 From: Andras Bacsai Date: Wed, 11 Oct 2023 10:19:03 +0200 Subject: [PATCH] ui: able to select environment on new resource --- app/Http/Livewire/Project/New/Select.php | 16 +++++++++++++--- .../views/livewire/project/new/select.blade.php | 11 ++++++++++- 2 files changed, 23 insertions(+), 4 deletions(-) diff --git a/app/Http/Livewire/Project/New/Select.php b/app/Http/Livewire/Project/New/Select.php index 4a40c6b35..8f1271c35 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 @@ public function mount() 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 4e96cdf76..a7693de0d 100644 --- a/resources/views/livewire/project/new/select.blade.php +++ b/resources/views/livewire/project/new/select.blade.php @@ -1,5 +1,14 @@
-

New Resource

+
+

New Resource

+
+ + @foreach ($environments as $environment) + + @endforeach + +
+
Deploy resources, like Applications, Databases, Services...
@if ($current_step === 'type')