Skip to content

An open-source, self-hostable PaaS alternative to Vercel, Heroku & Netlify that lets you easily deploy static sites, databases, full-stack applications and 360+ one-click services on your own servers.

fix: show real volume names

Andras Bacsaied6af777a42d
diff --git a/app/Http/Livewire/Project/Shared/Storages/Show.php b/app/Http/Livewire/Project/Shared/Storages/Show.php
index 46dd84affd..84593aef31 100644
--- a/app/Http/Livewire/Project/Shared/Storages/Show.php
+++ b/app/Http/Livewire/Project/Shared/Storages/Show.php
@@ -11,7 +11,6 @@ class Show extends Component
public LocalPersistentVolume $storage;
public bool $isReadOnly = false;
public ?string $modalId = null;
- public ?string $realName = null;
protected $rules = [
'storage.name' => 'required|string',
@@ -26,11 +25,6 @@ class Show extends Component
public function mount()
{
- if ($this->storage->resource_type === 'App\Models\ServiceApplication' || $this->storage->resource_type === 'App\Models\ServiceDatabase') {
- $this->realName = "{$this->storage->service->service->uuid}_{$this->storage->name}";
- } else {
- $this->realName = $this->storage->name;
- }
$this->modalId = new Cuid2(7);
}
diff --git a/app/Models/Service.php b/app/Models/Service.php
index 883a2a784d..cfbfeaf488 100644
--- a/app/Models/Service.php
+++ b/app/Models/Service.php
@@ -248,7 +248,7 @@ class Service extends BaseModel
// Collect/create/update volumes
if ($serviceVolumes->count() > 0) {
- foreach ($serviceVolumes as $volume) {
+ $serviceVolumes = $serviceVolumes->map(function ($volume) use ($savedService, $topLevelVolumes) {
$type = null;
$source = null;
$target = null;
@@ -276,10 +276,10 @@ class Service extends BaseModel
}
if ($type->value() === 'bind') {
if ($source->value() === "/var/run/docker.sock") {
- continue;
+ return $volume;
}
if ($source->value() === '/tmp' || $source->value() === '/tmp/') {
- continue;
+ return $volume;
}
LocalFileVolume::updateOrCreate(
[
@@ -297,7 +297,17 @@ class Service extends BaseModel
]
);
} else if ($type->value() === 'volume') {
- $topLevelVolumes->put($source->value(), null);
+ $slug = Str::slug($source, '-');
+ $name = "{$savedService->service->uuid}_{$slug}";
+ if (is_string($volume)) {
+ $source = Str::of($volume)->before(':');
+ $target = Str::of($volume)->after(':')->beforeLast(':');
+ $source = $name;
+ $volume = "$source:$target";
+ } else if(is_array($volume)) {
+ data_set($volume, 'source', $name);
+ }
+ $topLevelVolumes->put($name, null);
LocalPersistentVolume::updateOrCreate(
[
'mount_path' => $target,
@@ -305,7 +315,7 @@ class Service extends BaseModel
'resource_type' => get_class($savedService)
],
[
- 'name' => Str::slug($source, '-'),
+ 'name' => $name,
'mount_path' => $target,
'resource_id' => $savedService->id,
'resource_type' => get_class($savedService)
@@ -313,7 +323,11 @@ class Service extends BaseModel
);
}
$savedService->getFilesFromServer();
- }
+ ray($volume);
+
+ return $volume;
+ });
+ data_set($service, 'volumes', $serviceVolumes->toArray());
}
// Add env_file with at least .env to the service
diff --git a/resources/views/livewire/project/shared/storages/show.blade.php b/resources/views/livewire/project/shared/storages/show.blade.php
index 578ce1607c..a7da32f9c7 100644
--- a/resources/views/livewire/project/shared/storages/show.blade.php
+++ b/resources/views/livewire/project/shared/storages/show.blade.php
@@ -12,7 +12,7 @@
@endonce
<form wire:submit.prevent='submit' class="flex flex-col gap-2 pt-4 xl:items-end xl:flex-row">
@if ($isReadOnly)
- <x-forms.input id="realName" label="Volume Name" required readonly />
+ <x-forms.input id="storage.name" label="Volume Name" required readonly />
<x-forms.input id="storage.host_path" label="Source Path" readonly />
<x-forms.input id="storage.mount_path" label="Destination Path" required readonly />
@else