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

fix(instances): the disk bus list follows the device type on the create page

Changing a disk's device type in the custom create form asked for its
buses at /archs/undefined/machines/undefined/...: the script read the
architecture and machine from a select[name=arch] and #machine-control
the page does not have. The request failed (500) and the bus list kept
the disk's buses, so a CD-ROM could be put on virtio. The script takes
both from the page's own URL.
This commit is contained in:
catborise 2026-10-19 22:09:04 +03:00
parent ca3b5c8d1c
commit d14a311862
2 changed files with 42 additions and 2 deletions

View file

@ -921,8 +921,9 @@
}
function get_disk_bus_choices(compute_id, dev_idx, disk_type){
let arch = $('select[name="arch"]').val();
let machine = $("select[id='machine-control']").val();
// the page's own architecture and machine type, from its URL
let arch = "{{ arch|escapejs }}";
let machine = "{{ machine|escapejs }}";
get_diskBus_url = "/computes/" + compute_id + "/archs/" + arch + "/machines/" + machine + "/disks/" + disk_type + "/buses";
$.getJSON(get_diskBus_url, function (data) {
$("#bus" + dev_idx).find('option').remove();