feature #3748: fill template advanced section

This commit is contained in:
Daniel Molina committed 2015-05-27 16:29:03 +02:00
1 parent 6803324262
commit 3ed90d94b7
4 files changed
+14 -9

No files matched your search

@@ -8,6 +8,7 @@ define(function(require) {
var Sunstone = require('sunstone');
var Locale = require('utils/locale');
var Tips = require('utils/tips');
var TemplateUtils = require('utils/template-utils');
/*
TEMPLATES
@@ -147,6 +148,10 @@ define(function(require) {
var templateJSON = element.TEMPLATE;
// Populates the Avanced mode Tab
$('#template', context).val(
TemplateUtils.templateToString(templateJSON).replace(/^[\r\n]+$/g, ""));
$.each(this.wizardTabs, function(index, wizardTab) {
wizardTab.fill(context, templateJSON);
});
@@ -79,19 +79,19 @@ define(function(require) {
var wizardTabContext = $('#' + this.wizardTabId, context);
Tips.setup(wizardTabContext);
context.on("change", "#LOGO", function() {
$("#template_create_logo", context).show();
$("#template_create_logo", context).html('<span class="">' +
wizardTabContext.on("change", "#LOGO", function() {
$("#template_create_logo", wizardTabContext).show();
$("#template_create_logo", wizardTabContext).html('<span class="">' +
'<img src="' + $(this).val() + '">' +
'</span>');
});
context.on("change", "input[name='hypervisor']", function() {
wizardTabContext.on("change", "input[name='hypervisor']", function() {
$(".hypervisor", context).hide();
$(".only_" + this.value, context).show();
});
CapacityInputs.setup(context);
CapacityInputs.setup(wizardTabContext);
}
function _retrieve(context) {
@@ -101,7 +101,7 @@ define(function(require) {
if (templateJSON["HYPERVISOR"] == 'vcenter') {
templateJSON["PUBLIC_CLOUD"] = {
'TYPE': 'vcenter',
'VM_TEMPLATE': $("#vcenter_template_uuid", context).val()
'VM_TEMPLATE': $("#vcenter_template_uuid", wizardTabContext).val()
}
}
@@ -286,7 +286,7 @@ define(function(require) {
Sunstone.runAction("Network.create", network_json);
return false;
} else if (this.action == "update") {
Sunstone.runAction("Network.update", this.resourceId, TemplateUtils.convert_template_to_string(network_json));
Sunstone.runAction("Network.update", this.resourceId, TemplateUtils.templateToString(network_json));
return false;
}
}
@@ -322,7 +322,7 @@ define(function(require) {
$("#default_sg_warning").hide();
// Populates the Avanced mode Tab
$('#template', context).val(TemplateUtils.convert_template_to_string(element.TEMPLATE).replace(/^[\r\n]+$/g, ""));
$('#template', context).val(TemplateUtils.templateToString(element.TEMPLATE).replace(/^[\r\n]+$/g, ""));
$('[wizard_field="NAME"]', context).val(
element.NAME). //TODO escapeDoubleQuotes(htmlDecode( element.NAME ))).
@@ -57,7 +57,7 @@ define(function(require) {
}
return {
'convert_template_to_string': _convert_template_to_string,
'templateToString': _convert_template_to_string,
'htmlDecode': _htmlDecode
};
});