fix: show real storage name on services

This commit is contained in:
Andras Bacsai
2023-09-25 17:14:19 +02:00
parent 0b11093d18
commit ee20c3339e
4 changed files with 15 additions and 6 deletions

View File

@@ -11,6 +11,7 @@ class Show extends Component
public LocalPersistentVolume $storage; public LocalPersistentVolume $storage;
public bool $isReadOnly = false; public bool $isReadOnly = false;
public ?string $modalId = null; public ?string $modalId = null;
public ?string $realName = null;
protected $rules = [ protected $rules = [
'storage.name' => 'required|string', 'storage.name' => 'required|string',
@@ -25,6 +26,11 @@ class Show extends Component
public function mount() 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); $this->modalId = new Cuid2(7);
} }

View File

@@ -12,16 +12,19 @@ class LocalPersistentVolume extends Model
public function application() public function application()
{ {
return $this->morphTo(); return $this->morphTo('resource');
} }
public function service() public function service()
{ {
return $this->morphTo(); return $this->morphTo('resource');
}
public function database()
{
return $this->morphTo('resource');
} }
public function standalone_postgresql() public function standalone_postgresql()
{ {
return $this->morphTo(); return $this->morphTo('resource');
} }
protected function name(): Attribute protected function name(): Attribute

View File

@@ -9,7 +9,7 @@
<a :class="activeTab === 'general' && 'text-white'" <a :class="activeTab === 'general' && 'text-white'"
@click.prevent="activeTab = 'general'; window.location.hash = 'general'" href="#">General</a> @click.prevent="activeTab = 'general'; window.location.hash = 'general'" href="#">General</a>
<a :class="activeTab === 'storages' && 'text-white'" <a :class="activeTab === 'storages' && 'text-white'"
@click.prevent="activeTab = 'storages'; window.location.hash = 'storages'" href="#">Persistent Storages @click.prevent="activeTab = 'storages'; window.location.hash = 'storages'" href="#">Storages
</a> </a>
</div> </div>
<div class="w-full pl-8"> <div class="w-full pl-8">

View File

@@ -12,7 +12,7 @@
@endif @endif
<form wire:submit.prevent='submit' class="flex flex-col gap-2 pt-4 xl:items-end xl:flex-row"> <form wire:submit.prevent='submit' class="flex flex-col gap-2 pt-4 xl:items-end xl:flex-row">
@if ($isReadOnly) @if ($isReadOnly)
<x-forms.input id="storage.name" label="Name" required readonly /> <x-forms.input id="realName" label="Volume Name" required readonly />
<x-forms.input id="storage.host_path" label="Source Path" readonly /> <x-forms.input id="storage.host_path" label="Source Path" readonly />
<x-forms.input id="storage.mount_path" label="Destination Path" required readonly /> <x-forms.input id="storage.mount_path" label="Destination Path" required readonly />
@else @else