From e6cce350bd4363b6af39c6ef22bb39ab42de5a0f Mon Sep 17 00:00:00 2001 From: Andras Bacsai Date: Tue, 28 May 2024 13:07:07 +0200 Subject: [PATCH] fix: volume adding --- app/Livewire/Project/Shared/Storages/Add.php | 18 +++++++++++++++--- 1 file changed, 15 insertions(+), 3 deletions(-) diff --git a/app/Livewire/Project/Shared/Storages/Add.php b/app/Livewire/Project/Shared/Storages/Add.php index 66c2cd764..156078805 100644 --- a/app/Livewire/Project/Shared/Storages/Add.php +++ b/app/Livewire/Project/Shared/Storages/Add.php @@ -16,7 +16,7 @@ class Add extends Component public string $mount_path; public ?string $host_path = null; public string $file_storage_path; - public string $file_storage_content; + public ?string $file_storage_content = null; public string $file_storage_directory_source; public string $file_storage_directory_destination; @@ -25,7 +25,7 @@ class Add extends Component 'mount_path' => 'required|string', 'host_path' => 'string|nullable', 'file_storage_path' => 'string', - 'file_storage_content' => 'string', + 'file_storage_content' => 'nullable|string', 'file_storage_directory_source' => 'string', 'file_storage_directory_destination' => 'string', ]; @@ -62,6 +62,10 @@ public function mount() public function submitFileStorage() { try { + $this->validate([ + 'file_storage_path' => 'string', + 'file_storage_content' => 'nullable|string', + ]); $this->file_storage_path = trim($this->file_storage_path); $this->file_storage_path = str($this->file_storage_path)->start('/')->value(); if ($this->resource->getMorphClass() === 'App\Models\Application') { @@ -86,6 +90,10 @@ public function submitFileStorage() public function submitFileStorageDirectory() { try { + $this->validate([ + 'file_storage_directory_source' => 'string', + 'file_storage_directory_destination' => 'string', + ]); $this->file_storage_directory_source = trim($this->file_storage_directory_source); $this->file_storage_directory_source = str($this->file_storage_directory_source)->start('/')->value(); $this->file_storage_directory_destination = trim($this->file_storage_directory_destination); @@ -108,7 +116,11 @@ public function submitFileStorageDirectory() public function submitPersistentVolume() { try { - $this->validate($this->rules); + $this->validate([ + 'name' => 'required|string', + 'mount_path' => 'required|string', + 'host_path' => 'string|nullable', + ]); $name = $this->uuid . '-' . $this->name; $this->dispatch('addNewVolume', [ 'name' => $name,