diff --git a/src/sunstone/public/app/tabs/provision-tab.js b/src/sunstone/public/app/tabs/provision-tab.js index 4848c46c73..4ed94e6421 100644 --- a/src/sunstone/public/app/tabs/provision-tab.js +++ b/src/sunstone/public/app/tabs/provision-tab.js @@ -380,7 +380,8 @@ define(function(require) { '
'+ ''+ ''+ - (Config.provision.create_vm.isEnabled("capacity_select") && (capacity.SUNSTONE_CAPACITY_SELECT != "NO") ? + (Config.provision.create_vm.isEnabled("capacity_select") && + !((capacity.SUNSTONE) && (capacity.SUNSTONE.CAPACITY_SELECT == "NO")) ? '
'+ '
'+ '
'+ @@ -449,7 +450,8 @@ define(function(require) { $(".provision_create_template_cost_div").hide(); } - if (Config.provision.create_vm.isEnabled("capacity_select") && (capacity.SUNSTONE_CAPACITY_SELECT != "NO")) { + if (Config.provision.create_vm.isEnabled("capacity_select") && + !((capacity.SUNSTONE) && (capacity.SUNSTONE.CAPACITY_SELECT == "NO"))) { provision_instance_type_accordion_id += 1; var provision_instance_types_datatable = $('.provision_instance_types_table', context).dataTable({ diff --git a/src/sunstone/public/app/tabs/templates-tab/form-panels/create/wizard-tabs/general.js b/src/sunstone/public/app/tabs/templates-tab/form-panels/create/wizard-tabs/general.js index 4741b463c6..da0014a731 100644 --- a/src/sunstone/public/app/tabs/templates-tab/form-panels/create/wizard-tabs/general.js +++ b/src/sunstone/public/app/tabs/templates-tab/form-panels/create/wizard-tabs/general.js @@ -118,31 +118,39 @@ define(function(require) { templateJSON["KEEP_DISKS_ON_DONE"] = $("#KEEP_DISKS", context).is(':checked')?"YES":"NO" } + var sunstone_template = {}; if ($('#sunstone_capacity_select:checked', context).length > 0) { - templateJSON["SUNSTONE_CAPACITY_SELECT"] = "NO" + sunstone_template["CAPACITY_SELECT"] = "NO" } if ($('#sunstone_network_select:checked', context).length > 0) { - templateJSON["SUNSTONE_NETWORK_SELECT"] = "NO" + sunstone_template["NETWORK_SELECT"] = "NO" + } + + if (!$.isEmptyObject(sunstone_template)) { + templateJSON['SUNSTONE'] = sunstone_template; } return templateJSON; } function _fill(context, templateJSON) { - if (templateJSON["SUNSTONE_CAPACITY_SELECT"] && - (templateJSON["SUNSTONE_CAPACITY_SELECT"].toUpperCase() == "NO")) { + var sunstone_template = templateJSON.SUNSTONE; + if (sunstone_template && + sunstone_template["CAPACITY_SELECT"] && + sunstone_template["CAPACITY_SELECT"].toUpperCase() == "NO") { $("#sunstone_capacity_select", context).attr("checked", "checked"); } - delete templateJSON["SUNSTONE_CAPACITY_SELECT"]; + delete sunstone_template["CAPACITY_SELECT"]; - if (templateJSON["SUNSTONE_NETWORK_SELECT"] && - (templateJSON["SUNSTONE_NETWORK_SELECT"].toUpperCase() == "NO")) { + if (sunstone_template && + sunstone_template["NETWORK_SELECT"] && + sunstone_template["NETWORK_SELECT"].toUpperCase() == "NO") { $("#sunstone_network_select", context).attr("checked", "checked"); } - delete templateJSON["SUNSTONE_NETWORK_SELECT"]; + delete sunstone_template["NETWORK_SELECT"]; if (templateJSON["HYPERVISOR"] == 'vcenter' && templateJSON["KEEP_DISKS_ON_DONE"] && diff --git a/src/sunstone/public/app/tabs/templates-tab/form-panels/instantiate.js b/src/sunstone/public/app/tabs/templates-tab/form-panels/instantiate.js index 4970c4c187..fcfc33d3d5 100644 --- a/src/sunstone/public/app/tabs/templates-tab/form-panels/instantiate.js +++ b/src/sunstone/public/app/tabs/templates-tab/form-panels/instantiate.js @@ -227,8 +227,9 @@ define(function(require) { }); } - if (template_json.VMTEMPLATE.TEMPLATE.SUNSTONE_CAPACITY_SELECT && - template_json.VMTEMPLATE.TEMPLATE.SUNSTONE_CAPACITY_SELECT.toUpperCase() == "NO"){ + if (template_json.VMTEMPLATE.TEMPLATE.SUNSTONE && + template_json.VMTEMPLATE.TEMPLATE.SUNSTONE.CAPACITY_SELECT && + template_json.VMTEMPLATE.TEMPLATE.SUNSTONE.CAPACITY_SELECT.toUpperCase() == "NO"){ capacityContext.hide(); } diff --git a/src/sunstone/public/app/utils/nics-section.js b/src/sunstone/public/app/utils/nics-section.js index 3ad108ea0d..5eb27bb1c3 100644 --- a/src/sunstone/public/app/utils/nics-section.js +++ b/src/sunstone/public/app/utils/nics-section.js @@ -30,7 +30,8 @@ define(function(require) { } function _insert(template_json, context) { - if (template_json.VMTEMPLATE.TEMPLATE.SUNSTONE_NETWORK_SELECT != "NO") { + if (!(template_json.VMTEMPLATE.TEMPLATE.SUNSTONE && + template_json.VMTEMPLATE.TEMPLATE.SUNSTONE.NETWORK_SELECT == "NO")) { var template_nic = template_json.VMTEMPLATE.TEMPLATE.NIC var nics = [] if ($.isArray(template_nic))