1
0
mirror of https://github.com/OpenNebula/one.git synced 2025-03-21 14:50:08 +03:00

Bug #4638: Add yaml setting to hide CPU input on vm create

(cherry picked from commit 58bebe5279978cf45d4edbe484450a8f692a9094)
This commit is contained in:
Carlos Martín 2016-07-18 18:10:57 +02:00
parent d0f29f2099
commit bb5dbf3800
8 changed files with 81 additions and 25 deletions

View File

@ -40,6 +40,11 @@ features:
# Allows to change the security groups for each network interface
# on the VM creation dialog
secgroups: true
# True to hide the CPU setting in the VM creation dialog. The CPU setting
# will be set to the same value as VCPU, that will still be visible for the
# end users
instantiate_hide_cpu: false
tabs:
dashboard-tab:
# The following widgets can be used inside any of the '_per_row' settings

View File

@ -40,6 +40,11 @@ features:
# Allows to change the security groups for each network interface
# on the VM creation dialog
secgroups: false
# True to hide the CPU setting in the VM creation dialog. The CPU setting
# will be set to the same value as VCPU, that will still be visible for the
# end users
instantiate_hide_cpu: false
tabs:
dashboard-tab:
# The following widgets can be used inside any of the '_per_row' settings

View File

@ -9,6 +9,11 @@ features:
# Allows to change the security groups for each network interface
# on the VM creation dialog
secgroups: true
# True to hide the CPU setting in the VM creation dialog. The CPU setting
# will be set to the same value as VCPU, that will still be visible for the
# end users
instantiate_hide_cpu: false
tabs:
provision-tab:
panel_tabs:

View File

@ -9,6 +9,11 @@ features:
# Allows to change the security groups for each network interface
# on the VM creation dialog
secgroups: false
# True to hide the CPU setting in the VM creation dialog. The CPU setting
# will be set to the same value as VCPU, that will still be visible for the
# end users
instantiate_hide_cpu: true
tabs:
provision-tab:
panel_tabs:

View File

@ -39,6 +39,11 @@ features:
# Allows to change the security groups for each network interface
# on the VM creation dialog
secgroups: true
# True to hide the CPU setting in the VM creation dialog. The CPU setting
# will be set to the same value as VCPU, that will still be visible for the
# end users
instantiate_hide_cpu: false
tabs:
dashboard-tab:
# The following widgets can be used inside any of the '_per_row' settings

View File

@ -39,6 +39,11 @@ features:
# Allows to change the security groups for each network interface
# on the VM creation dialog
secgroups: false
# True to hide the CPU setting in the VM creation dialog. The CPU setting
# will be set to the same value as VCPU, that will still be visible for the
# end users
instantiate_hide_cpu: true
tabs:
dashboard-tab:
# The following widgets can be used inside any of the '_per_row' settings

View File

@ -39,6 +39,11 @@ features:
# Allows to change the security groups for each network interface
# on the VM creation dialog
secgroups: true
# True to hide the CPU setting in the VM creation dialog. The CPU setting
# will be set to the same value as VCPU, that will still be visible for the
# end users
instantiate_hide_cpu: false
tabs:
dashboard-tab:
# The following widgets can be used inside any of the '_per_row' settings

View File

@ -24,6 +24,7 @@ define(function(require) {
var Tips = require('utils/tips');
var WizardFields = require('utils/wizard-fields');
var UserInputs = require('utils/user-inputs');
var Config = require('sunstone-config');
/*
TEMPLATES
@ -53,6 +54,10 @@ define(function(require) {
}
function _setup(context) {
if (Config.isFeatureEnabled("instantiate_hide_cpu")){
$(".cpu_input_wrapper", context).remove();
}
Tips.setup(context);
}
@ -80,32 +85,34 @@ define(function(require) {
var attr;
var input;
if (userInputs != undefined && userInputs.CPU != undefined){
attr = UserInputs.parse("CPU", userInputs.CPU);
} else {
attr = UserInputs.parse("CPU", "O|number-float|||");
if (!Config.isFeatureEnabled("instantiate_hide_cpu")){
if (userInputs != undefined && userInputs.CPU != undefined){
attr = UserInputs.parse("CPU", userInputs.CPU);
} else {
attr = UserInputs.parse("CPU", "O|number-float|||");
}
if (element.TEMPLATE.CPU != undefined){
attr.initial = element.TEMPLATE.CPU;
} else {
attr.mandatory = true;
}
attr.step = 0.01;
if(attr.min == undefined){
attr.min = 0.01;
}
input = UserInputs.attributeInput(attr);
if (attr.type != "range-float"){
$("div.cpu_input_wrapper", context).addClass("medium-6");
}
$("div.cpu_input", context).html(input);
}
if (element.TEMPLATE.CPU != undefined){
attr.initial = element.TEMPLATE.CPU;
} else {
attr.mandatory = true;
}
attr.step = 0.01;
if(attr.min == undefined){
attr.min = 0.01;
}
input = UserInputs.attributeInput(attr);
if (attr.type != "range-float"){
$("div.cpu_input_wrapper", context).addClass("medium-6");
}
$("div.cpu_input", context).html(input);
if (userInputs != undefined && userInputs.VCPU != undefined){
attr = UserInputs.parse("VCPU", userInputs.VCPU);
} else {
@ -173,7 +180,15 @@ define(function(require) {
* - VCPU
*/
function _retrieve(context) {
return WizardFields.retrieve(context);
var values = WizardFields.retrieve(context);
if (Config.isFeatureEnabled("instantiate_hide_cpu")){
if(values.VCPU != undefined){
values.CPU = values.VCPU;
}
}
return values;
}
/**
@ -197,6 +212,12 @@ define(function(require) {
}
});
if (Config.isFeatureEnabled("instantiate_hide_cpu")){
if(templateJSON.VCPU != undefined){
templateJSON.CPU = templateJSON.VCPU;
}
}
return templateJSON;
}
});