1
0
mirror of https://github.com/OpenNebula/one.git synced 2025-03-23 22:50:09 +03:00

bug #3604: Hide plots for vcenter and hybrid drivers

This commit is contained in:
Daniel Molina 2015-02-24 16:01:29 +01:00
parent c4086c611d
commit 90a69ef0d9
2 changed files with 31 additions and 29 deletions

View File

@ -1458,12 +1458,14 @@ function updateVMInfo(request,vm){
$("[href='#vm_capacity_tab']").on("click", function(){
Sunstone.runAction("VM.monitor",vm_info.ID,
{ monitor_resources : "CPU,MEMORY"});
{ monitor_resources : "CPU,MEMORY"});
})
$("[href='#vm_network_tab']").on("click", function(){
Sunstone.runAction("VM.monitor",vm_info.ID,
{ monitor_resources : "NET_TX,NET_RX"});
if (isNICGraphsSupported(vm_info)) {
Sunstone.runAction("VM.monitor",vm_info.ID,
{ monitor_resources : "NET_TX,NET_RX"});
}
})
$("[href='#vm_log_tab']").on("click", function(){
@ -2103,15 +2105,6 @@ function hotpluggingOps(){
function printNics(vm_info){
var isHybrid = calculate_isHybrid(vm_info);
// vCenter has network capabilities
if (vm_info.USER_TEMPLATE.HYPERVISOR &&
vm_info.USER_TEMPLATE.HYPERVISOR.toLowerCase() == "vcenter")
{
isHybrid = false;
}
var html ='<form id="tab_network_form" vmid="'+vm_info.ID+'" >\
<div class="row">\
<div class="large-12 columns">\
@ -2130,7 +2123,7 @@ function printNics(vm_info){
if (Config.isTabActionEnabled("vms-tab", "VM.attachnic")) {
// If VM is not RUNNING, then we forget about the attach nic form.
if (vm_info.STATE == "3" && vm_info.LCM_STATE == "3" && !isHybrid){
if (vm_info.STATE == "3" && vm_info.LCM_STATE == "3" && isNICAttachSupported(vm_info)){
html += '\
<button id="attach_nic" class="button tiny success right radius" >'+tr("Attach nic")+'</button>'
} else {
@ -2253,9 +2246,7 @@ function printNics(vm_info){
}
// Do not show statistics for not hypervisors that do not gather net data
if (!isHybrid && vm_info.USER_TEMPLATE.HYPERVISOR &&
vm_info.USER_TEMPLATE.HYPERVISOR.toLowerCase() != "vcenter")
{
if (isNICGraphsSupported(vm_info)) {
html += '\
<div class="row">\
<div class="large-6 columns">\

View File

@ -2058,16 +2058,18 @@ function plot_graph(response, info) {
var data = response.monitoring[attribute];
if(info.derivative == true && data) {
derivative(data);
}
if (data) {
if(info.derivative == true) {
derivative(data);
}
series.push({
stack: attribute,
// Turns label TEMPLATE/BLABLA into BLABLA
label: labels ? labels[i] : attribute[i].split('/').pop(),
data: data
});
series.push({
stack: attribute,
// Turns label TEMPLATE/BLABLA into BLABLA
label: labels ? labels[i] : attribute[i].split('/').pop(),
data: data
});
}
}
var humanize = info.humanize_figures ?
@ -2107,7 +2109,9 @@ function plot_graph(response, info) {
}
};
$.plot(info.div_graph, series, options);
if (series.length > 0) {
$.plot(info.div_graph, series, options);
};
}
@ -8251,12 +8255,19 @@ function getInternetExplorerVersion(){
}
// Return true if the VM has a hybrid section
function calculate_isHybrid(vm_info){
return vm_info.USER_TEMPLATE.HYPERVISOR &&
function isNICGraphsSupported(vm_info){
return !(vm_info.USER_TEMPLATE.HYPERVISOR &&
(vm_info.USER_TEMPLATE.HYPERVISOR.toLowerCase() == "vcenter"
|| vm_info.USER_TEMPLATE.HYPERVISOR.toLowerCase() == "ec2"
|| vm_info.USER_TEMPLATE.HYPERVISOR.toLowerCase() == "azure"
|| vm_info.USER_TEMPLATE.HYPERVISOR.toLowerCase() == "softlayer")
|| vm_info.USER_TEMPLATE.HYPERVISOR.toLowerCase() == "softlayer"));
}
function isNICAttachSupported(vm_info){
return !(vm_info.USER_TEMPLATE.HYPERVISOR &&
(vm_info.USER_TEMPLATE.HYPERVISOR.toLowerCase() == "ec2"
|| vm_info.USER_TEMPLATE.HYPERVISOR.toLowerCase() == "azure"
|| vm_info.USER_TEMPLATE.HYPERVISOR.toLowerCase() == "softlayer"));
}
// Return the IP or several IPs of a VM