1
0
mirror of https://github.com/OpenNebula/one.git synced 2024-12-24 21:34:01 +03:00

feature #3383: Do not show vcenter VMs from hosts not imported

This commit is contained in:
Daniel Molina 2015-02-11 16:38:44 +01:00
parent f50883a0a8
commit d5964950da
2 changed files with 64 additions and 15 deletions

View File

@ -1215,25 +1215,37 @@ function fillVCenterVMs(opts) {
'</div>').appendTo($(".content", opts.container))
} else {
$.each(vms, function(id, vm){
var trow = $('<div class="vcenter_vm">' +
'<div class="row">' +
'<div class="large-10 columns">' +
'<label>' +
'<input type="checkbox" class="vm_name" checked/> ' +
vm.name + '&emsp;<span style="color: #999">' + vm.host + '</span>' +
'</vm>' +
'<div class="large-12 columns vcenter_vm_response">'+
if (vm.host_id === parseInt(vm.host_id, 10)) {
var trow = $('<div class="vcenter_vm">' +
'<div class="row">' +
'<div class="large-10 columns">' +
'<label>' +
'<input type="checkbox" class="vm_name" checked/> ' +
vm.name + '&emsp;<span style="color: #999">' + vm.host + '</span>' +
'</vm>' +
'<div class="large-12 columns vcenter_vm_response">'+
'</div>'+
'</div>' +
'<div class="large-2 columns vcenter_vm_result">'+
'</div>'+
'</div>' +
'<div class="large-2 columns vcenter_vm_result">'+
'</div>'+
'</div>'+
'</div>').appendTo($(".content", opts.container))
'</div>').appendTo($(".content", opts.container))
$(".vm_name", trow).data("vm_name", vm.name)
$(".vm_name", trow).data("one_vm", vm.one)
$(".vm_name", trow).data("vm_to_host", vm.host_id)
$(".vm_name", trow).data("vm_name", vm.name)
$(".vm_name", trow).data("one_vm", vm.one)
$(".vm_name", trow).data("vm_to_host", vm.host_id)
}
});
if ($(".vcenter_vm").length == 0) {
$('<div class="row">' +
'<div class="large-12 columns">' +
'<label>' +
tr("No new running VMs found in this DataCenter") +
'</label>' +
'</div>' +
'</div>').appendTo($(".content", opts.container))
}
};
});
},

View File

@ -1831,6 +1831,43 @@ function getName(id,dataTable,name_col){
return name;
};
function getHostIdFromName(hostName) {
getColumnValue({
dataTable: dataTable_hosts,
columnFilterIndex: 2, // Name
columnFilterValue: hostName,
columnResultIndex: 1 // ID
});
}
/*
Returns the value of the columnResultIndex column of the row
whose columnFilterIndex column has the columnFilterValue value
opts = {
dataTable: datatable to get the info from
columnFilterIndex: column that will be filtered
columnFilterValue: value to filter
columnResultIndex: value to be returned
}
*/
function getColumnValue(opts) {
if (typeof(opts.dataTable) == "undefined") {
return false;
};
var result = false;
$.each(opts.dataTable.fnGetData(), function(){
if (opts.columnFilterValue == this[opts.columnFilterIndex]) {
result = this[opts.columnResultIndex];
return false;
}
});
return result;
}
// A more general version of the above.
// Search a datatable record matching the filter_str in the filter_col. Returns
// the value of that record in the desired value column.