1
0
mirror of https://github.com/OpenNebula/one.git synced 2025-03-13 12:58:17 +03:00

B #5157 Resolved bugs with vcenter attributes (#334)

This commit is contained in:
juanmont 2017-06-13 12:18:39 +02:00 committed by Tino Vázquez
parent b5cd91901d
commit 0b3b527434
3 changed files with 16 additions and 7 deletions

View File

@ -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)){

View File

@ -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);
}
});

View File

@ -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 {