diff --git a/src/sunstone/public/app/tabs/hosts-tab/panels/info.js b/src/sunstone/public/app/tabs/hosts-tab/panels/info.js index 4de0eca0fa..ee19e0612b 100644 --- a/src/sunstone/public/app/tabs/hosts-tab/panels/info.js +++ b/src/sunstone/public/app/tabs/hosts-tab/panels/info.js @@ -145,8 +145,10 @@ define(function(require) { RenameTr.setup(TAB_ID, RESOURCE, this.element.ID, context); ClusterTr.setup(RESOURCE, this.element.ID, this.element.CLUSTER_ID, context); - TemplateTable.setup(this.strippedTemplate, RESOURCE, this.element.ID, context, this.unshownTemplate); - TemplateTableVcenter.setup(this.strippedTemplateVcenter, RESOURCE, this.element.ID, context, this.unshownTemplate, false); + + TemplateTable.setup(this.strippedTemplate, RESOURCE, this.element.ID, context, this.unshownTemplate, this.strippedTemplateVcenter); + TemplateTableVcenter.setup(this.strippedTemplateVcenter, RESOURCE, this.element.ID, context, this.unshownTemplate, this.strippedTemplate); + PermissionsTable.setup(TAB_ID, RESOURCE, this.element, context); if($.isEmptyObject(this.strippedTemplateVcenter)){ diff --git a/src/sunstone/public/app/tabs/vms-tab/panels/info.js b/src/sunstone/public/app/tabs/vms-tab/panels/info.js index c544cba724..2251c94775 100644 --- a/src/sunstone/public/app/tabs/vms-tab/panels/info.js +++ b/src/sunstone/public/app/tabs/vms-tab/panels/info.js @@ -24,6 +24,7 @@ define(function(require) { var RenameTr = require('utils/panel/rename-tr'); var PermissionsTable = require('utils/panel/permissions-table'); var TemplateTable = require('utils/panel/template-table'); + var TemplateTableVcenter = require('utils/panel/template-table'); var OpenNebula = require('opennebula'); var Sunstone = require('sunstone'); var Config = require('sunstone-config'); @@ -107,8 +108,8 @@ define(function(require) { }); var templateTableHTML = TemplateTable.html(strippedTemplate, RESOURCE, Locale.tr("Attributes"), true); - var templateTableVcenterHTML = TemplateTable.html(strippedTemplateVcenter, RESOURCE, Locale.tr("vCenter information"), false); + var templateTableVcenterHTML = TemplateTableVcenter.html(strippedTemplateVcenter, RESOURCE, Locale.tr("Vcenter information"), false); var monitoring = $.extend({}, this.element.MONITORING); delete monitoring.CPU; @@ -164,6 +165,7 @@ define(function(require) { $('.vcenter', context).hide(); } - TemplateTable.setup(strippedTemplate, RESOURCE, this.element.ID, context, unshownValues); + TemplateTable.setup(strippedTemplate, RESOURCE, this.element.ID, context, unshownValues, strippedTemplateVcenter); + TemplateTableVcenter.setup(strippedTemplateVcenter, RESOURCE, this.element.ID, context, unshownValues, strippedTemplate); } }); diff --git a/src/sunstone/public/app/utils/panel/template-table.js b/src/sunstone/public/app/utils/panel/template-table.js index 5d3349d294..e7159d68bf 100644 --- a/src/sunstone/public/app/utils/panel/template-table.js +++ b/src/sunstone/public/app/utils/panel/template-table.js @@ -65,7 +65,9 @@ define(function(require) { have been deleted from the templateJSON param. Whithout this, a template update would permanently delete the missing values from OpenNebula */ - var _setup = function(templateJSON, resourceType, resourceId, context, unshownValues, modify=true) { + + var _setup = function(templateJSON, resourceType, resourceId, context, unshownValues, templateJSON_Others) { + // Remove previous listeners context.off("keypress", "#new_key"); context.off("keypress", "#new_value"); @@ -84,9 +86,12 @@ define(function(require) { context.on("click", '#button_add_value', function() { new_value = $('#new_value', $(this).parent().parent()).val(); new_key = $('#new_key', $(this).parent().parent()).val(); - if (modify && !templateJSON[new_key]){ + + if (!templateJSON[new_key]){ if (new_key != "") { - var templateJSON_bk = $.extend({}, templateJSON); + templateJSON = $.extend({}, templateJSON_Others, templateJSON); + var templateJSON_bk = $.extend({},templateJSON); + if (templateJSON[$.trim(new_key)] && (templateJSON[$.trim(new_key)] instanceof Array)) { templateJSON[$.trim(new_key)].push($.trim(new_value)); } else {