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

B #5116: Fix capacity select

(cherry picked from commit 3ad30d2a7b38c0851c9a46355e388d4fdbcd1b5c)
This commit is contained in:
Sergio Betanzos 2020-12-11 10:53:33 +01:00 committed by Tino Vazquez
parent d867109994
commit 6d16870c71
No known key found for this signature in database
GPG Key ID: 14201E424D02047E

View File

@ -241,7 +241,7 @@ define(function(require) {
}
}
});
var cost = 0;
var cpuCost = capacity.CPU_COST;
var memoryCost = capacity.MEMORY_COST;
if (cpuCost == undefined){
@ -250,7 +250,8 @@ define(function(require) {
if (memoryCost == undefined){
memoryCost = Config.onedConf.DEFAULT_COST.MEMORY_COST;
}
var _redoCost = function(values){
var _redoCost = function(values) {
var cost = 0;
if (values.CPU != undefined){
cost += cpuCost * values.CPU;
@ -261,6 +262,7 @@ define(function(require) {
$(".cost_value", context).html(cost.toFixed(2));
_calculateCost();
};
if ((cpuCost != 0 || memoryCost != 0) && Config.isFeatureEnabled("showback")) {
$(".provision_create_template_cost_div").show();
_redoCost(capacity);
@ -270,6 +272,11 @@ define(function(require) {
} else {
$(".provision_create_template_cost_div").hide();
}
if (!Config.provision.create_vm.isEnabled("capacity_select")) {
$('input, select', $(".provision_capacity_selector"))
.prop("disabled", true)
}
}
function _calculateCost(){
var context = $("#provision_create_vm");