mirror of
https://github.com/OpenNebula/one.git
synced 2025-01-08 21:17:43 +03:00
M #~: Fix memory input in vm form instantiate (#115)
This commit is contained in:
parent
d59c531e6d
commit
f28db525c9
@ -606,11 +606,19 @@ define(function(require) {
|
||||
CapacityInputs.setup(capacityContext);
|
||||
CapacityInputs.fill(capacityContext, template_json.VMTEMPLATE);
|
||||
|
||||
if (template_json.VMTEMPLATE.TEMPLATE.HYPERVISOR == "vcenter"){
|
||||
$(".memory_input .mb_input input", context).attr("pattern", "^([048]|\\d*[13579][26]|\\d*[24680][048])$");
|
||||
} else {
|
||||
$(".memory_input .mb_input input", context).removeAttr("pattern");
|
||||
}
|
||||
var mb_input_unit = $(".memory_input .mb_input_unit", context);
|
||||
mb_input_unit.off("change");
|
||||
mb_input_unit.on("change", function() {
|
||||
var isMB = $(this).val() === "MB";
|
||||
var isVCenter = template_json.VMTEMPLATE.TEMPLATE.HYPERVISOR == "vcenter";
|
||||
|
||||
if (isMB && isVCenter) {
|
||||
$(".memory_input .mb_input input", context).attr("pattern", "^([048]|\\d*[13579][26]|\\d*[24680][048])$");
|
||||
} else {
|
||||
$(".memory_input .mb_input input", context).removeAttr("pattern");
|
||||
}
|
||||
});
|
||||
mb_input_unit.trigger("change");
|
||||
|
||||
var cpuCost = template_json.VMTEMPLATE.TEMPLATE.CPU_COST;
|
||||
var memoryCost = template_json.VMTEMPLATE.TEMPLATE.MEMORY_COST;
|
||||
|
@ -746,7 +746,7 @@ define(function(require) {
|
||||
var min = parseInt(element.attr("min"),10);
|
||||
var max = parseInt(element.attr("max"),10);
|
||||
if (value == ""){
|
||||
$(".mb_input_unit", context).val("MB").change();
|
||||
$(".mb_input_unit", context).val("MB").trigger("change");
|
||||
}else{
|
||||
// If you are going to put a new unit you must put it up in the html, here and down in the change
|
||||
if(value / (base**2) >= 1){
|
||||
@ -766,7 +766,7 @@ define(function(require) {
|
||||
}
|
||||
$("input.visor", contextElement).val(valueInUnit);
|
||||
var contextUnit = contextElement.siblings(".input-group-button");
|
||||
$(".mb_input_unit", contextUnit).val(unit).change();
|
||||
$(".mb_input_unit", contextUnit).val(unit).trigger("change");
|
||||
}
|
||||
|
||||
$("div.mb_input", context).on("change", "input.visor, select", function(e){
|
||||
|
Loading…
Reference in New Issue
Block a user