1
0
Fork 0
mirror of https://github.com/retspen/webvirtcloud synced 2026-12-03 17:36:05 +00:00

fix(vmbackups): clearer backup pages; a deletion stays on its page

Deleting a backup took the user to the generic job page, which named
neither the backup nor a way back. The deletion now stays on the page it
was asked from, says which backup is being deleted, shows the row as
being deleted and reads the page again until it is gone. The confirm
dialog is 'Delete backup' and names the target and that it cannot be
undone; the job's label names the VM and the backup's time.

The lists keep a VM's and a target's name and a row's actions on one
line, link a backup's job only when it is being made (Progress) or failed
(Why?), and say 'While shut off' for an offline backup. The schedule form
puts the full-backup setting on a row of its own and the schedule list
shows it; the restore form starts on the VM's host.
This commit is contained in:
catborise 2026-11-17 20:14:12 +03:00
parent 43d25a2759
commit fc87a3034e
18 changed files with 276 additions and 182 deletions

View file

@ -45,6 +45,8 @@ class RestoreForm(forms.Form):
super().__init__(*args, **kwargs)
self.fields["compute"].queryset = Compute.objects.filter(backuptargetpool__target=backup.target).order_by("name")
self.fields["name"].initial = f"{backup.vm_name}-restored"
if backup.instance_id: # the VM's host, when it has the target's pool
self.fields["compute"].initial = self.fields["compute"].queryset.filter(instance=backup.instance_id).first()
if place: # a VM owner's: the VM's compute and pool, shown on the page
del self.fields["compute"], self.fields["pool"]
@ -75,7 +77,7 @@ class PolicyForm(forms.ModelForm):
model = BackupPolicy
fields = ["name", "target", "compute", "instances", "time", "keep", "full_every", "frozen", "enabled"]
labels = {"name": _("Name"), "target": _("Backup target"), "compute": _("Every VM of a compute"),
"instances": _("Or these VMs"), "time": _("Daily at"), "keep": _("Backups to keep of each VM"),
"instances": _("Or these VMs"), "time": _("Daily at"), "keep": _("Backups kept per VM"),
"full_every": _("A full backup every N backups"),
"frozen": _("Require frozen file systems"), "enabled": _("Enabled")}
widgets = {"time": forms.TimeInput(attrs={"type": "time"}, format="%H:%M"),