1
0
mirror of https://github.com/OpenNebula/one.git synced 2025-02-12 21:57:23 +03:00

bug #4035: Check wild format before adding it to the datatable

(cherry picked from commit a59904b6595118bef82f640c698a2d900a26abae)
This commit is contained in:
Daniel Molina 2015-10-07 17:41:02 +02:00
parent b1198e8bf8
commit 8c3b560b99

View File

@ -85,31 +85,30 @@ define(function(require) {
});
if (that.element.TEMPLATE.VM) {
wilds = that.element.TEMPLATE.VM;
var wilds = that.element.TEMPLATE.VM;
if (!$.isArray(wilds)) { // If only 1 VM convert to array
wilds = [wilds];
}
i = 0;
$.each(wilds, function(index, elem) {
var name = elem.VM_NAME;
var deploy_id = elem.DEPLOY_ID;
var template = elem.IMPORT_TEMPLATE;
$.each(wilds, function() {
var name = this.VM_NAME;
var safe_name = i;
i += 1;
var deploy_id = this.DEPLOY_ID;
if (name && deploy_id && template) {
var wilds_list_array = [
[
'<input type="checkbox" class="import_wild_checker import_' + index + '" unchecked/>',
name,
deploy_id
]
];
var wilds_list_array = [
[
'<input type="checkbox" class="import_wild_checker import_' + safe_name + '" unchecked/>',
name,
deploy_id
]
];
that.dataTableWildHosts.fnAddData(wilds_list_array);
that.dataTableWildHosts.fnAddData(wilds_list_array);
$(".import_" + safe_name, that.dataTableWildHosts).data("wild_template", atob(this.IMPORT_TEMPLATE));
$(".import_" + index, that.dataTableWildHosts).data("wild_template", atob(elem.IMPORT_TEMPLATE));
}
});
}