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

@ -133,11 +133,16 @@ class DeleteBackupTests(TransactionTestCase):
def test_the_page_deletes_and_goes_back(self):
self.client.force_login(self.admin)
url = reverse("vmbackups:delete", args=[self.backup.uuid])
response = self.client.post(url, {"submission_key": "key-page-del1"}, HTTP_REFERER="http://testserver/backups/")
op = Operation.objects.get()
self.assertEqual(op.kind, "backup.delete")
# the job's own page: neither the Backups page nor the VM page shows a backup's job
self.assertRedirects(response, reverse("operations:job", args=[op.pk]), fetch_redirect_response=False)
response = self.client.post(url, {"submission_key": "key-page-del1"}, HTTP_REFERER="http://testserver/backups/",
follow=True)
self.assertEqual(Operation.objects.get().kind, "backup.delete")
# the page it was asked from, saying which backup goes, and the row as being deleted
self.assertEqual(response.redirect_chain[0][0], "http://testserver/backups/")
self.assertContains(response, f"The backup of vm1 taken {self.backup.created_at:%Y-%m-%d} ")
page = lxml_html.fromstring(response.content)
row = page.xpath("//table[@id='backups']/tbody/tr")[0]
self.assertTrue(row.xpath(".//*[@data-backup-pending]"))
self.assertFalse(row.xpath(".//button[@data-confirm]")) # nothing more to ask of it
class IndexTests(TransactionTestCase):