1
0
mirror of https://github.com/OpenNebula/one.git synced 2024-12-23 17:33:56 +03:00

B #5298: Solved bug cost calculation on VM instantiation tab (#446)

This commit is contained in:
Abel Coronado 2017-09-05 13:03:27 +02:00 committed by Tino Vázquez
parent 7b587cd1a5
commit 7f7f65cd64
2 changed files with 10 additions and 6 deletions

View File

@ -179,7 +179,7 @@ define(function(require) {
* @param {Function} callback will be called as callback( retrieve(context) )
*/
function _setCallback(context, callback) {
context.on("input", function(){
context.on("change", function(){
callback( _retrieve(context) );
});

View File

@ -386,7 +386,7 @@ define(function(require) {
CapacityInputs.fill(capacityContext, template_json.VMTEMPLATE);
var cpuCost = template_json.VMTEMPLATE.TEMPLATE.CPU_COST;
var memoryCost = template_json.VMTEMPLATE.TEMPLATE.MEMORY_COST / 1024;
var memoryCost = template_json.VMTEMPLATE.TEMPLATE.MEMORY_COST;
var memoryUnitCost = template_json.VMTEMPLATE.TEMPLATE.MEMORY_UNIT_COST;
if (cpuCost == undefined){
@ -395,6 +395,10 @@ define(function(require) {
if (memoryCost == undefined){
memoryCost = Config.onedConf.DEFAULT_COST.MEMORY_COST;
} else {
if (memoryUnitCost == "GB"){
memoryCost = memoryCost / 1024;
}
}
if ((cpuCost != 0 || memoryCost != 0) && Config.isFeatureEnabled("showback")) {
@ -403,14 +407,14 @@ define(function(require) {
CapacityInputs.setCallback(capacityContext, function(values){
var cost = 0;
if (values.CPU != undefined){
cost += cpuCost * values.CPU;
}
if (values.MEMORY != undefined){
cost += memoryCost * values.MEMORY;
}
if (values.CPU != undefined){
cost += cpuCost * values.CPU;
}
$(".cost_value", capacityContext).html(cost.toFixed(2));
_calculateCost(context);