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:
parent
43d25a2759
commit
fc87a3034e
18 changed files with 276 additions and 182 deletions
|
|
@ -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):
|
||||
|
|
|
|||
|
|
@ -283,6 +283,14 @@ class RestoreTests(TransactionTestCase):
|
|||
with self.assertRaisesMessage(OperationError, "builds on a backup that is gone"):
|
||||
self.run_job(self.submit())
|
||||
|
||||
def test_the_restore_form_starts_on_the_vms_host(self):
|
||||
from vmbackups.forms import RestoreForm
|
||||
|
||||
vm = Instance.objects.create(compute=self.compute, name="vm1", uuid=self.backup.vm_uuid)
|
||||
Backup.objects.filter(pk=self.backup.pk).update(instance=vm)
|
||||
self.backup.refresh_from_db()
|
||||
self.assertEqual(RestoreForm(backup=self.backup).fields["compute"].initial, self.compute)
|
||||
|
||||
def test_the_nvram_file_is_qemus(self):
|
||||
self.run_job(self.submit())
|
||||
self.assertEqual(self.conn.upload_volume.call_args.kwargs, {"owner": _owner(), "mode": "0600"})
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue