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

Solved NaN Cost in general panel VM Template (#409)

This commit is contained in:
Abel Coronado 2017-07-24 15:44:15 +02:00 committed by Ruben S. Montero
parent d436795371
commit ea84b0b446
2 changed files with 12 additions and 3 deletions

View File

@ -84,8 +84,17 @@ define(function(require) {
}
function _totalCost(){
var total = document.getElementById('real_memory_cost').value + document.getElementById('real_cpu_cost').value;
document.getElementById('total_cost').textContent = "Total: "+ convertCostNumber(total);
var memory = document.getElementById('real_memory_cost').value;
var cpu = document.getElementById('real_cpu_cost').value;
if(memory === undefined && cpu === undefined){
document.getElementById('total_cost').textContent = "Total: 0.00";
} else if(memory === undefined){
document.getElementById('total_cost').textContent = "Total: " + convertCostNumber(cpu);
} else if(cpu === undefined){
document.getElementById('total_cost').textContent = "Total: " + convertCostNumber(memory);
} else {
document.getElementById('total_cost').textContent = "Total: " + convertCostNumber(memory + cpu);
}
}
function _calculatedRealMemory(){

View File

@ -119,7 +119,7 @@
<legend>
{{tr "Cost"}}
<span>
<span id="total_cost">0.00</span>
<span id="total_cost"></span>
<small>{{tr "COST"}} / {{tr "MONTH"}}</small>
</span>
</legend>