feature #3671: Move Sunstone vmtemplate settings to a SUNSTONE vector inside the template

This commit is contained in:
Daniel Molina committed 2016-01-11 18:53:24 +01:00
1 parent 30087b067f
commit 16f34db1a6
4 files changed
+25 -13

No files matched your search

@@ -380,7 +380,8 @@ define(function(require) {
'<br>'+
'</div>'+
'</div>'+
(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")) ?
'<div class="row">'+
'<div class="large-12 large-centered columns">'+
'<dl class="accordion" data-accordion="provision_accordion_'+provision_instance_type_accordion_id+'">'+
@@ -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({
@@ -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"] &&
@@ -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();
}
@@ -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))