mirror of
https://github.com/MacRimi/ProxMenux.git
synced 2026-02-19 08:56:23 +00:00
Update modal lxc
This commit is contained in:
@@ -1239,14 +1239,15 @@ const handleDownloadLogs = async (vmid: number, vmName: string) => {
|
|||||||
|
|
||||||
<div className="flex-1 overflow-hidden px-6 py-4">
|
<div className="flex-1 overflow-hidden px-6 py-4">
|
||||||
{/* Mobile carousel container */}
|
{/* Mobile carousel container */}
|
||||||
<div className="sm:hidden relative overflow-hidden">
|
<div className="sm:hidden flex flex-col h-full">
|
||||||
|
<div className="flex-1 relative overflow-hidden">
|
||||||
<div
|
<div
|
||||||
className="flex transition-transform duration-300 ease-in-out w-[200%]"
|
className="flex transition-transform duration-300 ease-in-out h-full"
|
||||||
style={{ transform: `translateX(-${modalPage * 50}%)` }}
|
style={{ transform: `translateX(-${modalPage * 100}%)` }}
|
||||||
>
|
>
|
||||||
{/* Page 0: Main content */}
|
{/* Page 0: Main content */}
|
||||||
<div className="w-1/2 flex-shrink-0 overflow-y-auto pr-2" style={{ maxHeight: 'calc(100vh - 280px)' }}>
|
<div className="w-full flex-shrink-0 overflow-y-auto" style={{ maxHeight: 'calc(100vh - 320px)' }}>
|
||||||
<div className="space-y-6 pr-1">
|
<div className="space-y-6">
|
||||||
{selectedVM && (
|
{selectedVM && (
|
||||||
<>
|
<>
|
||||||
<div key={`metrics-mobile-${selectedVM.vmid}`}>
|
<div key={`metrics-mobile-${selectedVM.vmid}`}>
|
||||||
@@ -1369,7 +1370,7 @@ const handleDownloadLogs = async (vmid: number, vmName: string) => {
|
|||||||
</div>
|
</div>
|
||||||
|
|
||||||
{/* Page 1: Backups */}
|
{/* Page 1: Backups */}
|
||||||
<div className="w-1/2 flex-shrink-0 overflow-y-auto pl-2" style={{ maxHeight: 'calc(100vh - 280px)' }}>
|
<div className="w-full flex-shrink-0 overflow-y-auto" style={{ maxHeight: 'calc(100vh - 320px)' }}>
|
||||||
<div className="space-y-4">
|
<div className="space-y-4">
|
||||||
<Card className="border border-border bg-card/50">
|
<Card className="border border-border bg-card/50">
|
||||||
<CardContent className="p-4">
|
<CardContent className="p-4">
|
||||||
@@ -1439,6 +1440,7 @@ const handleDownloadLogs = async (vmid: number, vmName: string) => {
|
|||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
|
</div>
|
||||||
|
|
||||||
{/* Mobile pagination dots */}
|
{/* Mobile pagination dots */}
|
||||||
<div className="flex justify-center gap-2 mt-4">
|
<div className="flex justify-center gap-2 mt-4">
|
||||||
|
|||||||
@@ -5666,6 +5666,10 @@ def api_vm_backups(vmid):
|
|||||||
try:
|
try:
|
||||||
backups = []
|
backups = []
|
||||||
|
|
||||||
|
# Get current node name
|
||||||
|
node_result = subprocess.run(['hostname'], capture_output=True, text=True, timeout=5)
|
||||||
|
node = node_result.stdout.strip() if node_result.returncode == 0 else 'localhost'
|
||||||
|
|
||||||
# Get list of storage locations
|
# Get list of storage locations
|
||||||
result = subprocess.run(['pvesh', 'get', '/storage', '--output-format', 'json'],
|
result = subprocess.run(['pvesh', 'get', '/storage', '--output-format', 'json'],
|
||||||
capture_output=True, text=True, timeout=10)
|
capture_output=True, text=True, timeout=10)
|
||||||
@@ -5681,9 +5685,11 @@ def api_vm_backups(vmid):
|
|||||||
# Only check storages that can contain backups
|
# Only check storages that can contain backups
|
||||||
if 'backup' in content or storage_type == 'pbs':
|
if 'backup' in content or storage_type == 'pbs':
|
||||||
try:
|
try:
|
||||||
|
# Use --vmid filter to get only backups for this VM
|
||||||
content_result = subprocess.run(
|
content_result = subprocess.run(
|
||||||
['pvesh', 'get', f'/nodes/$(hostname)/storage/{storage_id}/content', '--output-format', 'json'],
|
['pvesh', 'get', f'/nodes/{node}/storage/{storage_id}/content',
|
||||||
capture_output=True, text=True, timeout=15, shell=True
|
'--vmid', str(vmid), '--output-format', 'json'],
|
||||||
|
capture_output=True, text=True, timeout=30
|
||||||
)
|
)
|
||||||
|
|
||||||
if content_result.returncode == 0:
|
if content_result.returncode == 0:
|
||||||
@@ -5691,39 +5697,30 @@ def api_vm_backups(vmid):
|
|||||||
|
|
||||||
for item in contents:
|
for item in contents:
|
||||||
if item.get('content') == 'backup':
|
if item.get('content') == 'backup':
|
||||||
|
# Get backup type from subtype field (PBS) or parse volid (local)
|
||||||
|
backup_type = item.get('subtype', '')
|
||||||
|
if not backup_type:
|
||||||
volid = item.get('volid', '')
|
volid = item.get('volid', '')
|
||||||
|
|
||||||
# Check if this backup belongs to the requested vmid
|
|
||||||
backup_vmid = None
|
|
||||||
backup_type = None
|
|
||||||
|
|
||||||
if 'vzdump-qemu-' in volid:
|
if 'vzdump-qemu-' in volid:
|
||||||
backup_type = 'qemu'
|
backup_type = 'qemu'
|
||||||
try:
|
|
||||||
backup_vmid = int(volid.split('vzdump-qemu-')[1].split('-')[0])
|
|
||||||
except:
|
|
||||||
pass
|
|
||||||
elif 'vzdump-lxc-' in volid:
|
elif 'vzdump-lxc-' in volid:
|
||||||
backup_type = 'lxc'
|
backup_type = 'lxc'
|
||||||
try:
|
|
||||||
backup_vmid = int(volid.split('vzdump-lxc-')[1].split('-')[0])
|
|
||||||
except:
|
|
||||||
pass
|
|
||||||
|
|
||||||
if backup_vmid == vmid:
|
|
||||||
size = item.get('size', 0)
|
size = item.get('size', 0)
|
||||||
ctime = item.get('ctime', 0)
|
ctime = item.get('ctime', 0)
|
||||||
|
notes = item.get('notes', '')
|
||||||
|
|
||||||
backups.append({
|
backups.append({
|
||||||
'volid': volid,
|
'volid': item.get('volid', ''),
|
||||||
'storage': storage_id,
|
'storage': storage_id,
|
||||||
'type': backup_type,
|
'type': backup_type,
|
||||||
'size': size,
|
'size': size,
|
||||||
'size_human': format_bytes(size),
|
'size_human': format_bytes(size),
|
||||||
'timestamp': ctime,
|
'timestamp': ctime,
|
||||||
'date': datetime.fromtimestamp(ctime).strftime('%Y-%m-%d %H:%M') if ctime else ''
|
'date': datetime.fromtimestamp(ctime).strftime('%Y-%m-%d %H:%M') if ctime else '',
|
||||||
|
'notes': notes
|
||||||
})
|
})
|
||||||
except:
|
except Exception as e:
|
||||||
continue
|
continue
|
||||||
|
|
||||||
# Sort by timestamp (newest first)
|
# Sort by timestamp (newest first)
|
||||||
|
|||||||
Reference in New Issue
Block a user