fix: show real storage name on services
This commit is contained in:
		@@ -11,6 +11,7 @@ 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',
 | 
			
		||||
@@ -25,6 +26,11 @@ 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);
 | 
			
		||||
    }
 | 
			
		||||
 | 
			
		||||
 
 | 
			
		||||
@@ -12,16 +12,19 @@ class LocalPersistentVolume extends Model
 | 
			
		||||
 | 
			
		||||
    public function application()
 | 
			
		||||
    {
 | 
			
		||||
        return $this->morphTo();
 | 
			
		||||
        return $this->morphTo('resource');
 | 
			
		||||
    }
 | 
			
		||||
    public function service()
 | 
			
		||||
    {
 | 
			
		||||
        return $this->morphTo();
 | 
			
		||||
        return $this->morphTo('resource');
 | 
			
		||||
    }
 | 
			
		||||
    public function database()
 | 
			
		||||
    {
 | 
			
		||||
        return $this->morphTo('resource');
 | 
			
		||||
    }
 | 
			
		||||
 | 
			
		||||
    public function standalone_postgresql()
 | 
			
		||||
    {
 | 
			
		||||
        return $this->morphTo();
 | 
			
		||||
        return $this->morphTo('resource');
 | 
			
		||||
    }
 | 
			
		||||
 | 
			
		||||
    protected function name(): Attribute
 | 
			
		||||
 
 | 
			
		||||
@@ -9,7 +9,7 @@
 | 
			
		||||
            <a :class="activeTab === 'general' && 'text-white'"
 | 
			
		||||
                @click.prevent="activeTab = 'general'; window.location.hash = 'general'" href="#">General</a>
 | 
			
		||||
            <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>
 | 
			
		||||
        </div>
 | 
			
		||||
        <div class="w-full pl-8">
 | 
			
		||||
 
 | 
			
		||||
@@ -12,7 +12,7 @@
 | 
			
		||||
    @endif
 | 
			
		||||
    <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="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.mount_path" label="Destination Path" required readonly />
 | 
			
		||||
        @else
 | 
			
		||||
 
 | 
			
		||||
		Reference in New Issue
	
	Block a user