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

B #5696: Fix error when updating template with showback disabled (#1714)

This commit is contained in:
Frederick Borges 2022-01-21 12:46:02 +01:00 committed by GitHub
parent 11a7fcd19b
commit 364105a498
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
2 changed files with 42 additions and 37 deletions

View File

@ -22,6 +22,7 @@ define(function(require) {
var CoresPerSocket = require("tabs/templates-tab/form-panels/create/wizard-tabs/utils/cores-per-socket");
var UserInputs = require("utils/user-inputs");
var WizardFields = require("utils/wizard-fields");
var Config = require("sunstone-config");
/*
TEMPLATES
@ -113,46 +114,50 @@ define(function(require) {
}
function _calculatedRealMemory(context){
var memory_cost = $("#MEMORY_COST").val() || 0;
var type_cost = $("#MEMORY_UNIT_COST").val() || 0;
var memory = $("#MEMORY").val();
if (type_cost == "GB"){
memory = (memory / 1024) * memory_cost * 24 * 30;
} else {
memory = memory * memory_cost * 24 * 30;
if (Config.isFeatureEnabled("showback")){
var memory_cost = $("#MEMORY_COST").val() || 0;
var type_cost = $("#MEMORY_UNIT_COST").val() || 0;
var memory = $("#MEMORY").val();
if (type_cost == "GB"){
memory = (memory / 1024) * memory_cost * 24 * 30;
} else {
memory = memory * memory_cost * 24 * 30;
}
var realMemory = document.getElementById("real_memory_cost");
var totalMemory = document.getElementById("total_value_memory");
if (realMemory && totalMemory) {
realMemory.value = memory;
totalMemory.textContent = convertCostNumber(memory);
}
if (memory_cost != "") {
$(".total_memory_cost", context).show();
}
_totalCost();
}
var realMemory = document.getElementById("real_memory_cost");
var totalMemory = document.getElementById("total_value_memory");
if (realMemory && totalMemory) {
realMemory.value = memory;
totalMemory.textContent = convertCostNumber(memory);
}
if (memory_cost != "") {
$(".total_memory_cost", context).show();
}
_totalCost();
}
function _calculatedRealCpu(context){
var cpu_cost = $("#CPU_COST").val() || 0;
var cpu = $("#CPU").val() || 0;
var totalValueCpu = document.getElementById("real_cpu_cost");
var totalCPU = document.getElementById("total_value_cpu");
cpu = cpu * cpu_cost * 24 * 30;
totalValueCpu.value = cpu;
if(totalValueCpu){
var convValue = convertCostNumber(cpu);
totalCPU.textContent = convValue;
totalValueCpu.textContent = convValue;
}
if (cpu_cost != ""){
$(".total_cpu_cost", context).show();
}
_totalCost();
if (Config.isFeatureEnabled("showback")){
var cpu_cost = $("#CPU_COST").val() || 0;
var cpu = $("#CPU").val() || 0;
var totalValueCpu = document.getElementById("real_cpu_cost");
var totalCPU = document.getElementById("total_value_cpu");
cpu = cpu * cpu_cost * 24 * 30;
totalValueCpu.value = cpu;
if(totalValueCpu){
var convValue = convertCostNumber(cpu);
totalCPU.textContent = convValue;
totalValueCpu.textContent = convValue;
}
if (cpu_cost != ""){
$(".total_cpu_cost", context).show();
}
_totalCost();
}
}
function _setup(context) {

View File

@ -195,6 +195,7 @@
</fieldset>
</div>
</div>
{{/isFeatureEnabled}}
<div class="row hypervisor not_vcenter">
<div class="medium-12 columns">
<fieldset>
@ -216,7 +217,6 @@
</fieldset>
</div>
</div>
{{/isFeatureEnabled}}
<div class="row">
<div class="large-6 columns">
<input type="checkbox" id="sunstone_network_select"/>