fix: optimize new resource creation

This commit is contained in:
Andras Bacsai 2024-05-21 10:17:32 +02:00
parent 418590fb35
commit f8cbc63ab0

View File

@ -12,7 +12,6 @@ class Create extends Component
public $type;
public function mount()
{
$services = getServiceTemplates();
$type = str(request()->query('type'));
$destination_uuid = request()->query('destination');
$server_id = request()->query('server_id');
@ -25,6 +24,9 @@ public function mount()
if (!$environment) {
return redirect()->route('dashboard');
}
if (isset($type) && isset($destination_uuid) && isset($server_id)) {
$services = getServiceTemplates();
if (in_array($type, DATABASE_TYPES)) {
if ($type->value() === "postgresql") {
$database = create_standalone_postgresql($environment->id, $destination_uuid);
@ -103,6 +105,7 @@ public function mount()
}
$this->type = $type->value();
}
}
public function render()
{
return view('livewire.project.resource.create');