Files
Virtnet.bond/extensions/Servers/Proxmox/views/backups.blade.php
Joseph.Rawlings 0ed29d782e Refactor Proxmox views for improved styling and consistency
- Updated subdomain.blade.php to enhance button styles and modal transitions.
- Changed text colors for better readability and consistency across the UI.
- Refactored system.blade.php to unify button components and improve layout structure.
- Adjusted modal z-index values for consistent layering.
- Enhanced accessibility by ensuring proper text contrast and hover states.
2025-12-18 09:40:58 -05:00

175 lines
10 KiB
PHP

<x-proxmox::layout :server="$server" view="backups" :status="$status" :status-polling="true" :status-polling-interval="'2s'">
<div class="space-y-6">
<div class="flex items-center justify-between">
<div class="flex items-center gap-3">
<div class="flex items-center gap-2 min-w-0">
<h2 class="text-xl font-semibold break-words">Backup Details</h2>
<div class="relative" x-data="{ open: false }" x-cloak>
<button type="button" @click="open = true" class="text-base/50 hover:text-base/70 transition-colors">
<x-ri-question-line class="size-4" />
</button>
<!-- Modal Backdrop -->
<div x-show="open"
x-transition:enter="transition ease-out duration-300"
x-transition:enter-start="opacity-0"
x-transition:enter-end="opacity-100"
x-transition:leave="transition ease-in duration-200"
x-transition:leave-start="opacity-100"
x-transition:leave-end="opacity-0"
@click="open = false"
@keydown.escape.window="open = false"
class="fixed inset-0 z-50 bg-black/50 backdrop-blur-sm"
style="display: none;">
</div>
<!-- Modal -->
<div x-show="open"
x-transition:enter="transition ease-out duration-300"
x-transition:enter-start="opacity-0 scale-95"
x-transition:enter-end="opacity-100 scale-100"
x-transition:leave="transition ease-in duration-200"
x-transition:leave-start="opacity-100 scale-100"
x-transition:leave-end="opacity-0 scale-95"
@click.away="open = false"
@keydown.escape.window="open = false"
class="fixed inset-0 z-50 flex items-center justify-center p-4"
style="display: none;">
<div class="relative w-full max-w-2xl max-h-[90vh] overflow-y-auto bg-background-secondary rounded-xl border border-neutral/20 shadow-2xl p-6">
<button @click="open = false" class="absolute top-4 right-4 text-base/50 hover:text-base transition-colors">
<x-ri-close-line class="size-5" />
</button>
<div class="flex items-center gap-3 mb-4 pr-8">
<div class="flex items-center justify-center w-10 h-10 rounded-lg bg-primary/10">
<x-ri-database-2-line class="size-5 text-primary" />
</div>
<h6 class="font-sans text-lg font-semibold leading-tight text-base">
Backup Details
</h6>
</div>
<p class="block font-sans text-sm font-normal leading-relaxed text-base/90 mb-4">
View and manage backups for this virtual machine. Backups are stored on the KVM server and can be restored or deleted as needed.
</p>
<div class="pt-4 mt-4 border-t border-neutral/30 space-y-2.5">
<p class="block font-sans text-xs font-normal leading-relaxed text-base/75">
<span class="font-semibold text-base/90">Restore:</span> Restores the virtual machine to the state captured in the backup. The VM must be powered off before restoring.
</p>
<p class="block font-sans text-xs font-normal leading-relaxed text-base/75">
<span class="font-semibold text-base/90">Delete:</span> Permanently removes a backup from the server. This action cannot be undone.
</p>
<p class="block font-sans text-xs font-normal leading-relaxed text-base/75">
<span class="font-semibold text-base/90">Note:</span> Backups include the entire VM state including disk data, configuration, and metadata. Ensure you have sufficient storage quota for backups.
</p>
</div>
</div>
</div>
</div>
</div>
</div>
<div>
<div class="flex flex-row gap-2 w-fit hidden lg:flex">
<livewire:proxmox.backups.create :server="$server" />
</div>
</div>
</div>
<div class="bg-background-secondary border border-neutral rounded-lg shadow-sm">
<div class="overflow-x-auto rounded-lg">
<table class="min-w-full divide-y divide-neutral/40 text-sm">
<thead>
<tr class="text-left text-base font-semibold text-base/70">
<th class="px-4 py-3">Backup</th>
<th class="px-4 py-3">Size</th>
<th class="px-4 py-3">Created At</th>
<th class="px-4 py-3 text-center">Actions</th>
</tr>
</thead>
<tbody class="divide-y divide-neutral/20 text-base text-base/80">
@forelse($backups as $backup)
@php $backup = (object) $backup; @endphp
<tr class="hover:bg-background/60 transition-colors">
<td class="px-4 py-4 align-middle">
<p class="font-semibold text-base/90 break-words">{{ $backup->notes ?: '—' }}</p>
</td>
<td class="px-4 py-4 align-middle">
<span class="font-medium">{{ Illuminate\Support\Number::fileSize($backup->size, 2) }}</span>
</td>
<td class="px-4 py-4 align-middle">
<span class="font-medium">{{ date('Y-m-d H:i:s', $backup->ctime) }}</span>
</td>
<td class="px-4 py-4 align-middle">
<div class="flex flex-wrap items-center justify-center gap-2">
<button @click="$wire.set('showRestore', true); $wire.set('volid', '{{ $backup->volid }}')"
class="bg-background border border-neutral px-3 py-2 rounded-md text-sm font-semibold flex items-center gap-2">
<x-ri-checkbox-circle-fill class="w-4 h-4"/> Restore
</button>
<button
wire:click="promptDelete('{{ $backup->volid }}')"
class="bg-background border border-neutral px-3 py-2 rounded-md text-sm font-semibold flex items-center gap-2 text-error">
<x-ri-delete-bin-fill class="w-4 h-4"/> Delete
</button>
</div>
</td>
</tr>
@empty
<tr>
<td colspan="4" class="px-4 py-6 text-center text-base/50 text-sm">
No backups available for this server.
</td>
</tr>
@endforelse
</tbody>
</table>
</div>
</div>
</div>
@if($showRestore)
<x-modal id="restore-backup" title="Restore Backup" open>
<div class="flex flex-col gap-4">
<x-form.checkbox label="I'm sure I want to restore this backup and delete all current data. This process is irreversible. "
wire:model="confirmRestore" name="confirmRestore" required />
<div class="text-sm font-semibold">
Please ensure that the virtual private server is powered off before proceeding. If the server is not powered off, the restore <u>will</u> fail.
</div>
</div>
<div class="flex flex-row gap-4 mt-4">
<x-button.secondary wire:click="$set('showRestore', false)">Cancel</x-button.secondary>
<x-button.primary wire:click="restoreBackup" wire:loading.attr="disabled" wire:loading.class="opacity-50"
wire:loading.attr="aria-busy" wire:target="restoreBackup">
<x-loading target="restoreBackup" />
<div wire:loading.remove wire:target="restoreBackup">
Restore
</div>
</x-button.primary>
</div>
</x-modal>
@endif
@if($showDelete)
<x-modal id="delete-backup" title="Delete Backup" open>
<div class="flex flex-col gap-4">
<x-form.checkbox label="I understand this backup will be permanently deleted and cannot be recovered."
wire:model="confirmDelete" name="confirmDelete" required />
<div class="text-sm font-semibold text-error">
Ensure you have downloaded or verified this backup before deleting.
</div>
</div>
<div class="flex flex-row gap-4 mt-4">
<x-button.secondary wire:click="$set('showDelete', false)">Cancel</x-button.secondary>
<x-button.danger wire:click="deleteBackup" wire:loading.attr="disabled" wire:loading.class="opacity-50"
wire:loading.attr="aria-busy" wire:target="deleteBackup">
<x-loading target="deleteBackup" />
<div wire:loading.remove wire:target="deleteBackup">
Delete Backup
</div>
</x-button.danger>
</div>
</x-modal>
@endif
</x-proxmox::layout>