mirror of
https://github.com/OpenNebula/one.git
synced 2025-03-25 02:50:08 +03:00
feature #3748: Fix issue updating a template with nics and disks
This commit is contained in:
parent
23d9398a84
commit
334b447b0a
@ -110,7 +110,7 @@ define(function(require) {
|
||||
if (!$.isEmptyObject(nicJSON)) {nicsJSON.push(nicJSON)};
|
||||
})
|
||||
|
||||
if (!$.isEmptyObject(nicsJSON)) { templateJSON['NIC'] = nicsJSON; };
|
||||
if (nicsJSON.length > 0) { templateJSON['NIC'] = nicsJSON; };
|
||||
|
||||
var nicDefault = $('#DEFAULT_MODEL', context).val();
|
||||
if (nicDefault) {
|
||||
@ -124,7 +124,7 @@ define(function(require) {
|
||||
|
||||
function _fill(context, templateJSON) {
|
||||
var that = this;
|
||||
var nics = templateJSON.NIC
|
||||
var nics = templateJSON.NIC;
|
||||
if (nics instanceof Array) {
|
||||
$.each(nics, function(nicId, nicJSON) {
|
||||
if (nicId > 0) {
|
||||
@ -141,13 +141,17 @@ define(function(require) {
|
||||
nicTab.fill(nicContext, nics);
|
||||
}
|
||||
|
||||
if (templateJSON.NIC) {
|
||||
delete templateJSON.NIC;
|
||||
}
|
||||
|
||||
var nicDefault = templateJSON.NIC_DEFAULT
|
||||
if (nicDefault != undefined) {
|
||||
if (nicDefault.MODEL) {
|
||||
$('#DEFAULT_MODEL', context).val(nicDefault.MODEL);
|
||||
}
|
||||
|
||||
delete template.NIC_DEFAULT;
|
||||
delete templateJSON.NIC_DEFAULT;
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -110,7 +110,7 @@ define(function(require) {
|
||||
if (!$.isEmptyObject(diskJSON)) {disksJSON.push(diskJSON)};
|
||||
})
|
||||
|
||||
if (!$.isEmptyObject(disksJSON)) { templateJSON['DISK'] = disksJSON; };
|
||||
if (disksJSON.length > 0) { templateJSON['DISK'] = disksJSON; };
|
||||
|
||||
return templateJSON;
|
||||
}
|
||||
@ -133,6 +133,10 @@ define(function(require) {
|
||||
var diskContext = $('#' + diskTab.diskTabId, context);
|
||||
diskTab.fill(diskContext, disks);
|
||||
}
|
||||
|
||||
if (templateJSON.DISK) {
|
||||
delete templateJSON.DISK;
|
||||
}
|
||||
}
|
||||
|
||||
function _addDiskTab(context) {
|
||||
|
Loading…
x
Reference in New Issue
Block a user