refactor(file-storage): add loadStorageOnServer method for improved error handling
This commit is contained in:
		@@ -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 {
 | 
			
		||||
 
 | 
			
		||||
@@ -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
 | 
			
		||||
                <x-forms.button type="button" wire:click="loadStorageOnServer">Load from server</x-forms.button>
 | 
			
		||||
                <x-modal-confirmation :ignoreWire="false" title="Confirm File Deletion?" buttonTitle="Delete"
 | 
			
		||||
                    isErrorButton submitAction="delete" :checkboxes="$fileDeletionCheckboxes" :actions="['The selected file will be permanently deleted from the container.']"
 | 
			
		||||
                    confirmationText="{{ $fs_path }}"
 | 
			
		||||
 
 | 
			
		||||
		Reference in New Issue
	
	Block a user