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

feat(ui): what a job, a tag or a backup names links to its page

- A job's page and the Jobs list link what the job works on: a VM's
  page for who may see the VM (not when a copy on another host has its
  UUID); a host's, a backup target's, or the Computes page for a bulk
  migration, for a superuser (operations.views.link_resources). A
  backup's or a pool's job has none: a restore names the new VM, and a
  pool may be gone.
- The Tags page's VM and host counts open the VM list or the Computes
  page with that tag only: a list with that tag takes ?tag=name, and
  the address loses it (the rest stays), so the list's own reload keeps
  what is chosen afterwards. The bulk bar sends back to the list's path.
- A Backups row links its target, and a removed VM's badge the Removed
  VMs page while the VM is listed there.
This commit is contained in:
catborise 2026-11-21 23:05:15 +03:00
parent fb81e7adca
commit 2373d73b37
14 changed files with 154 additions and 12 deletions

View file

@ -244,6 +244,19 @@ class IndexTests(TransactionTestCase):
self.assertNotIn(reverse("vmbackups:restore_over", args=[ready.uuid]),
page.xpath("//table[@id='backups']//a/@href"))
def test_a_row_links_its_target_and_a_removed_vm_listed_as_removed(self):
from instances.models import InstanceTombstone
links = lambda page: set(page.xpath("//table[@id='backups']//td//a[not(contains(@class, 'dropdown-item'))]/@href"))
self.client.force_login(self.admin)
page = lxml_html.fromstring(self.client.get(reverse("vmbackups:index")).content)
self.assertTrue({reverse("vmbackups:target", args=[self.t1.pk]), reverse("vmbackups:target", args=[self.t2.pk])}
<= links(page))
self.assertNotIn(reverse("admin:tombstone_list"), links(page)) # db1 is not on the Removed VMs page
InstanceTombstone.objects.create(uuid="u2", name="db1", host="h1")
page = lxml_html.fromstring(self.client.get(reverse("vmbackups:index")).content)
self.assertIn(reverse("admin:tombstone_list"), links(page))
def test_the_list_shows_fifty_a_page_and_keeps_the_filter(self):
vm = Instance.objects.get(name="web1")
for _n in range(60):