mirror of
https://github.com/rcourtman/Pulse.git
synced 2026-09-22 03:04:03 +00:00
fix: add Instance field to mock backup and snapshot generation
Previously, mock-generated backups and snapshots had empty Instance fields, causing the backups tab node summary counts to show 0. The frontend filters backups by both instance and node name (b.instance === node.instance && b.node === node.name), but without the Instance field populated, no matches were found. Changes: - Set Instance field on VM backups (generator.go:1030) - Set Instance field on container backups (generator.go:1068) - Set Instance field on VM snapshots (generator.go:1323) - Set Instance field on container snapshots (generator.go:1355) This ensures node backup counts display correctly across all tabs.
This commit is contained in:
@@ -1027,6 +1027,7 @@ func generateBackups(vms []models.VM, containers []models.Container) []models.St
|
||||
ID: fmt.Sprintf("backup-%s-vm-%d-%d", vm.Node, vm.VMID, i),
|
||||
Storage: "local",
|
||||
Node: vm.Node,
|
||||
Instance: vm.Instance,
|
||||
Type: "qemu",
|
||||
VMID: vm.VMID,
|
||||
Time: backupTime,
|
||||
@@ -1064,6 +1065,7 @@ func generateBackups(vms []models.VM, containers []models.Container) []models.St
|
||||
ID: fmt.Sprintf("backup-%s-ct-%d-%d", ct.Node, int(ct.VMID), i),
|
||||
Storage: "local",
|
||||
Node: ct.Node,
|
||||
Instance: ct.Instance,
|
||||
Type: "lxc",
|
||||
VMID: int(ct.VMID),
|
||||
Time: backupTime,
|
||||
@@ -1318,6 +1320,7 @@ func generateSnapshots(vms []models.VM, containers []models.Container) []models.
|
||||
ID: fmt.Sprintf("snapshot-%s-vm-%d-%d", vm.Node, vm.VMID, i),
|
||||
Name: snapshotNames[rand.Intn(len(snapshotNames))],
|
||||
Node: vm.Node,
|
||||
Instance: vm.Instance,
|
||||
Type: "qemu",
|
||||
VMID: vm.VMID,
|
||||
Time: snapshotTime,
|
||||
@@ -1349,6 +1352,7 @@ func generateSnapshots(vms []models.VM, containers []models.Container) []models.
|
||||
ID: fmt.Sprintf("snapshot-%s-ct-%d-%d", ct.Node, int(ct.VMID), i),
|
||||
Name: snapshotNames[rand.Intn(len(snapshotNames))],
|
||||
Node: ct.Node,
|
||||
Instance: ct.Instance,
|
||||
Type: "lxc",
|
||||
VMID: int(ct.VMID),
|
||||
Time: snapshotTime,
|
||||
|
||||
Reference in New Issue
Block a user