mirror of https://github.com/apache/cloudstack.git
bug 6240: ISO page - create VM - add size field that shows when selected disk offering is custom.
This commit is contained in:
parent
64d589192f
commit
dd72bbea09
|
|
@ -299,7 +299,14 @@
|
|||
<label><%=t.t("disk.offering")%>:</label>
|
||||
<select class="select" id="disk_offering">
|
||||
</select>
|
||||
</li>
|
||||
</li>
|
||||
<li id="size_container">
|
||||
<label>
|
||||
<%=t.t("size")%>:</label>
|
||||
<input class="text" type="text" id="size" />
|
||||
<div id="size_errormsg" class="dialog_formcontent_errormsg" style="display: none;">
|
||||
</div>
|
||||
</li>
|
||||
<li>
|
||||
<label><%=t.t("hypervisor")%>:</label>
|
||||
<select class="select" id="hypervisor">
|
||||
|
|
|
|||
|
|
@ -154,13 +154,28 @@ function afterLoadIsoJSP() {
|
|||
var items = json.listdiskofferingsresponse.diskoffering;
|
||||
if(items != null && items.length > 0 ) {
|
||||
var diskOfferingField = $("#dialog_create_vm_from_iso #disk_offering").empty();
|
||||
for(var i = 0; i < items.length; i++)
|
||||
diskOfferingField.append("<option value='" + items[i].id + "'>" + fromdb(items[i].name) + "</option>");
|
||||
for(var i = 0; i < items.length; i++) {
|
||||
var $option = $("<option value='" + items[i].id + "'>" + fromdb(items[i].name) + "</option>");
|
||||
$option.data("jsonObj", items[i]);
|
||||
diskOfferingField.append($option);
|
||||
}
|
||||
$("#dialog_create_vm_from_iso").find("#disk_offering").change();
|
||||
}
|
||||
|
||||
}
|
||||
});
|
||||
|
||||
$("#dialog_create_vm_from_iso").find("#disk_offering").bind("change", function(event) {
|
||||
var jsonObj = $(this).find("option:selected").data("jsonObj");
|
||||
if(jsonObj != null && jsonObj.isCustomized == true) { //jsonObj is null when "<option value=''>No disk offering</option>" is selected
|
||||
$("#dialog_create_vm_from_iso").find("#size_container").show();
|
||||
}
|
||||
else {
|
||||
$("#dialog_create_vm_from_iso").find("#size_container").hide();
|
||||
$("#dialog_create_vm_from_iso").find("#size").val("");
|
||||
}
|
||||
});
|
||||
|
||||
//initialize dialog box ***
|
||||
initDialog("dialog_confirmation_delete_iso_all_zones");
|
||||
initDialog("dialog_confirmation_delete_iso");
|
||||
|
|
@ -498,20 +513,33 @@ function doCreateVMFromIso($actionLink, $detailsTab, $midmenuItem1) {
|
|||
// validate values
|
||||
var isValid = true;
|
||||
isValid &= validateString("Name", thisDialog.find("#name"), thisDialog.find("#name_errormsg"), true);
|
||||
isValid &= validateString("Group", thisDialog.find("#group"), thisDialog.find("#group_errormsg"), true);
|
||||
if (!isValid) return;
|
||||
isValid &= validateString("Group", thisDialog.find("#group"), thisDialog.find("#group_errormsg"), true);
|
||||
if(thisDialog.find("#size_container").css("display") != "none")
|
||||
isValid &= validateNumber("Size", thisDialog.find("#size"), thisDialog.find("#size_errormsg"));
|
||||
if (!isValid)
|
||||
return;
|
||||
|
||||
thisDialog.dialog("close");
|
||||
|
||||
var array1 = [];
|
||||
|
||||
var name = trim(thisDialog.find("#name").val());
|
||||
array1.push("&displayname="+todb(name));
|
||||
|
||||
var group = trim(thisDialog.find("#group").val());
|
||||
array1.push("&group="+todb(group));
|
||||
|
||||
var serviceOfferingId = thisDialog.find("#service_offering").val();
|
||||
array1.push("&serviceOfferingId="+serviceOfferingId);
|
||||
|
||||
var diskOfferingId = thisDialog.find("#disk_offering").val();
|
||||
array1.push("&diskOfferingId="+diskOfferingId);
|
||||
|
||||
if(thisDialog.find("#size_container").css("display") != "none") {
|
||||
var size = thisDialog.find("#size").val()
|
||||
array1.push("&size="+size);
|
||||
}
|
||||
|
||||
var hypervisor = thisDialog.find("#hypervisor").val();
|
||||
array1.push("&hypervisor="+hypervisor);
|
||||
|
||||
|
|
|
|||
Loading…
Reference in New Issue