1
0
Fork 0
mirror of https://github.com/retspen/webvirtcloud synced 2026-11-11 12:46:49 +00:00

feat(instances): a VM's network devices as rows of one list

The Network tab gave each network device a card with its buttons in a
footer, two cards to a row, as the disks had.

Each device is now a row of the same kind of list as the disks: eth N
with its target, the source, the IPv4 addresses and the link switch,
and Edit, Add QoS and Delete at the row's end; the device details, the
QoS limits and the macvtap note still fold out below it. A row holds
its Edit and Add QoS dialogs, so only rows sit in the list.
This commit is contained in:
catborise 2026-10-31 16:25:29 +03:00
parent 68d0631e33
commit 6e147ed8cc
2 changed files with 52 additions and 47 deletions

View file

@ -81,14 +81,15 @@ class PendingEditsTestCase(TestCase):
self.assertEqual(doc.xpath("//form[.//input[@name='qos_average']]//input[@name='qos_direction']/@value"),
["inbound", "outbound"])
def test_one_nic_card_spans_the_row_and_more_sit_side_by_side(self):
def test_the_nics_are_rows_of_one_list_with_their_dialogs(self):
nic = {"type": "network", "mac": "52:54:10:00:00:01", "nic": "default", "state": "up", "model": "virtio",
"ipv4": None, "ipv6": None, "filterref": "", "target": "", "inbound": [], "outbound": []}
second = {**nic, "mac": "52:54:10:00:00:02"}
for nics, wide in (([nic], ["col-12"]), ([nic, second], ["col-12 col-md-6"] * 2)):
with self.subTest(count=len(nics)):
doc = self.page(nics=(nics, nics))
self.assertEqual(doc.xpath("//div[@id='network']//div[article]/@class"), wide)
nics = [nic, {**nic, "mac": "52:54:10:00:00:02"}]
doc = self.page(nics=(nics, nics))
rows = doc.xpath("//div[@id='network']//div[contains(@class, 'list-group')]/*")
# nothing but the rows sits in the list: each row holds its Edit and Add QoS dialogs
self.assertEqual([row.get("aria-labelledby") for row in rows], ["nic-0", "nic-1"])
self.assertEqual([len(row.xpath(".//div[contains(@class, 'modal')][@id]")) for row in rows], [2, 2])
def test_the_disks_are_rows_of_one_list(self):
disks = [disk("vda", "default", "") | {"used": 1 << 29}, disk("vdb", "default", "") | {"used": (1 << 30) + (1 << 20)}]