From 6d16870c71cae544d47c15d2076530118ecc3241 Mon Sep 17 00:00:00 2001 From: Sergio Betanzos Date: Fri, 11 Dec 2020 10:53:33 +0100 Subject: [PATCH] B #5116: Fix capacity select (cherry picked from commit 3ad30d2a7b38c0851c9a46355e388d4fdbcd1b5c) --- src/sunstone/public/app/tabs/provision-tab.js | 11 +++++++++-- 1 file changed, 9 insertions(+), 2 deletions(-) diff --git a/src/sunstone/public/app/tabs/provision-tab.js b/src/sunstone/public/app/tabs/provision-tab.js index 9c73f1c6af..06dabe2c7d 100644 --- a/src/sunstone/public/app/tabs/provision-tab.js +++ b/src/sunstone/public/app/tabs/provision-tab.js @@ -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");