From 3f329b50dd61f2cf23918efc73d8d2c9a28c60ff Mon Sep 17 00:00:00 2001 From: catborise Date: Sat, 24 Oct 2026 19:32:41 +0300 Subject: [PATCH] feat(instances): the XML editor shows a change before saving it Change used to define the edited XML at once. It now opens a dialog with the lines the edit changes in the VM's definition, and Save there defines it. A definition libvirt refuses comes back to the dialog with the reason, and the edit stays in the editor; before, the page reloaded with the current XML and the edit was lost. A definition that changed since the editor was opened (another tab, a disk added) is not overwritten: the dialog asks to reload. An unchanged XML has nothing to save. change_xml answers the dialog with JSON; the editor's script moves to static/js/xml_editor.js. --- instances/templates/instance.html | 13 +-- .../templates/instances/settings_tab.html | 25 +++++- instances/tests/test_change_xml.py | 67 +++++++++++++-- instances/tests/test_error_handling.py | 2 +- instances/tests/test_pending_edits.py | 7 ++ instances/views.py | 28 ++++++- static/js/xml_editor.js | 82 +++++++++++++++++++ 7 files changed, 198 insertions(+), 26 deletions(-) create mode 100644 static/js/xml_editor.js diff --git a/instances/templates/instance.html b/instances/templates/instance.html index 34c5f391..9f87dc3c 100644 --- a/instances/templates/instance.html +++ b/instances/templates/instance.html @@ -159,18 +159,7 @@ //sto_input.innerHTML = pool; } - +