diff --git a/src/sunstone/public/js/plugins/hosts-tab.js b/src/sunstone/public/js/plugins/hosts-tab.js index 64b509b44b..78384721f9 100644 --- a/src/sunstone/public/js/plugins/hosts-tab.js +++ b/src/sunstone/public/js/plugins/hosts-tab.js @@ -1215,25 +1215,37 @@ function fillVCenterVMs(opts) { '').appendTo($(".content", opts.container)) } else { $.each(vms, function(id, vm){ - var trow = $('
' + - '
' + - '
' + - '
').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) { + $('
' + + '
' + + '' + + '
' + + '
').appendTo($(".content", opts.container)) + } }; }); }, diff --git a/src/sunstone/public/js/sunstone.js b/src/sunstone/public/js/sunstone.js index 9b9e00313f..420ca20e0e 100644 --- a/src/sunstone/public/js/sunstone.js +++ b/src/sunstone/public/js/sunstone.js @@ -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.