1
0
mirror of https://github.com/OpenNebula/one.git synced 2025-03-23 22:50:09 +03:00

Solved showback bug ()

This commit is contained in:
Abel Coronado 2017-10-05 12:21:23 +02:00 committed by Ruben S. Montero
parent 021639f967
commit ac0d1dc6d2
3 changed files with 17 additions and 12 deletions
src/sunstone/public/app
tabs/templates-tab/form-panels/create/wizard-tabs
utils

@ -109,13 +109,13 @@ define(function(require) {
return number.toFixed(6);
}
function caculatedTotalMemory(context){
var memory = document.getElementById('MEMORY_COST').value;
if (memory != ""){
var type = document.getElementById('MEMORY_UNIT_COST').value;
memory = memory * 24 * 30; //24 hours and 30 days
document.getElementById('total_value_memory').textContent = convertCostNumber(memory);
var memory_cost = document.getElementById('MEMORY_COST').value;
var type = document.getElementById('MEMORY_UNIT_COST').value;
var real_memory = document.getElementById('MEMORY').value;
memory = memory_cost * real_memory * 24 * 30; //24 hours and 30 days
document.getElementById('total_value_memory').textContent = convertCostNumber(memory);
if (memory_cost != "")
$(".total_memory_cost", context).show();
}
}
function _setup(context) {
@ -136,8 +136,9 @@ define(function(require) {
});
context.on("change", "#CPU_COST", function() {
var cpu = document.getElementById('CPU_COST').value;
document.getElementById('total_value_cpu').textContent = convertCostNumber(cpu * 24 * 30);
var cpu = document.getElementById('CPU').value;
var cpu_cost = document.getElementById('CPU_COST').value;
document.getElementById('total_value_cpu').textContent = convertCostNumber(cpu * cpu_cost * 24 * 30);
$(".total_cpu_cost", context).show();
CapacityCreate.calculatedRealCpu();
});
@ -164,11 +165,13 @@ define(function(require) {
});
totalCostDisk = totalGB * that.disk;
CapacityCreate.totalCost(totalCostDisk);
document.getElementById('total_value_disk').textContent = convertCostNumber(that.disk * 24 * 30);
document.getElementById('total_value_disk').textContent = convertCostNumber(totalCostDisk * 24 * 30);
$(".total_disk_cost", context).show();
}
});
}
} else {
document.getElementById('total_value_disk').textContent = 0;
}
});

@ -115,6 +115,7 @@ define(function(require) {
memory = memory*memory_cost*24*30;
document.getElementById('real_memory_cost').textContent = "Cost: "+ convertCostNumber(memory);
document.getElementById('real_memory_cost').value = memory;
document.getElementById('total_value_memory').textContent = memory;
_totalCost();
}
@ -124,6 +125,7 @@ define(function(require) {
cpu = cpu*cpu_cost*24*30;
document.getElementById('real_cpu_cost').textContent = "Cost: "+ convertCostNumber(cpu);
document.getElementById('real_cpu_cost').value = cpu;
document.getElementById('total_value_cpu').textContent = cpu;
_totalCost();
}

@ -30,7 +30,7 @@ define(function(require){
function _calculateCost(context, disk_cost, callback){
var cost = 0;
disk_cost = disk_cost / 1024 / 1024;
disk_cost = disk_cost / 1024;
$(".diskContainer", context).each(function(){
var size = 0;
@ -86,12 +86,12 @@ define(function(require){
disk_cost = Config.onedConf.DEFAULT_COST.DISK_COST;
}
disksContext.off("input", "input");
disksContext.off("change", "input");
if (disk_cost != 0 && Config.isFeatureEnabled("showback")) {
$(".provision_create_template_disk_cost_div", disksContext).show();
disksContext.on("input", "input", function(){
disksContext.on("change", "input", function(){
_calculateCost(disksContext, disk_cost, opts.cost_callback);
});