From 7686ebfd6ce622740018795a568aba76410e1ba4 Mon Sep 17 00:00:00 2001
From: Andras Bacsai <5845193+andrasbacsai@users.noreply.github.com>
Date: Fri, 28 Mar 2025 21:05:34 +0100
Subject: [PATCH] refactor(file-storage): add loadStorageOnServer method for
improved error handling
---
app/Livewire/Project/Service/FileStorage.php | 13 ++++++++++++-
.../livewire/project/service/file-storage.blade.php | 1 +
2 files changed, 13 insertions(+), 1 deletion(-)
diff --git a/app/Livewire/Project/Service/FileStorage.php b/app/Livewire/Project/Service/FileStorage.php
index 4d070bc0c..5b88c15eb 100644
--- a/app/Livewire/Project/Service/FileStorage.php
+++ b/app/Livewire/Project/Service/FileStorage.php
@@ -49,7 +49,6 @@ class FileStorage extends Component
$this->workdir = null;
$this->fs_path = $this->fileStorage->fs_path;
}
- $this->fileStorage->loadStorageOnServer();
}
public function convertToDirectory()
@@ -68,6 +67,18 @@ class FileStorage extends Component
}
}
+ public function loadStorageOnServer()
+ {
+ try {
+ $this->fileStorage->loadStorageOnServer();
+ $this->dispatch('success', 'File storage loaded from server.');
+ } catch (\Throwable $e) {
+ return handleError($e, $this);
+ } finally {
+ $this->dispatch('refreshStorages');
+ }
+ }
+
public function convertToFile()
{
try {
diff --git a/resources/views/livewire/project/service/file-storage.blade.php b/resources/views/livewire/project/service/file-storage.blade.php
index 6010000c4..c1479a9f9 100644
--- a/resources/views/livewire/project/service/file-storage.blade.php
+++ b/resources/views/livewire/project/service/file-storage.blade.php
@@ -39,6 +39,7 @@
confirmationLabel="Please confirm the execution of the actions by entering the Filepath below"
shortConfirmationLabel="Filepath" :confirmWithPassword="false" step2ButtonText="Convert to directory" />
@endif
+ Load from server