mirror of
https://github.com/OpenNebula/one.git
synced 2025-08-22 09:49:26 +03:00
NaN cost/month (update template)
This commit is contained in:
@ -142,30 +142,31 @@ define(function(require) {
|
|||||||
|
|
||||||
context.on("change", "#DISK_COST", function() {
|
context.on("change", "#DISK_COST", function() {
|
||||||
that.disk = parseInt(document.getElementById('DISK_COST').value);
|
that.disk = parseInt(document.getElementById('DISK_COST').value);
|
||||||
that.templateDISKS = JSON.parse(localStorage.getItem("disksJSON"));
|
if(!isNaN(that.disk)){
|
||||||
|
that.templateDISKS = JSON.parse(localStorage.getItem("disksJSON"));
|
||||||
if (that.templateDISKS){
|
if (that.templateDISKS){
|
||||||
OpenNebula.Image.list({
|
OpenNebula.Image.list({
|
||||||
timeout: true,
|
timeout: true,
|
||||||
success: function(request, obj_files){
|
success: function(request, obj_files){
|
||||||
var totalGB = 0;
|
var totalGB = 0;
|
||||||
$.each(that.templateDISKS, function(ikey, ivalue){
|
$.each(that.templateDISKS, function(ikey, ivalue){
|
||||||
if (ivalue.IMAGE_ID){
|
if (ivalue.IMAGE_ID){
|
||||||
$.each(obj_files, function(jkey, jvalue){
|
$.each(obj_files, function(jkey, jvalue){
|
||||||
if (ivalue.IMAGE_ID == jvalue.IMAGE.ID){
|
if (ivalue.IMAGE_ID == jvalue.IMAGE.ID){
|
||||||
totalGB += jvalue.IMAGE.SIZE / 1024;
|
totalGB += jvalue.IMAGE.SIZE / 1024;
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
} else {
|
} else {
|
||||||
totalGB += ivalue.SIZE / 1024;
|
totalGB += ivalue.SIZE / 1024;
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
totalCostDisk = totalGB * that.disk;
|
totalCostDisk = totalGB * that.disk;
|
||||||
CapacityCreate.totalCost(totalCostDisk);
|
CapacityCreate.totalCost(totalCostDisk);
|
||||||
document.getElementById('total_value_disk').textContent = convertCostNumber(that.disk * 24 * 30);
|
document.getElementById('total_value_disk').textContent = convertCostNumber(that.disk * 24 * 30);
|
||||||
$(".total_disk_cost", context).show();
|
$(".total_disk_cost", context).show();
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
}
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
|
||||||
|
Reference in New Issue
Block a user