diff --git a/src/sunstone/public/app/tabs/oneflow-templates-tab/form-panels/create.js b/src/sunstone/public/app/tabs/oneflow-templates-tab/form-panels/create.js index 32be38d488..41c0fa2808 100644 --- a/src/sunstone/public/app/tabs/oneflow-templates-tab/form-panels/create.js +++ b/src/sunstone/public/app/tabs/oneflow-templates-tab/form-panels/create.js @@ -230,27 +230,22 @@ define(function(require) { json_template['ready_status_gate'] = ready_status_gate; - var templateStr = $('textarea#template', $("form#createServiceTemplateFormAdvanced")).val(); - var template_final = TemplateUtils.mergeTemplates(json_template, templateStr); if (this.action == "create") { - Sunstone.runAction("ServiceTemplate.create", template_final ); + Sunstone.runAction("ServiceTemplate.create", json_template ); return false; } else if (this.action == "update") { - Sunstone.runAction("ServiceTemplate.update",this.resourceId, JSON.stringify(template_final)); + Sunstone.runAction("ServiceTemplate.update",this.resourceId, JSON.stringify(json_template)); return false; } } function _submitAdvanced(context) { var templateStr = $('textarea#template', context).val(); - var templateJSON = this.retrieve($("form#createServiceTemplateFormWizard")); - var template_final = TemplateUtils.mergeTemplates(templateStr, templateJSON, true); - template_final = TemplateUtils.templateToString(template_final); if (this.action == "create") { - Sunstone.runAction("ServiceTemplate.create", JSON.parse(template_final) ); + Sunstone.runAction("ServiceTemplate.create", JSON.parse(templateStr) ); return false; } else if (this.action == "update") { - Sunstone.runAction("ServiceTemplate.update", this.resourceId, template_final); + Sunstone.runAction("ServiceTemplate.update", this.resourceId, templateStr); return false; } } diff --git a/src/sunstone/public/app/tabs/templates-tab/form-panels/create-common.js b/src/sunstone/public/app/tabs/templates-tab/form-panels/create-common.js index 9de6d5f257..1bd75b75e2 100644 --- a/src/sunstone/public/app/tabs/templates-tab/form-panels/create-common.js +++ b/src/sunstone/public/app/tabs/templates-tab/form-panels/create-common.js @@ -188,32 +188,25 @@ define(function(require) { function _submitWizard(context) { var templateJSON = this.retrieve(context); - var contextAdv = context[0].id.replace("Wizard", "Advanced") - var templateStr = $('textarea#template', $("form#"+contextAdv)).val(); - var template_final = TemplateUtils.mergeTemplates(templateJSON, templateStr); if (this.action == "create") { - Sunstone.runAction(this.resource+".create", {'vmtemplate': template_final}); + Sunstone.runAction(this.resource+".create", {'vmtemplate': templateJSON}); return false; } else if (this.action == "update") { - Sunstone.runAction(this.resource+".update", this.resourceId, TemplateUtils.templateToString(template_final)); + Sunstone.runAction(this.resource+".update", this.resourceId, TemplateUtils.templateToString(templateJSON)); return false; } } function _submitAdvanced(context) { var templateStr = $('textarea#template', context).val(); - var contextWiz = context[0].id.replace("Advanced", "Wizard"); - var templateJSON = this.retrieve($("form#"+contextWiz)); - var template_final = TemplateUtils.mergeTemplates(templateStr, templateJSON, true); - template_final = TemplateUtils.templateToString(template_final); if (this.action == "create") { - Sunstone.runAction(this.resource+".create", {"vmtemplate": {"template_raw": template_final}}); + Sunstone.runAction(this.resource+".create", {"vmtemplate": {"template_raw": templateStr}}); return false; } else if (this.action == "update") { - Sunstone.runAction(this.resource+".update", this.resourceId, template_final); + Sunstone.runAction(this.resource+".update", this.resourceId, templateStr); return false; } } diff --git a/src/sunstone/public/app/tabs/templates-tab/form-panels/create/wizard-tabs/storage/disk-tab.js b/src/sunstone/public/app/tabs/templates-tab/form-panels/create/wizard-tabs/storage/disk-tab.js index 2a7d361f33..df39d45a70 100644 --- a/src/sunstone/public/app/tabs/templates-tab/form-panels/create/wizard-tabs/storage/disk-tab.js +++ b/src/sunstone/public/app/tabs/templates-tab/form-panels/create/wizard-tabs/storage/disk-tab.js @@ -25,6 +25,7 @@ define(function(require) { var ImageTable = require('tabs/images-tab/datatable') var WizardFields = require('utils/wizard-fields'); var UniqueId = require('utils/unique-id'); + var TemplateUtils = require('utils/template-utils'); /* TEMPLATES @@ -159,7 +160,7 @@ define(function(require) { } tmpl["DEV_PREFIX"] = dev_prefix; } - + $.extend(tmpl, TemplateUtils.stringToTemplate($('#templateStr',context).val())); return tmpl; } @@ -198,6 +199,7 @@ define(function(require) { } WizardFields.fill(selectedContext, templateJSON); + $('#templateStr',context).val(TemplateUtils.templateToString(templateJSON)); var dev_prefix = templateJSON["DEV_PREFIX"]; if (dev_prefix != undefined && dev_prefix.length) { diff --git a/src/sunstone/public/app/tabs/templates-tab/form-panels/create/wizard-tabs/storage/disk-tab/html.hbs b/src/sunstone/public/app/tabs/templates-tab/form-panels/create/wizard-tabs/storage/disk-tab/html.hbs index 8edbec819d..d42db7a385 100644 --- a/src/sunstone/public/app/tabs/templates-tab/form-panels/create/wizard-tabs/storage/disk-tab/html.hbs +++ b/src/sunstone/public/app/tabs/templates-tab/form-panels/create/wizard-tabs/storage/disk-tab/html.hbs @@ -13,7 +13,7 @@ {{! See the License for the specific language governing permissions and }} {{! limitations under the License. }} {{! -------------------------------------------------------------------------- }} - +