ui: able to select environment on new resource
This commit is contained in:
parent
f001e9bc34
commit
2552cb2208
@ -2,12 +2,11 @@
|
|||||||
|
|
||||||
namespace App\Http\Livewire\Project\New;
|
namespace App\Http\Livewire\Project\New;
|
||||||
|
|
||||||
|
use App\Models\Project;
|
||||||
use App\Models\Server;
|
use App\Models\Server;
|
||||||
use Countable;
|
use Countable;
|
||||||
use Illuminate\Support\Collection;
|
use Illuminate\Support\Collection;
|
||||||
use Illuminate\Support\Facades\Cache;
|
use Illuminate\Support\Facades\Cache;
|
||||||
use Illuminate\Support\Facades\File;
|
|
||||||
use Illuminate\Support\Facades\Http;
|
|
||||||
use Livewire\Component;
|
use Livewire\Component;
|
||||||
|
|
||||||
class Select extends Component
|
class Select extends Component
|
||||||
@ -24,7 +23,8 @@ class Select extends Component
|
|||||||
public Collection|array $services = [];
|
public Collection|array $services = [];
|
||||||
public bool $loadingServices = true;
|
public bool $loadingServices = true;
|
||||||
public bool $loading = false;
|
public bool $loading = false;
|
||||||
|
public $environments = [];
|
||||||
|
public ?string $selectedEnvironment = null;
|
||||||
public ?string $existingPostgresqlUrl = null;
|
public ?string $existingPostgresqlUrl = null;
|
||||||
|
|
||||||
protected $queryString = [
|
protected $queryString = [
|
||||||
@ -37,8 +37,18 @@ public function mount()
|
|||||||
if (isDev()) {
|
if (isDev()) {
|
||||||
$this->existingPostgresqlUrl = 'postgres://coolify:password@coolify-db:5432';
|
$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()
|
// public function addExistingPostgresql()
|
||||||
// {
|
// {
|
||||||
// try {
|
// try {
|
||||||
|
@ -1,5 +1,14 @@
|
|||||||
<div x-data x-init="$wire.loadThings">
|
<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="pb-4 ">Deploy resources, like Applications, Databases, Services...</div>
|
||||||
<div class="flex flex-col gap-2 pt-10">
|
<div class="flex flex-col gap-2 pt-10">
|
||||||
@if ($current_step === 'type')
|
@if ($current_step === 'type')
|
||||||
|
Loading…
Reference in New Issue
Block a user