From 085f5c09d84c9f19c439c79e07621e110b5c1387 Mon Sep 17 00:00:00 2001 From: Harmon Herring Date: Thu, 10 Jun 2021 17:05:37 -0400 Subject: [PATCH] Update format of VM boot order JSON Change format of the VM boot order JSON. This new format allows the UI to mimic the Proxmox boot order selection system. The new format is as follows { 'legacy': False, 'order': [ { 'device': 'virtio0', 'description': 'local-lvm:vm-102-disk-0,size=8G', 'enabled': True }, ... ] } --- proxstar/static/js/script.js | 6 +-- proxstar/templates/vm_details.html | 2 +- proxstar/vm.py | 84 ++++++++++++++++++------------ 3 files changed, 55 insertions(+), 37 deletions(-) diff --git a/proxstar/static/js/script.js b/proxstar/static/js/script.js index 154bcb1..719afb0 100644 --- a/proxstar/static/js/script.js +++ b/proxstar/static/js/script.js @@ -816,14 +816,14 @@ $("#edit-boot-order").click(function(){ const vmname = $(this).data('vmname'); const boot_order = $(this).data('boot_order'); var options = document.createElement('div'); - for (i = 0; i < boot_order.length; i++) { + for (i = 0; i < boot_order.order.length; i++) { text = document.createElement('span'); text.innerHTML = `${i + 1}. `; options.append(text); var entry = document.createElement('select'); entry.setAttribute("id", `boot-order-${i + 1}`); - for (j = 0; j < boot_order.length; j++) { - entry.appendChild(new Option(boot_order[j], boot_order[j])); + for (j = 0; j < boot_order.order.length; j++) { + entry.appendChild(new Option(boot_order.order[j].device, boot_order.order[j].device)); } entry.selectedIndex = i; entry.setAttribute('style', 'width: 85px'); diff --git a/proxstar/templates/vm_details.html b/proxstar/templates/vm_details.html index bfcc95b..9e54a15 100644 --- a/proxstar/templates/vm_details.html +++ b/proxstar/templates/vm_details.html @@ -12,7 +12,7 @@