diff --git a/frontend-modern/src/components/Backups/UnifiedBackups.tsx b/frontend-modern/src/components/Backups/UnifiedBackups.tsx index b8dcb4d50..0dcf10f7c 100644 --- a/frontend-modern/src/components/Backups/UnifiedBackups.tsx +++ b/frontend-modern/src/components/Backups/UnifiedBackups.tsx @@ -197,11 +197,22 @@ const UnifiedBackups: Component = () => { return file.crypt || file.encrypted || (file.filename && file.filename.includes('.enc')); }); + // Determine the display type based on VMID and backup type + // VMID 0 = host config backup (e.g. PMG) + let displayType: GuestType; + if (parseInt(backup.vmid) === 0) { + displayType = 'Host'; + } else if (backup.backupType === 'vm' || backup.backupType === 'VM') { + displayType = 'VM'; + } else { + displayType = 'LXC'; + } + unified.push({ backupType: 'remote', vmid: parseInt(backup.vmid) || 0, name: backup.comment || '', - type: (backup.backupType === 'vm' || backup.backupType === 'VM') ? 'VM' : 'LXC', + type: displayType, node: backup.instance || 'PBS', backupTime: backupTimeSeconds, backupName: backupName, @@ -242,14 +253,14 @@ const UnifiedBackups: Component = () => { } } - // Determine the display type based on backup.type + // Determine the display type based on backup.type and VMID let displayType: GuestType; - if (backup.type === 'qemu') { + if (backup.vmid === 0 || backup.type === 'host') { + displayType = 'Host'; // PMG/PVE host config backups (VMID 0) + } else if (backup.type === 'qemu') { displayType = 'VM'; } else if (backup.type === 'lxc') { displayType = 'LXC'; - } else if (backup.type === 'host') { - displayType = 'Host'; // PMG host config backups } else { displayType = 'LXC'; // Default fallback (most people have more containers than VMs) } diff --git a/internal/mock/generator.go b/internal/mock/generator.go index 9318390e6..0f8ef0c41 100644 --- a/internal/mock/generator.go +++ b/internal/mock/generator.go @@ -1028,6 +1028,30 @@ func generatePBSBackups(vms []models.VM, containers []models.Container) []models } } + // Generate host config backups (VMID 0) - PMG/PVE host configs + // These are common when backing up Proxmox Mail Gateway hosts + hostBackupCount := 2 + rand.Intn(3) // 2-4 host backups + for i := 0; i < hostBackupCount; i++ { + backupTime := time.Now().Add(-time.Duration(rand.Intn(30*24)) * time.Hour) + + backup := models.PBSBackup{ + ID: fmt.Sprintf("pbs-backup-host-0-%d", i), + Instance: pbsInstances[rand.Intn(len(pbsInstances))], + Datastore: datastores[rand.Intn(len(datastores))], + Namespace: "root", + BackupType: "ct", // Host configs are stored as 'ct' type in PBS + VMID: "0", // VMID 0 indicates host config + BackupTime: backupTime, + Size: int64(50*1024*1024 + rand.Int63n(100*1024*1024)), // 50-150MB for host configs + Protected: rand.Float64() > 0.7, // 30% protected + Verified: rand.Float64() > 0.1, // 90% verified + Comment: "PMG host configuration backup", + Owner: "root@pam", + } + + backups = append(backups, backup) + } + // Sort by time (newest first) sort.Slice(backups, func(i, j int) bool { return backups[i].BackupTime.After(backups[j].BackupTime)