fix: service volume read from filesystem

fix: edit compose moved to dialog
This commit is contained in:
Andras Bacsai
2023-09-30 15:08:40 +02:00
parent 64ce41df0f
commit 79fde593a9
14 changed files with 118 additions and 72 deletions

View File

@@ -13,6 +13,7 @@ class FileStorage extends Component
public LocalFileVolume $fileStorage;
public ServiceApplication|ServiceDatabase $service;
public string $fs_path;
public ?string $workdir = null;
protected $rules = [
'fileStorage.is_directory' => 'required',
@@ -23,13 +24,13 @@ class FileStorage extends Component
public function mount()
{
$this->service = $this->fileStorage->service;
$this->fs_path = Str::of($this->fileStorage->fs_path)->beforeLast('/');
$file = Str::of($this->fileStorage->fs_path)->afterLast('/');
if (Str::of($this->fs_path)->startsWith('.')) {
$this->fs_path = Str::of($this->fs_path)->after('.');
$this->fs_path = $this->service->service->workdir() . $this->fs_path . "/" . $file;
}
if (Str::of($this->fileStorage->fs_path)->startsWith('.')) {
$this->workdir = $this->service->service->workdir();
$this->fs_path = Str::of($this->fileStorage->fs_path)->after('.');
} else {
$this->workdir = null;
$this->fs_path = $this->fileStorage->fs_path;
}
}
public function submit()
{
@@ -41,8 +42,6 @@ class FileStorage extends Component
}
$this->fileStorage->save();
$this->fileStorage->saveStorageOnServer($this->service);
// ray($this->fileStorage);
// $this->service->saveFileVolumes();
$this->emit('success', 'File updated successfully.');
} catch (\Throwable $e) {
$this->fileStorage->setRawAttributes($original);