From 0ee03c0971df361820ccb2830a4426ef4ebf2ff5 Mon Sep 17 00:00:00 2001 From: catborise Date: Wed, 28 Oct 2026 20:25:00 +0300 Subject: [PATCH] feat(networks): the network pages on Bootstrap's cards, tables and dialogs As the storage pages; reviewed with Codex. - The list is a card per network: its name with Active or Stopped and Autostart badges, its type (network_mode: Isolated, NAT, Routed, Open, Bridge, Macvtap, SR-IOV), its device, and each address with its DHCP range; a bridge or macvtap network's addresses come from the outside network. - A network's page: its heading starts or stops it, the menu sets autostart and deletes a stopped one. A Network card tells its state, type, bridge or interface, MAC and what the type does; a card per address (every , each with its DHCP range dialog, which libvirt takes on a stopped network); its fixed addresses of every subnet in one table, searched, each with Edit and Delete, one dialog adding and editing them; the VMs whose definition names it, connected or configured, linked (wvmNetwork.get_vms, one domain listing, a VM undefined meanwhile left out); its bandwidth limits where libvirt sets them (not on macvtap or SR-IOV networks), in KiB/s, from the saved definition with a note that a running network takes them when restarted; its XML in an accordion. The page reads the running and the saved definition once each, and only to render itself: its actions, which all redirect, read nothing of it first. - The New network dialog is one form, as the New pool one: the type as radio cards (the radio_card.html include, now shared by both), the chosen type's fields only, IPv6 with its box, a bridge or interface suggested from the host's (get_host_interfaces, not the bridges libvirt made for its own networks); a refused network or one libvirt refuses opens the dialog again with what was entered, the reasons beside the fields and focus on the first. - What the New pool and New network dialogs share is one script, static/js/choice_dialog.js: the radio cards show their fieldsets (data-kinds) and a refused form opens again focused on its first refused field; each dialog keeps only its own changes. - The fixed-address dialogs per family go to the page's own dialog. --- networks/templates/create_net_block.html | 201 +++-- .../templates/modify_ipv4_fixed_address.html | 52 -- .../templates/modify_ipv6_fixed_address.html | 52 -- networks/templates/network.html | 795 +++++++++--------- networks/templates/networks.html | 111 +-- networks/tests/test_audit_rows.py | 2 +- networks/tests/test_fixed_address_form.py | 59 +- networks/tests/test_network_changes.py | 25 +- networks/tests/test_network_pages.py | 104 +++ networks/views.py | 86 +- static/js/choice_dialog.js | 38 + storages/templates/create_stg_block.html | 76 +- .../radio_card.html | 4 +- vrtManager/network.py | 82 +- webvirtcloud/tests/test_status_contrast.py | 17 +- 15 files changed, 947 insertions(+), 757 deletions(-) delete mode 100644 networks/templates/modify_ipv4_fixed_address.html delete mode 100644 networks/templates/modify_ipv6_fixed_address.html create mode 100644 networks/tests/test_network_pages.py create mode 100644 static/js/choice_dialog.js rename storages/templates/storages/pool_kind.html => templates/radio_card.html (59%) diff --git a/networks/templates/create_net_block.html b/networks/templates/create_net_block.html index 9a180b77..36d7e803 100644 --- a/networks/templates/create_net_block.html +++ b/networks/templates/create_net_block.html @@ -1,88 +1,151 @@ {% load i18n %} +{% load static %} {% load bootstrap_icons %} +{% load form_fields %} {% if request.user.is_superuser %} - - - + - -