mirror of
https://github.com/OpenNebula/one.git
synced 2025-04-02 10:50:07 +03:00
Feature #4317: Support user_inputs in vm resize dialog
This commit is contained in:
parent
8c3b821d5d
commit
7693ae7af5
@ -878,6 +878,7 @@ VM_RESTRICTED_ATTR = "CPU_COST"
|
||||
VM_RESTRICTED_ATTR = "MEMORY_COST"
|
||||
VM_RESTRICTED_ATTR = "DISK_COST"
|
||||
VM_RESTRICTED_ATTR = "PCI"
|
||||
VM_RESTRICTED_ATTR = "USER_INPUTS"
|
||||
|
||||
#VM_RESTRICTED_ATTR = "RANK"
|
||||
#VM_RESTRICTED_ATTR = "SCHED_RANK"
|
||||
|
@ -97,7 +97,7 @@
|
||||
<div class="small-4 columns">
|
||||
<select class="cpu_modify_type" >
|
||||
<option value="fixed">{{tr "fixed"}}</option>
|
||||
<option selected value="number">{{tr "number"}}</option>
|
||||
<option selected value="number-float">{{tr "number"}}</option>
|
||||
<option value="range">{{tr "range"}}</option>
|
||||
<option value="list">{{tr "list"}}</option>
|
||||
</select>
|
||||
|
@ -104,19 +104,36 @@ define(function(require) {
|
||||
$(this).data("original_value", element.TEMPLATE[field_name]);
|
||||
});
|
||||
|
||||
WizardFields.fill(context, element.TEMPLATE);
|
||||
var userInputs;
|
||||
|
||||
if (element.USER_TEMPLATE != undefined){
|
||||
userInputs = element.USER_TEMPLATE.USER_INPUTS;
|
||||
} else {
|
||||
userInputs = element.TEMPLATE.USER_INPUTS;
|
||||
}
|
||||
|
||||
var userInputs = element.TEMPLATE.USER_INPUTS;
|
||||
if (userInputs != undefined){
|
||||
|
||||
if (userInputs.CPU != undefined){
|
||||
var input = UserInputs.generateInputElement("CPU", userInputs.CPU);
|
||||
var attr = UserInputs.parse("CPU", userInputs.CPU);
|
||||
|
||||
if (element.TEMPLATE.CPU != undefined){
|
||||
attr.initial = element.TEMPLATE.CPU;
|
||||
}
|
||||
|
||||
var input = UserInputs.attributeInput(attr);
|
||||
|
||||
$("div.cpu_input", context).html(input);
|
||||
}
|
||||
|
||||
if (userInputs.VCPU != undefined){
|
||||
var input = UserInputs.generateInputElement("VCPU", userInputs.VCPU);
|
||||
var attr = UserInputs.parse("VCPU", userInputs.VCPU);
|
||||
|
||||
if (element.TEMPLATE.VCPU != undefined){
|
||||
attr.initial = element.TEMPLATE.VCPU;
|
||||
}
|
||||
|
||||
var input = UserInputs.attributeInput(attr);
|
||||
|
||||
$("div.vcpu_input", context).html(input);
|
||||
}
|
||||
@ -124,7 +141,6 @@ define(function(require) {
|
||||
if (userInputs.MEMORY != undefined){
|
||||
// Normal input for MB
|
||||
var attr = UserInputs.parse("MEMORY", userInputs.MEMORY);
|
||||
attr.step = 256;
|
||||
var input = UserInputs.attributeInput(attr);
|
||||
|
||||
$("div.memory_input", context).html(input);
|
||||
@ -138,17 +154,16 @@ define(function(require) {
|
||||
attr_gb.type = "range-float";
|
||||
attr_gb.min = (attr_gb.min / 1024);
|
||||
attr_gb.max = (attr_gb.max / 1024);
|
||||
attr_gb.step = 0.25;
|
||||
attr_gb.step = "any";
|
||||
|
||||
} else if (attr_gb.type == "list"){
|
||||
attr_gb.options = attr_gb.options.map(function(e){
|
||||
return e / 1024;
|
||||
});
|
||||
attr_gb.step = 0.25;
|
||||
|
||||
} else if (attr_gb.type == "number"){
|
||||
attr_gb.type = "number-float";
|
||||
attr_gb.step = 1;
|
||||
attr_gb.step = "any";
|
||||
}
|
||||
|
||||
input = UserInputs.attributeInput(attr_gb);
|
||||
@ -157,6 +172,8 @@ define(function(require) {
|
||||
}
|
||||
}
|
||||
|
||||
WizardFields.fill(context, element.TEMPLATE);
|
||||
|
||||
// Update memory_gb with the value set in memory
|
||||
$("input, select", $("div.memory_input", context)).trigger("input");
|
||||
|
||||
|
@ -365,7 +365,7 @@ define(function(require) {
|
||||
break;
|
||||
|
||||
case "number-float":
|
||||
attr.step = "0.01";
|
||||
attr.step = "any";
|
||||
break;
|
||||
|
||||
case "range":
|
||||
@ -382,7 +382,7 @@ define(function(require) {
|
||||
|
||||
attr.min = parseFloat( params[0] );
|
||||
attr.max = parseFloat( params[1] );
|
||||
attr.step = "0.01";
|
||||
attr.step = "any";
|
||||
|
||||
break;
|
||||
|
||||
|
Loading…
x
Reference in New Issue
Block a user