1
0
Fork 0
mirror of https://github.com/retspen/webvirtcloud synced 2026-11-10 20:26:48 +00:00

fix(instances): the create wizard reaches the page of any architecture

The first page of the create wizard built the next page's URL from a
reversed ".../x86_64/pc/" by replacing "x86_64" with the chosen
architecture and then the first "pc" with the machine type. An
architecture containing "pc" got the machine type inside its name:
ppc64le with pseries went to /instances/create/1/ppseries64le/pc/, so
VMs could not be created on PowerPC hosts.

The URL is now reversed with the placeholders __arch__ and __machine__,
which the script replaces with the URL-encoded values.

The test renders the page, runs the script with node and fails on the
previous template for ppc64le.
This commit is contained in:
catborise 2026-10-06 10:12:08 +03:00
parent 802e90c79f
commit 62ffaab808
2 changed files with 40 additions and 1 deletions

View file

@ -131,7 +131,10 @@
let arch = $("#select_archs").val();
let machine = $("#select_chipset").val();
//create_machine_url = "/computes/" + compute + "/create/archs/" + arch + "/machines/" + machine;
url = "{% url 'instances:create_instance' compute.id 'x86_64' 'pc' %}".replace(/x86_64/, arch).replace(/pc/, machine);
// placeholders, not "x86_64"/"pc": an arch such as ppc64 contains "pc"
url = "{% url 'instances:create_instance' compute.id '__arch__' '__machine__' %}"
.replace("__arch__", encodeURIComponent(arch))
.replace("__machine__", encodeURIComponent(machine));
window.location.href = url;//create_machine_url;
}